Aplication note 335: voice recorder

Go To Last Post
20 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,
I am trying to get the voicerecorder to actually do what the appnote 335 says it should. I transferred it to a mega32 using timer 2 in PWM mode as described.
The only thing that comes out of the speaker is crackling, when I talk the crackling changes.
Has anyone ever recreated that circuit and it worked in reasnoble quaility???
And yes, I have checked the hardware and software about 3 million times.
I just want to know if it actually works or if there is somthing wrong with the app note (beside the obviouse errors :evil: ).
Thanks
Regards

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Has anyone ever recreated that circuit and it worked in reasnoble quaility???

Yes. It works really well - although 8kHz samples would suggest a 4kHz range which is about "telephone quality" I'd say it is actually much better than telephone.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, thanks a lot.
Then I guess I do have some error then. :-(
Could you send me a dump of the the data that you recorded with it for a second or so?

Regards

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nope, I know longer have it - I started out implementing AVR335 as the basis of a project and just used it to get the basis of the PWM working. But the project developed a long way from there. (apart from anything else my sound samples have embedded motor positioning info these days so would not play right on something simply using them for PWM playback)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you taking 8 bit data or 10 bit data? (10 bit might sound a little better). Are you using a preamp? Can you go 'wooooo!' in the mic and see a sin wave at the a/d input? (When 'quiescent' it should be about 2.5v. Fancy buzzword huh?). Are you saving to dataflash and then reading back out? You can test the save and readback with a file full of known stuff like incrementing numbers. And finally, the playback. This part can also be separately tested by pumping one cycle of a sine wave out in a loop. Should be a nice lo freq sin wave.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bob makes a good point there. When I did it I started by using WAV files I recorded using a PC+soundcard and got the payback of PCM data working first. Only when I got that bit working did I add in the ADC/record stuff in the AVR. Trying to get both record and payback working at the same time has too many unknowns if it doesn't just work.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,
thanks for the replies! I am a good bit further. Like sugested I generated one tone. But that tone also sounded scrambeld. Then I hooked up a transistor directly to the PWM and the tone was much better. But still the recording is overlayd by a very high sqeek. So I suppose my AMP circuit is bad.
Thanks again.
Regards

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

So I suppose my AMP circuit is bad.

Just to be clear - you do have an RC low pass filter before the amp to convert varying duty full swing digital pulses to analogue voltages?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, I have built up the circuit according to the appnote 335.
It generally works but I have a very loud background noise. Even if I am not playing there is a high tone.
And the loudspeaker cracks when the playback is finished. I need the good quality.
Thanks again, if anyone has any other suggestions. I am thankfull for any tips.
Regards

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Generate a sinewave (maybe international A - 440Hz ?) in Audacity or CoolEdit in 8bit mono 8KHz samples. (in fact you could do it with Excel I guess). Strip the fixed size WAV header if the program doesn't let you save "raw" (CoolEdit does). Build that data into the AVR source then play it via the PWM playback. Do you hear a pure tone? If you have a scope does it look like a clean sine? If you don't have a scope can you use your PC soundcard to work as one?

EDIT: to help you on your way I just used CoolEdit 2000 to generate 1 second of 440Hz, I saved this to a raw file (so 8000 bytes) and then used xxd to convert it back to C source and ZIPped the two.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
It generally works but I have a very loud background noise
Is it 60/120Hz or computer noise?
to check it: keep to AVR in reset to see if it helps!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well the quality is by far not good enough for what I need it for so I will have to go another way.
Thanks anyway for all the help!
Regards

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But you should be able to acquire, save, readback and playback 10 bit samples at about 16khz sample rate with a fast AVR. 8 bit samples at 8kz will sound like a bad walkie talkie no matter how much pare cpu you have. Obviousy, the analog stuff has to be at least as good as you want.... biased right, no clipping, good filter on the pwm out, etc.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Normal phone quality use 8 bit but that is logaritmisk, so if you use 10 bit from the ADC but store them as 8 bit log. it should be better.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have been wanting to graft AN335 into another application for some time. It surprises me that reports of it not working properly have not surfaced before & yet at least one (clawson) has found it exceptionally good.

Quote:
And yes, I have checked the hardware and software...snip

I know where you are coming from, but I have heard experts say that too and later they have had to eat humble pie! :oops: :oops:

Some things worth checking are
a) that the processor clock & dividers are correct otherwise aliasing errors could occur.
b) that the analog interface is checked out by
(i) a loop back test ie. talking from microphone to
speaker without any digital processing &
(ii) injecting a tone & checking the frequency response of
the interface. There are some free, sound card PC signal generators & audio spectrum analyzers available which would do that OK.http://www.techmind.org/audio/index.html

I would encourage the OP to persist a little longer.

Charles Darwin, Lord Kelvin & Murphy are always lurking about!
Lee -.-
Riddle me this...How did the serpent move around before the fall?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Diaforic... you dont need an amp.... you just need a pwm output from the avr into an RC filter into a line input into the computer or a stereo.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bob, are you suggesting that only a single pole RC filter is required in lieu of the five pole LPF suggested in the data sheet??

Quote:
Then I hooked up a transistor directly to the PWM

I am not sure what transistor the OP is talking about?
Quote:
Even if I am not playing there is a high tone.

It sounds to me if the lpf is taking off as in oscillating(assuming one was built)!

Another thing I just noted, is that the Vccmax on the Flash is 3.3V

Charles Darwin, Lord Kelvin & Murphy are always lurking about!
Lee -.-
Riddle me this...How did the serpent move around before the fall?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's what I'm claiming. A simple filter that works is better than 5 opamps that clip and have the wrong tuning r values. Get something working, and if it sounds too crappy, do something fancier.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To be honest (and I know this violates the per pin mA consumption limits) but when I was playing with this, before an electronics engineer built an amp/filter circuit for me I did nothing more than connect an 8ohm speaker to the OC1A header on an STK500 and it STILL produced "acceptable" (better than "walkie-talkie" in fact) audio quality. However as the telecoms products we've also developed previously taught me, one of the key factors is the "audio chamber". If you stick an 8ohm speaker on a pin and play it's "tinny" and close to inaudible, if you now take the advanced audio chamber development facility (read "plastic cup from tea machine") and invert it over the speaker there's about a 1,000 fold improvement in audio quality! ;-)

(the trapped air acts as a resonant chamber - but make sure there's no tea in it first!)

Cliff

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, I agree that a crook amplifier and/or an un-baffled speaker would sound very poor.http://stereos.about.com/od/glossaryoftermsb/g/baffle.htm
The OP has suggested he checked the circuit 3 million times, but of course it is easy to overlook the same minor error over and over again especially if built on veroboard. The circuit in the application note should probably have some decoupling especially on the Vcc/2 reference point.
A relative complex amplifier needs verification by measurement, that it actually works as intended less it produces copious amounts of banshee noise.
I hope to build this project up in the next few days when I get some spare time.

Charles Darwin, Lord Kelvin & Murphy are always lurking about!
Lee -.-
Riddle me this...How did the serpent move around before the fall?