Forums

Suggestions on how to eliminate 'click'

Started by Charlie E. March 28, 2012
Hi All,
Ok, I have been bashing my head against the wall all day, again, and
once more request my betters show me the correct path...

Here is the problem I have.  I have been trying to improve the audio
quality on my color readers.  It presently uses ADPCM, which is
decoded and used to adjust the bandwidth on a PWM output on my PIC24,
fitered by a fourth order Sallen filter into my amplifier.  The audio
is very scratchy, and has received very mixed reviews from users and
retailers.

So, How to improve it?  By experiment, I have tried to just use
standard 8 bit PCM recorded audio.  It does sound better, but at the
end of each sample is a very noticable 'click.'  I can't be absolutely
sure what is causing it, but I think that it is due to the final value
in the file that indicates termination is so low (0x04) that the
sudden transition may be the source of the click.  It isnt my turning
the power amplifier on and off, I have tested that...

So, any ideas?  Anyone else dealt with this sort of thing before?

Thanks,
Charlie
On Wed, 28 Mar 2012 16:55:16 -0700, Charlie E. <edmondson@ieee.org>
wrote:

>Hi All, >Ok, I have been bashing my head against the wall all day, again, and >once more request my betters show me the correct path... > >Here is the problem I have. I have been trying to improve the audio >quality on my color readers. It presently uses ADPCM, which is >decoded and used to adjust the bandwidth on a PWM output on my PIC24, >fitered by a fourth order Sallen filter into my amplifier. The audio >is very scratchy, and has received very mixed reviews from users and >retailers. > >So, How to improve it? By experiment, I have tried to just use >standard 8 bit PCM recorded audio. It does sound better, but at the >end of each sample is a very noticable 'click.' I can't be absolutely >sure what is causing it, but I think that it is due to the final value >in the file that indicates termination is so low (0x04) that the >sudden transition may be the source of the click. It isnt my turning >the power amplifier on and off, I have tested that... > >So, any ideas? Anyone else dealt with this sort of thing before? > >Thanks, >Charlie
Ok, so that works. How do you solve a problem? Ask someone else so that you think about it a little different! Final view of problem? Final value output was termination value, not actual data, causing a click. Solution? Delay each value by one cycle, so that the termination value has a chance to terminate the loop before it is output! Now, to go find an icepack for my poor forehead... ;-) Charlie
On Wed, 28 Mar 2012 17:03:51 -0700, Charlie E. <edmondson@ieee.org>
wrote:

>On Wed, 28 Mar 2012 16:55:16 -0700, Charlie E. <edmondson@ieee.org> >wrote: > >>Hi All, >>Ok, I have been bashing my head against the wall all day, again, and >>once more request my betters show me the correct path... >> >>Here is the problem I have. I have been trying to improve the audio >>quality on my color readers. It presently uses ADPCM, which is >>decoded and used to adjust the bandwidth on a PWM output on my PIC24, >>fitered by a fourth order Sallen filter into my amplifier. The audio >>is very scratchy, and has received very mixed reviews from users and >>retailers. >> >>So, How to improve it? By experiment, I have tried to just use >>standard 8 bit PCM recorded audio. It does sound better, but at the >>end of each sample is a very noticable 'click.' I can't be absolutely >>sure what is causing it, but I think that it is due to the final value >>in the file that indicates termination is so low (0x04) that the >>sudden transition may be the source of the click. It isnt my turning >>the power amplifier on and off, I have tested that... >> >>So, any ideas? Anyone else dealt with this sort of thing before? >> >>Thanks, >>Charlie > >Ok, so that works. How do you solve a problem? Ask someone else so >that you think about it a little different! > >Final view of problem? Final value output was termination value, not >actual data, causing a click. > >Solution? Delay each value by one cycle, so that the termination >value has a chance to terminate the loop before it is output! > >Now, to go find an icepack for my poor forehead... ;-) > >Charlie
I find that Brunello di Montalcino makes a fine "icepack" ;-) ...Jim Thompson -- | James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.
Charlie E. wrote:

> On Wed, 28 Mar 2012 16:55:16 -0700, Charlie E. <edmondson@ieee.org> > wrote: > > >>Hi All, >>Ok, I have been bashing my head against the wall all day, again, and >>once more request my betters show me the correct path... >> >>Here is the problem I have. I have been trying to improve the audio >>quality on my color readers. It presently uses ADPCM, which is >>decoded and used to adjust the bandwidth on a PWM output on my PIC24, >>fitered by a fourth order Sallen filter into my amplifier. The audio >>is very scratchy, and has received very mixed reviews from users and >>retailers. >> >>So, How to improve it? By experiment, I have tried to just use >>standard 8 bit PCM recorded audio. It does sound better, but at the >>end of each sample is a very noticable 'click.' I can't be absolutely >>sure what is causing it, but I think that it is due to the final value >>in the file that indicates termination is so low (0x04) that the >>sudden transition may be the source of the click. It isnt my turning >>the power amplifier on and off, I have tested that... >> >>So, any ideas? Anyone else dealt with this sort of thing before? >> >>Thanks, >>Charlie > > > Ok, so that works. How do you solve a problem? Ask someone else so > that you think about it a little different! > > Final view of problem? Final value output was termination value, not > actual data, causing a click. > > Solution? Delay each value by one cycle, so that the termination > value has a chance to terminate the loop before it is output! > > Now, to go find an icepack for my poor forehead... ;-) > > Charlie
Yes, and there is also another way if you have an extra output to play with, and that is to use a JFET as a by pass switch when the system is on. The output will have a small by pass cap that won't see much effect in the circuit then, when you turn off the JFET, you'll be left with nothing more than a large value R that was coupling the JFET to raise the Z which is also connected to this cap. This will give you the decay you need regardless of where you switched off. Basically switching a low pass filter in. Jamie
Charlie E. wrote:
> Hi All, > Ok, I have been bashing my head against the wall all day, again, and > once more request my betters show me the correct path... > > Here is the problem I have. I have been trying to improve the audio > quality on my color readers. It presently uses ADPCM, which is > decoded and used to adjust the bandwidth on a PWM output on my PIC24, > fitered by a fourth order Sallen filter into my amplifier. The audio > is very scratchy, and has received very mixed reviews from users and > retailers. > > So, How to improve it? By experiment, I have tried to just use > standard 8 bit PCM recorded audio. It does sound better, but at the > end of each sample is a very noticable 'click.' I can't be absolutely > sure what is causing it, but I think that it is due to the final value > in the file that indicates termination is so low (0x04) that the > sudden transition may be the source of the click. It isnt my turning > the power amplifier on and off, I have tested that... > > So, any ideas? Anyone else dealt with this sort of thing before? > > Thanks, > Charlie
yes, it is most likely that. When turning off a stream you need to decay it.. Just view the last sample or next to the last ones and pad some decay at the end. This means you'll need to have a few bytes sitting around where you can see them for inspection before they go out the door. I don't know how you are actually turning things off? are you just ending a stream of PCM bits or actually electrically turning off an output via a IO bit or hard switch? I am shocked you don't have at least a basic scope to see all of this happening ? Jamie
On Wed, 28 Mar 2012 20:11:14 -0500, Jamie
<jamie_ka1lpa_not_valid_after_ka1lpa_@charter.net> wrote:

>Charlie E. wrote: >> Hi All, >> Ok, I have been bashing my head against the wall all day, again, and >> once more request my betters show me the correct path... >> >> Here is the problem I have. I have been trying to improve the audio >> quality on my color readers. It presently uses ADPCM, which is >> decoded and used to adjust the bandwidth on a PWM output on my PIC24, >> fitered by a fourth order Sallen filter into my amplifier. The audio >> is very scratchy, and has received very mixed reviews from users and >> retailers. >> >> So, How to improve it? By experiment, I have tried to just use >> standard 8 bit PCM recorded audio. It does sound better, but at the >> end of each sample is a very noticable 'click.' I can't be absolutely >> sure what is causing it, but I think that it is due to the final value >> in the file that indicates termination is so low (0x04) that the >> sudden transition may be the source of the click. It isnt my turning >> the power amplifier on and off, I have tested that... >> >> So, any ideas? Anyone else dealt with this sort of thing before? >> >> Thanks, >> Charlie >yes, it is most likely that. When turning off a stream you need to >decay it.. > > Just view the last sample or next to the last ones and pad some >decay at the end. This means you'll need to have a few bytes sitting > around where you can see them for inspection before they go out the >door. > > I don't know how you are actually turning things off? are you just >ending a stream of PCM bits or actually electrically turning off an >output via a IO bit or hard switch? > > I am shocked you don't have at least a basic scope to see all of this >happening ? > >Jamie >
Hi Jamie, Tried it on a scope. I have a nice Rigol here on the bench. However, these voice samples are about half a second each. The unit doesn't have enough memory to clearly see the end if I keep the time step large enough to see the end... :-( Was especially fun when trying to see the 'raspy' audio output! Charlie
Charlie E. wrote:

> On Wed, 28 Mar 2012 20:11:14 -0500, Jamie > <jamie_ka1lpa_not_valid_after_ka1lpa_@charter.net> wrote: > > >>Charlie E. wrote: >> >>>Hi All, >>>Ok, I have been bashing my head against the wall all day, again, and >>>once more request my betters show me the correct path... >>> >>>Here is the problem I have. I have been trying to improve the audio >>>quality on my color readers. It presently uses ADPCM, which is >>>decoded and used to adjust the bandwidth on a PWM output on my PIC24, >>>fitered by a fourth order Sallen filter into my amplifier. The audio >>>is very scratchy, and has received very mixed reviews from users and >>>retailers. >>> >>>So, How to improve it? By experiment, I have tried to just use >>>standard 8 bit PCM recorded audio. It does sound better, but at the >>>end of each sample is a very noticable 'click.' I can't be absolutely >>>sure what is causing it, but I think that it is due to the final value >>>in the file that indicates termination is so low (0x04) that the >>>sudden transition may be the source of the click. It isnt my turning >>>the power amplifier on and off, I have tested that... >>> >>>So, any ideas? Anyone else dealt with this sort of thing before? >>> >>>Thanks, >>>Charlie >> >>yes, it is most likely that. When turning off a stream you need to >>decay it.. >> >> Just view the last sample or next to the last ones and pad some >>decay at the end. This means you'll need to have a few bytes sitting >> around where you can see them for inspection before they go out the >>door. >> >> I don't know how you are actually turning things off? are you just >>ending a stream of PCM bits or actually electrically turning off an >>output via a IO bit or hard switch? >> >> I am shocked you don't have at least a basic scope to see all of this >>happening ? >> >>Jamie >> > > > Hi Jamie, > Tried it on a scope. I have a nice Rigol here on the bench. However, > these voice samples are about half a second each. The unit doesn't > have enough memory to clearly see the end if I keep the time step > large enough to see the end... :-( > > Was especially fun when trying to see the 'raspy' audio output! > > Charlie
I also have a Rigol as one of many scopes I have, Use the average, peak detect or glitch detect option, I forget what it's called now on the Rigol, I have to many scopes to play with, they are all a little different in description :) Jamie
"Charlie E."
> > Here is the problem I have. I have been trying to improve the audio > quality on my color readers. It presently uses ADPCM, which is > decoded and used to adjust the bandwidth on a PWM output on my PIC24, > fitered by a fourth order Sallen filter into my amplifier. The audio > is very scratchy, and has received very mixed reviews from users and > retailers.
*** 8 bit PCM can sound OK ** IF ** you properly "dither" the samples. Dither converts the gritty modulation noise into a smooth hisssss - far more acceptable.
> So, How to improve it? By experiment, I have tried to just use > standard 8 bit PCM recorded audio. It does sound better, but at the > end of each sample is a very noticeable 'click.' I can't be absolutely > sure what is causing it, but I think that it is due to the final value > in the file that indicates termination is so low (0x04) that the > sudden transition may be the source of the click.
** If an audio signal is terminated abruptly, by switching or other means, there is usually an audible click. The click sound is worst if the signal drops from a maximum to zero but even terminating at a zero crossing does not eliminate the click. The two most popular solutions are to always wait for silence before terminating or else rapidly FADE the signal to zero over a period of time like 50 or 100 milliseconds. Obviously, there are hardware and software ways to do both things. .... Phil
On Thu, 29 Mar 2012 17:46:50 +1100, Phil Allison wrote:

> "Charlie E." >> >> Here is the problem I have. I have been trying to improve the audio >> quality on my color readers. It presently uses ADPCM, which is decoded >> and used to adjust the bandwidth on a PWM output on my PIC24, fitered >> by a fourth order Sallen filter into my amplifier. The audio is very >> scratchy, and has received very mixed reviews from users and retailers. > > > *** 8 bit PCM can sound OK ** IF ** you properly "dither" the > samples. > > Dither converts the gritty modulation noise into a smooth hisssss - > far > more acceptable.
_One_ bit PCM can sound good, if you dither it right. And 1st-order sigma-delta converters are easy to whomp up. You don't have enough speed in a processor to do just one bit -- but this technique on audio, to get telephone-quality audio from one pin on an FPGA, and I've used it numerous times to extend DAC resolution in control systems: http://eetimes.com/design/embedded/4006431/Sigma-delta-techniques-extend- DAC-resolution -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
On Thu, 29 Mar 2012 10:24:24 -0500, Tim Wescott
<tim@seemywebsite.please> wrote:

>On Thu, 29 Mar 2012 17:46:50 +1100, Phil Allison wrote: > >> "Charlie E." >>> >>> Here is the problem I have. I have been trying to improve the audio >>> quality on my color readers. It presently uses ADPCM, which is decoded >>> and used to adjust the bandwidth on a PWM output on my PIC24, fitered >>> by a fourth order Sallen filter into my amplifier. The audio is very >>> scratchy, and has received very mixed reviews from users and retailers. >> >> >> *** 8 bit PCM can sound OK ** IF ** you properly "dither" the >> samples. >> >> Dither converts the gritty modulation noise into a smooth hisssss - >> far >> more acceptable. > >_One_ bit PCM can sound good, if you dither it right. And 1st-order >sigma-delta converters are easy to whomp up. You don't have enough speed >in a processor to do just one bit -- but this technique on audio, to get >telephone-quality audio from one pin on an FPGA, and I've used it >numerous times to extend DAC resolution in control systems: > >http://eetimes.com/design/embedded/4006431/Sigma-delta-techniques-extend- >DAC-resolution
Thanks Tim and Phil, Well, now that I have the 8 bit straight PCM figured out, I of course find that I don't have enough memory! The original ADPCM basically took 16 bits down to 4, so I had the same length of sound in half the space that my 8 bit samples take up. Since I had, of course, pretty much maxed out my memory previously, I am not left with only half enough memory... :-( Do you think dithering would help the raspy sound of my ADPCM output? Interesting note: In the code I am adapting, the actual PCM output cycle is running at 16KHz and it used the same value twice each sample to acheive 8KHz resolution. perhaps dithering between the two cycles would give me less noise? Charlie