I made a noise canceller filter (get it here)

Discussion in 'Effects and the DSP' started by Tril, Mar 5, 2005.

  1. stuthemong

    stuthemong New Member

    Joined:
    Feb 16, 2004
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    0
    ok, so the .da should just load straight into KX with an input and output tab.

    I have outlined the iterative forumula that needs to be run in my report, Its 3 or 4 lines - I wonder how we can manage the intermediate results in memory.

    This writing to RAM thing, how slow is it compared to the KX DSP? I imagine we are talking a lot more delay - do we know more about this? The less delay we have, the better ANC works by far

    Stu
     
  2. Tril

    Tril Triple screen racing ftw

    Joined:
    Sep 26, 2004
    Messages:
    1,665
    Likes Received:
    19
    Trophy Points:
    48
    iTram is internal memory to the card. It's a circular buffer. It's used to make delays but you can use it with a delay of one sample to get more memory. If you use it (I did in my plugin) you have to know that data is compressed to less bits. You still get good sound but less perfect.

    xTram is system memory (RAM). It is also used to create delay lines. You can't use it as fast because of latency. I'd say you need around 25 samples between write and read to/from it. If we wanted to, we could use it in the filter to make the filter as big as possible. It's 64 on emu10k2. 64/2=32. We could add 32 coefficients to the filter if we use it. We would use it all on the past samples for the delay line. We would need to insert a sample in it at least 25 samples before using it. It is easily possible. There would be no delay because we introduce that data in advance in xTram. We could not use xTram for the coefficients because they need to change faster.

    GPRS is the normal memory. It's on the card so you can read and write multiples times to it in a cycle.
     
  3. stuthemong

    stuthemong New Member

    Joined:
    Feb 16, 2004
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    0
    Tril, all sounds very complex :)

    When you get a chance to look at the algorithm we can think about how best to do this. I dont think that we will run into huge problems so long as we have say 8 bits resolution.

    The other thing we can do is not update the filter every sample, but every 50th or so - maybe this way we can lower the overall DSP computing complexity, which may buy us time in buffers etc..

    Stu
     
  4. Tril

    Tril Triple screen racing ftw

    Joined:
    Sep 26, 2004
    Messages:
    1,665
    Likes Received:
    19
    Trophy Points:
    48
    I worked a bit more on this project of active noise cancellation. I gave up trying make a plugin for the emu10kx. There are not enough ressources. That's too bad. It would have been almost real time.

    It needs code for two FIR filters and the adaptation. There are not enough GPRs and instruction to do that. The NLMS algorithm works better than the LMS algorithm but it needs to do divisions. If there were only one or two divisions, I could use an approximation of division but there is a need for hundreds of them.

    I made two VST filters for ASIO and I use KRISTAL to run them. The first filter does the same thing as the dane plugin I made before but with some more options. It works well. It takes a lot of processing power though. With a FilterLength of 400, I get about 90% CPU usage on my AMD Athlon Thunderbird clocked at 1207 MHz. It uses time domain convolution as the dane plugin. It would use less CPU if the convolution was do in the frequency domain using FFT but I can't use that. When using FFT, you do the convolution on a block of input. It gives you back the convoluted block of input. I need to do the convolution on one sample at a time so that the coefficients of the filter are adapted between each convolution. You can use that plugin with two microphones and headphones (or a peak plugin) to know how much the noise is reduced. This filter tells you what is the maximum amount of noise reduction that you will be able to achieve with the second filter in a real world situation. If you can get a good amount of reduction with this plugin you should not even try the second one.

    The plugin can also be used to find an estimation of the impulse response of the forward path, that is, how does the sound change between the output of the sound card and the input to the microphone. The coefficients can be saved.

    The second filter can load the coefficients made by the first plugin. You input what comes from a microphone close to a noise source in the left channel and what comes from the microphone in the listening position in the right channel. You adjust the settings of the filter and THEORICALLY you are supposed to notice a diminution in the ambiant noise. The second plugin takes less CPU than the first one even when using two FIR filter of length 400 because (I think) there is a calculations needed in the first plugin that is not needed in the second.

    In PRACTICE, I was only able to achieve an increase in ambiant noise. All I get is feedback from using the speakers and the microphones together. It is much harder to achieve something working correctly when you have to take into account the delay caused by using ASIO and the time the sound takes to move in the air. Even if it does not work, it is still an interesting subject.

    Better microphones might help. I'm currently using two different electret microphones connected on two different sound cards. One card is compatible with kX and the other one is not. I unmuted the volume of the mic on the incompatible card. I plugged a cable from the output of the non compatible card to the line in of the compatible cable and used Lemury's ADC plugin to get Mic and Line in at the same time. I should at least use two identical mics even if they are cheap.

    Since the plugins I made are not kX plugins but VST plugins I won't share them here. They also don't really work well (especially the second one) and take alot of CPU. It also does not appeal to musicians since they don't need it.

    I thought I would share my experience. I found coding VST plugins harder than kX plugins. Especially in the beginning. The emu10kx chips use instructions that saturate or wraparound on overflow. You need to take care of that yourself when coding VST plugins. I forgot at first and nothing worked.

    All that testing and programming of plugins would not have been possible without the kX drivers as I needed a custom DSP to route the mics directly to asio, etc. Thank you Eugene and all the others for the drivers.

    Well, that post was a bit long.;)
     
  5. totya

    totya New Member

    Joined:
    Feb 13, 2011
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    0
    Hi, thanks for this plugin, but I don't use this, because reference pin need noise only input. I can record noise to wav, but how can I add this wav to reference pin?
     

Share This Page

visited