Suggestions on how to eliminate 'click'

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

Reply to
Charlie E.
Loading thread data ...

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

Reply to
Charlie E.

I find that Brunello di Montalcino makes a fine "icepack" ;-) ...Jim Thompson

--
| James E.Thompson, CTO                            |    mens     |
| Analog Innovations, Inc.                         |     et      |
 Click to see the full signature
Reply to
Jim Thompson

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

Reply to
Charlie E.

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

Reply to
Jamie

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

Reply to
Jamie

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

Reply to
Jamie

"Charlie E."

*** 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.

** 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

Reply to
Phil Allison

_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:

formatting link
DAC-resolution

--
Tim Wescott
Control system and signal processing consulting
 Click to see the full signature
Reply to
Tim Wescott

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

Reply to
Charlie E.

extend-

That depends on whether your ADPCM itself is making things raspy, or if it is the resolution of your reproduction. Given that 8-bit PCM sounds better, I suspect that your ADPCM doesn't have sufficient resolution.

Get a bigger processor, maybe? Or see if you can make a trade off between slower sampling and more ADPCM resolution? Or investigate other compression techniques, like MPEG or ogg-vorbis.

--
My liberal friends think I'm a conservative kook.
My conservative friends think I'm a liberal kook.
 Click to see the full signature
Reply to
Tim Wescott

You could try a straight-line interpolation between two adjacent values from the table (this isn't "dithering" in the usual sense). If you have enough processor power you could implement a more sophisticated filter, but it may not be worth the effort when dealing with such low-resolution input data.

--
Dave Platt                                    AE6EO
Friends of Jade Warrior home page:  http://www.radagast.org/jade-warrior
 Click to see the full signature
Reply to
Dave Platt

I'd pull each clip into something like Audacity and trim back until the last sample of the sound clip ends on a sample VERY near zero.

Jon

Reply to
Jon Elson

Could you post some audio samples of ADPCM output vs the straight PCM output? Either way, the original audio file should have its dynamic range heavily compressed before having its bit-depth converted to make full use of the limited dynamic range available. If that hasn't been done, doing so might improve the audio quality.

Reply to
bitrex

Just to clarify, what I mean is that by compressing the dynamic range of the audio file and keeping its RMS level high, you make sure that it's always well above the noise floor.

Reply to
bitrex

Ok, another interesting fact. The routines that write to the PWM register shift it to only use 10 bits! So, it takes a 4 bit ADPCM sample, decodes it to 16 bits, and then throws six bits away! No wonder it sounds raspy...

Charlie

Reply to
Charlie E.

It often works for me. It forces you to define the problem clearly.

--
Reply in group, but if emailing add one more
zero, and remove the last word.
 Click to see the full signature
Reply to
Tom Del Rosso

I do it all the time. Irritates some folks just because I ask :-(

There is no such thing as a dumb question. Just dumb answers... which the irritated folks seem to specialize in :-) ...Jim Thompson

--
| James E.Thompson, CTO                            |    mens     |
| Analog Innovations, Inc.                         |     et      |
 Click to see the full signature
Reply to
Jim Thompson

There are lots of dumb questions. That "there are no dumb questions" is a convenient fiction to try to persuade people to speak up in class--sort of like "we're all equals here" in a brainstorming session.

It doesn't mean "your question isn't a stupid one", it means "we promise not to think you're stupid for asking, if you don't ask too many."

I ask a certain number of stupid questions myself--Bob Pease once wrote an article on "sudden cessation of stupidity." (I'd be quite happy with "sufficiently lengthy interruption of stupidity". ;)

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs
Principal Consultant
 Click to see the full signature
Reply to
Phil Hobbs

I had a circuits class where a student asked some relevant-but-very-basic question (I don't recall what anymore) and the prof really laid into him about how it was he couldn't possibly know the answer himself, he should have learned that in EE 101 (or perhaps grade school), etc.

I figured that since passing EE 101 (or whatever it was) was a prerequisite for the prof's class, the kid not knowing it might say more about how poor the EE 101 profs were than the kid's own shortcomings.

That prof -- while pretty savvy -- had a reputation for laying into student like that. I was amazed one day to see in the campus paper that he was a member of a group calling themselves the Good Christian Professors or somesuch (I'm just making up the name there, as again I don't recall what it really was) and suggesting that students should feel free to contact any of the members of the group if they had questions regarding their spirituality or similar.

Knowing how he treated kids in class, I kinda chuckled a bit, thinking that in a million years I wouldn't *ever* be tempted to go see the fellow regarding faith; I could only imagine what kind of lecturing he'd give you if you weren't quite up on who did what, where and when in the Bible! :-)

Reply to
Joel Koltner

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.