Noise Reduction Suggestions?
in Propeller 1
Hello. I'm kind of new to these forums. I was playing with the really cool audio demo in the propeller tool and trying to learn from it and noticed that recording audio from the jack on my Activity Board WX is fairly noisy. A lot of background hiss and all that. I was wondering if anyone here has suggestions to alleviate that.
Comments
http://sim.okawa-denshi.jp/en/Fkeisan.htm
And getting the best results means that you select the best (expensive) IC:s you can find!
Enjoy!
Mike
ShiftRight := 0
Accu := Accu - ShiftRight(Accu) + newSample
OutValue := Accu
This is quite senseless if ShiftRight == 0, because you substract Accu from Accu, add NewSample and output newSample. But just another example for a complex solution to a simple problem.
But if ShiftRight == 1, you add to half of the Accumulator the new value what realizes a RC-filter., now you can play with ShiftRight to see, what happens.. Sorry: to hear what happens. We will see what happens November third.
filtered += ((input - filtered) ** a) << 1
where a is the 31-bit fractional part of (filter time constant)*(Δt), i.e. $4000_0000 represents dividing by three and corresponds to a shift of 1 in ErNa's example, and $2aaa_aaaa divides by about 3. This way more directly resembles the differential equation for a first-order RC filter. You could probably replace the ** a with shifts and adds, but if you're not doing it in PASM and you aren't using Fastspin it shouldn't make a significant difference. Note that this will fail if you try setting a to $8000_0000, because that actually represents -1.0, and not 1.0, so you'll need to add a special case or change the shifts around (probably losing yourself another bit of precision) if you anticipate that happening.If you used floating point, which I don't recommend due to its complexity and poor performance, it would just look like this:
filtered += (input - filtered) * a
EDIT: Fixed usage of **.
https://forums.parallax.com/discussion/133173/fir2pasm-automatic-fir-filter-code-generator/p1
-Phil
neg scr, ADCVal ' new ADC counter value add scr, ADCValOld ' substract old one shl scr, IntTimP ' multiply value by 2^n add ADCAccu, scr ' add to average accumulator mov ADCVal, ADCAccu sar ADCVal, #MaxAvrg ' new averaged value
This code is a little tricky. The problem with RC-filters is that changing the time constant changes the level of the accumulator. So every change of the time constant causes a bump in the signal. Here we have a normalized accumulator level so there is no bump.IntTimP is the time constant, MaxAvrg the highest possible value of the time constant. Take care that the accumulator can not overflow
If so allow the audio to pass straight through from input to output (call this OUT1), and at the same time apply a HIGH-PASS filter to the input and output that as (OUT2). Treat OUT2 as an error correction for OUT1 in a PID loop.
This is one of many tricks used in noise cancellation headphones. Another trick is to use FFT to denote stationary frequencies present in the input and apply that similarly into a PID as well.
Thanks for the reminder!
I already had these calculators bookmarked but forgot about them.
I have been having trouble with stabilising a couple of servo motors, to no avail. Your post prompted me to look at my LPF and wouldn't you know it
My little pack of caps, clearly state 2.2nf and so I checked them with my meter... Whoa, 2.2uf!!!!
I source my parts from a big-name vendor and this is not the first time that this has happened.
I lost a day, playing with my PID and looking for mechanical backlash (position feedback is on the load)
Regards,
Craig
http://forums.parallax.com/discussion/141346/yet-another-wave-player-now-nco-based-and-noise-almost-free
Which output method is used in "really cool audio demo in the propeller tool"? If it is duty mode PWM, the noise may be due to the high intrinsic subharmonic content of that method. The method suggested by PIK33 uses a standard single-frequency PWM with noise shaping.
Also this followup...
http://forums.parallax.com/discussion/148280/prop-sound-quality-question