Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

OT: Sound record/playback

OT: Sound record/playback

2005-08-22 by Lasse Madsen

Hi All,

I’m facing a new challenge that I haven’t tried to solve before and I would like some input if anyone has tried this before. I need to record and playback voice/sound from a microphone and store it on a Secure Digital card with FAT16 file format, which is no problem, but what I would like some input on is what “front end” IC I could use to maybe do the MP3 encoding so that I only have to “cheat” and store the pre encoded signal on the SD card and be able to play it back again.

I was thinking of using maybe a IC like this: http://www.analog.com/UploadedFiles/Data_Sheets/76229755AD73311L_a.pdf although it does not have the capacity to encode/decode MP3, I could use it for both encoding and decoding my raw audio signal, but what I can’t determine is if I’m able to store the data as fast as it samples with 64/32KHz onto the SD card.

I know that Micronas makes some kind of MAS de/encoder for MP3 but have anyone had success with it?

Best regards

Lasse Madsen

/My current knowledge doesn’t enable me to use DSP processors as I’ve never worked with them before and now is not the time to start unfortunately.

Re: [AVR-Chat] OT: Sound record/playback

2005-08-22 by Jesper Hansen

Do you really need to encode it ? Why not just store the raw samples ?
You can use the internal A/D for sampling, and playback with PWM.
A dual op-amp can be used as a microphone pre-amp.
Assuming a 8-kHz sample rate (you didn't say what quality you needed),
you'd only need to store 1 (or perhaps 2 if you use more that 8-bit 
resolution
from the internal A/D) per sample => 8000 bytes per second.
That like a walk in the park for an AVR.

For MP3 encoding/decoding, look at the Micronas MAS3587.

/Jesper
Show quoted textHide quoted text
> I'm facing a new challenge that I haven't tried to solve before and I 
> would
> like some input if anyone has tried this before. I need to record and
> playback voice/sound from a microphone and store it on a Secure Digital 
> card
> with FAT16 file format, which is no problem, but what I would like some
> input on is what "front end" IC I could use to maybe do the MP3 encoding 
> so
> that I only have to "cheat" and store the pre encoded signal on the SD 
> card
> and be able to play it back again.
>
>
>
> I was thinking of using maybe a IC like this:
> http://www.analog.com/UploadedFiles/Data_Sheets/76229755AD73311L_a.pdf
> although it does not have the capacity to encode/decode MP3, I could use 
> it
> for both encoding and decoding my raw audio signal, but what I can't
> determine is if I'm able to store the data as fast as it samples with
> 64/32KHz onto the SD card.
>
>
>
> I know that Micronas makes some kind of MAS de/encoder for MP3 but have
> anyone had success with it?
>
>
>
> Best regards
>
> Lasse Madsen
>
>
>
> /My current knowledge doesn't enable me to use DSP processors as I've 
> never
> worked with them before and now is not the time to start unfortunately.
>
>

RE: [AVR-Chat] OT: Sound record/playback

2005-08-22 by Lasse Madsen

Hi Jesper,

Raw sampling is a possibility I'm considering but then it's not possible to
load the file into a PC for example without storing it as WAV or something
similar.

I think 8 KHz sampling rate is not enough to create a sound like one would
expect from a tape recorder/MD or similar device.

What if I "only" needed 16 KHz sampling from a 16bit DAC connected to the
SPI or XMEM interface and stored that onto the card on the fly and then
loaded one of the 16bit timers with the recorded result and forwarded
through the "record buffer" with 16KHz wouldn't that work ?

I have never tried to use the onboard 16bit timer for audio generation 
Is it possible to get a decent "sound" out of an RC filter being pulsed with
PWM? 

Best regards
Lasse Madsen
Show quoted textHide quoted text
-----Original Message-----
From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf
Of Jesper Hansen
Sent: 22. august 2005 12:29
To: AVR-Chat@yahoogroups.com
Subject: Re: [AVR-Chat] OT: Sound record/playback

Do you really need to encode it ? Why not just store the raw samples ?
You can use the internal A/D for sampling, and playback with PWM.
A dual op-amp can be used as a microphone pre-amp.
Assuming a 8-kHz sample rate (you didn't say what quality you needed),
you'd only need to store 1 (or perhaps 2 if you use more that 8-bit 
resolution
from the internal A/D) per sample => 8000 bytes per second.
That like a walk in the park for an AVR.

For MP3 encoding/decoding, look at the Micronas MAS3587.

/Jesper

> I'm facing a new challenge that I haven't tried to solve before and I 
> would
> like some input if anyone has tried this before. I need to record and
> playback voice/sound from a microphone and store it on a Secure Digital 
> card
> with FAT16 file format, which is no problem, but what I would like some
> input on is what "front end" IC I could use to maybe do the MP3 encoding 
> so
> that I only have to "cheat" and store the pre encoded signal on the SD 
> card
> and be able to play it back again.
>
>
>
> I was thinking of using maybe a IC like this:
> http://www.analog.com/UploadedFiles/Data_Sheets/76229755AD73311L_a.pdf
> although it does not have the capacity to encode/decode MP3, I could use 
> it
> for both encoding and decoding my raw audio signal, but what I can't
> determine is if I'm able to store the data as fast as it samples with
> 64/32KHz onto the SD card.
>
>
>
> I know that Micronas makes some kind of MAS de/encoder for MP3 but have
> anyone had success with it?
>
>
>
> Best regards
>
> Lasse Madsen
>
>
>
> /My current knowledge doesn't enable me to use DSP processors as I've 
> never
> worked with them before and now is not the time to start unfortunately.
>
> 




 
Yahoo! Groups Links

Re: [AVR-Chat] OT: Sound record/playback

2005-08-22 by David Kelly

On Aug 22, 2005, at 5:45 AM, Lasse Madsen wrote:

> Raw sampling is a possibility I'm considering but then it's not  
> possible to
> load the file into a PC for example without storing it as WAV or  
> something
> similar.

WAV is essentially a raw data file with minimal header prepended.

--
David Kelly N4HHE, dkelly@HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.

RE: [AVR-Chat] OT: Sound record/playback

2005-08-22 by Thomas Keller

On Mon, 2005-08-22 at 12:45 +0200, Lasse Madsen wrote:
> Raw sampling is a possibility I'm considering but then it's not
> possible to load the file into a PC for example without storing it as
> WAV or something similar.

   AIUI. "WAV" *IS* raw sampled audio.

> I think 8 KHz sampling rate is not enough to create a sound like one
> would expect from a tape recorder/MD or similar device.
> What if I "only" needed 16 KHz sampling from a 16bit DAC connected to
> the SPI or XMEM interface and stored that onto the card on the fly and
> then loaded one of the 16bit timers with the recorded result and
> forwarded through the "record buffer" with 16KHz wouldn't that work ?

   Using a 16 or 20 Mhz AVR, this shouldn't be a problem.  The actual
speed isn;'t going to be as big a problem for you in terms of fidelity
as the size of your samples.  8 bit samples are going to resultin a
pretty "grainy" sound.  10 bit samples will be marginally better.

> I have never tried to use the onboard 16bit timer for audio generation
> Is it possible to get a decent "sound" out of an RC filter being
> pulsed with PWM? 

   PWM actual.y offers a better solution than plain analog, in many
audio applications.  The higher speed AVRs are plenty fast enough to do
audio PWM (aka Class D) without difficulty.  You may want to consider
driving your output through a half-bridge FET circuit, and using
polarity switching, to get a true AC audio signal out.  The other
possibility, if you aren;'t restriced to single chip, is to use an
external DAC, but that is expensive, and given the 10 bit nature of your
sound (assuming you use 10 bit as opposed to 8) youwon't gain much.

tom

RE: [AVR-Chat] OT: Sound record/playback

2005-08-22 by Lasse Madsen

Would I be able to get better sound using a 10bit R2R network than using a
16bit PWM timer? 

Regards
Lasse Madsen
Show quoted textHide quoted text
-----Original Message-----
From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf
Of Thomas Keller
Sent: 22. august 2005 15:02
To: AVR-Chat@yahoogroups.com
Subject: RE: [AVR-Chat] OT: Sound record/playback

On Mon, 2005-08-22 at 12:45 +0200, Lasse Madsen wrote:
> Raw sampling is a possibility I'm considering but then it's not
> possible to load the file into a PC for example without storing it as
> WAV or something similar.

   AIUI. "WAV" *IS* raw sampled audio.

> I think 8 KHz sampling rate is not enough to create a sound like one
> would expect from a tape recorder/MD or similar device.
> What if I "only" needed 16 KHz sampling from a 16bit DAC connected to
> the SPI or XMEM interface and stored that onto the card on the fly and
> then loaded one of the 16bit timers with the recorded result and
> forwarded through the "record buffer" with 16KHz wouldn't that work ?

   Using a 16 or 20 Mhz AVR, this shouldn't be a problem.  The actual
speed isn;'t going to be as big a problem for you in terms of fidelity
as the size of your samples.  8 bit samples are going to resultin a
pretty "grainy" sound.  10 bit samples will be marginally better.

> I have never tried to use the onboard 16bit timer for audio generation
> Is it possible to get a decent "sound" out of an RC filter being
> pulsed with PWM? 

   PWM actual.y offers a better solution than plain analog, in many
audio applications.  The higher speed AVRs are plenty fast enough to do
audio PWM (aka Class D) without difficulty.  You may want to consider
driving your output through a half-bridge FET circuit, and using
polarity switching, to get a true AC audio signal out.  The other
possibility, if you aren;'t restriced to single chip, is to use an
external DAC, but that is expensive, and given the 10 bit nature of your
sound (assuming you use 10 bit as opposed to 8) youwon't gain much.

tom




 
Yahoo! Groups Links

RE: [AVR-Chat] OT: Sound record/playback

2005-08-22 by Thomas Keller

On Mon, 2005-08-22 at 15:06 +0200, Lasse Madsen wrote:
> Would I be able to get better sound using a 10bit R2R network than
> using a 16bit PWM timer? 

  No.  The limiting factor here is the size of your sample (e.g.,. `10
bits).   The  PWM will work just fine.

Tom

RE: [AVR-Chat] OT: Sound record/playback

2005-08-22 by david.pallant@prometheanworld.com


I get the feeling this thread has gone off in totally the wrong direction. You are talking about high quality sound as you have mentioned MD and recording music so I would forget about 8 or 10 bit conversion. With the 10bit convertors in the AVRs I would guess you will get one or two bits of noise so you are reduced to around 50dB signal to noise or dynamic range.

Using the internal convertors also ignores the plusses that you have lost throwing away an external ADC or Codec and that is that you need a good quality microphone amplifier with a decent amount of gain. Another problem you create by using the internal ADC is the enormous amount of filtering you need to prevent aliasing problems particularly when using sampling rates in the audio band. If you are using the internal ADC running at 8kHz with just 8 bits of real resolution you are going to need at least 4 poles of filtering if not more at 16kHz to prevent high freqencies sounding like a robot or a greetings card!

I haven't got a feel for budget from your earlier emails but some of the sound card codecs should be available with mic amp and will give you sample sizes which can be easily reduced to 16 bit at sample rates that can be set to suit your memory size. They use very high frequency convertors and digital filters intenrally which mean you have to do little or no external audio filtering to prevent aliasing problems. Your choice of the Analogue Devices part will give you far better quality than internal ADC and PWM output and for $3 is a bargain but still borderline quality for music if you are thinking MD or CD quality. If you want to put music through it you might need to look at the Analog Devices Soundmax Codecs but you would then need an external mic amp.

For example have a look at the WM8974 from Wolfson (I dont work for them!) which for under $4 gives a mic amp, high quality CODEC and a speaker driver (might be useful). Will do all that down to 8kHz if stuck for data throughput although I still wouldnt recommend it with music. It also gives a bare minimum dynamic range for "tape recorder/MD" quality.
http://www.wolfson.co.uk/products/digital_audio/codecs/WM8974/

Dave Pallant




AVR-Chat@yahoogroups.com wrote on 22/08/2005 14:06:07:

> Would I be able to get better sound using a 10bit R2R network than using a
> 16bit PWM timer?
>
> Regards
> Lasse Madsen
>
>
>
> -----Original Message-----
> From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf
> Of Thomas Keller
> Sent: 22. august 2005 15:02
> To: AVR-Chat@yahoogroups.com
> Subject: RE: [AVR-Chat] OT: Sound record/playback
>
> On Mon, 2005-08-22 at 12:45 +0200, Lasse Madsen wrote:
> > Raw sampling is a possibility I'm considering but then it's not
> > possible to load the file into a PC for example without storing it as
> > WAV or something similar.
>
> � �AIUI. "WAV" *IS* raw sampled audio.
>
> > I think 8 KHz sampling rate is not enough to create a sound like one
> > would expect from a tape recorder/MD or similar device.
> > What if I "only" needed 16 KHz sampling from a 16bit DAC connected to
> > the SPI or XMEM interface and stored that onto the card on the fly and
> > then loaded one of the 16bit timers with the recorded result and
> > forwarded through the "record buffer" with 16KHz wouldn't that work ?
>
> � �Using a 16 or 20 Mhz AVR, this shouldn't be a problem. �The actual
> speed isn;'t going to be as big a problem for you in terms of fidelity
> as the size of your samples. �8 bit samples are going to resultin a
> pretty "grainy" sound. �10 bit samples will be marginally better.
>
> > I have never tried to use the onboard 16bit timer for audio generation
> > Is it possible to get a decent "sound" out of an RC filter being
> > pulsed with PWM?
>
> � �PWM actual.y offers a better solution than plain analog, in many
> audio applications. �The higher speed AVRs are plenty fast enough to do
> audio PWM (aka Class D) without difficulty. �You may want to consider
> driving your output through a half-bridge FET circuit, and using
> polarity switching, to get a true AC audio signal out. �The other
> possibility, if you aren;'t restriced to single chip, is to use an
> external DAC, but that is expensive, and given the 10 bit nature of your
> sound (assuming you use 10 bit as opposed to 8) youwon't gain much.
>
> tom
>
>
>
>
> �
> Yahoo! Groups Links
>
>
>
> �
>
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor --------------------~-->
> Get Bzzzy! (real tools to help you find a job) Welcome to the
> Sweet Life -�brought to you by One Economy
.
;
> --------------------------------------------------------------------~->
>
> �
> Yahoo! Groups Links
>
> <*> To visit your group on the web, go to:
> � � http://groups.yahoo.com/group/AVR-Chat/
>
> <*> To unsubscribe from this group, send an email to:
> � � AVR-Chat-unsubscribe@yahoogroups.com
>
> <*> Your use of Yahoo! Groups is subject to:
> � � http://docs.yahoo.com/info/terms/
> �
>
>

Promethean Technologies Group Ltd and or associated and or subsidiary companies�:

The views expressed in this communication may not necessarily be the views held by Promethean Technologies Group Ltd and or associated and or subsidiary companies.

This e-mail is for the exclusive use of the addressee(s). Unauthorised disclosure, copying or distribution is prohibited.

This e-mail message has been swept for the presence of computer viruses.

Promethean Technologies Group Ltd and or associated and or subsidiary companies�accepts no liability for any loss resulting from this email transmission.



*****************************************************************
This email has been checked by the e-Sweeper Service
*****************************************************************

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.