Speech storage

J

john smith

Guest
Hi guys,

I am trying to store 8 kHz speech onto flash memory. I am using an msp430
microcontroller, which has both ADC & DAC for recording and playing back. To
minimise hardware, I want to set the ADC sample rate at 44 kHz and the down
sample it to 8 KHz for storage, and to play back I want to up sample it back
to 44 KHz.

How would I do this? What kind of digital filters do I need (assuming I
filtered out the microphone input to roll off 3dB at 4 KHz) for the down and
up sampling?



Any help will be appreciated
 
john smith <john@microsoft.com> wrote:
Hi guys,

I am trying to store 8 kHz speech onto flash memory. I am using an msp430
microcontroller, which has both ADC & DAC for recording and playing back. To
minimise hardware, I want to set the ADC sample rate at 44 kHz and the down
sample it to 8 KHz for storage, and to play back I want to up sample it back
to 44 KHz.

How would I do this? What kind of digital filters do I need (assuming I
filtered out the microphone input to roll off 3dB at 4 KHz) for the down and
up sampling?
If you've got the filter in hardware, then you can simply take
sample 1 as the first sample, sample (5+6)/2 as the second, sample 11
as the third, ...
(So you're picking a sample every 1/8Khz, and compensating for the fact that
you've not got an exact sample at sample 5.5)
To play back, linear interpolation is probably not too bad.
If you can record at 8.8Khz, then just ignore the above, and use every 5th
sample.
 
john smith wrote:
Hi guys,

I am trying to store 8 kHz speech onto flash memory. I am using an msp430
microcontroller, which has both ADC & DAC for recording and playing back. To
minimise hardware, I want to set the ADC sample rate at 44 kHz and the down
sample it to 8 KHz for storage, and to play back I want to up sample it back
to 44 KHz.

How would I do this? What kind of digital filters do I need (assuming I
filtered out the microphone input to roll off 3dB at 4 KHz) for the down and
up sampling?



Any help will be appreciated
To be 'the most correct', you must use reampling, both of the times as
the factor between 44.1kHz and 8kHz is not an integer but a rationnal.


You can search for polyphase resampling.

http://cnx.rice.edu/content/m10443/latest/


Of course, as suggested in another post, just taking one sample every N
samples would be an easy way to proceed. And linear interpolation for
upsampling.


Another solution is to use a speech compression algorithm that will give
you <64kbps bitrate with good quality.


Sylvain
 
Any one have an code example how to implement upsampling interpolation
using a microcontroller and lookup table?

cheers
mark


Sylvain Munaut wrote:
john smith wrote:
Hi guys,

I am trying to store 8 kHz speech onto flash memory. I am using an msp430
microcontroller, which has both ADC & DAC for recording and playing back. To
minimise hardware, I want to set the ADC sample rate at 44 kHz and the down
sample it to 8 KHz for storage, and to play back I want to up sample it back
to 44 KHz.

How would I do this? What kind of digital filters do I need (assuming I
filtered out the microphone input to roll off 3dB at 4 KHz) for the down and
up sampling?



Any help will be appreciated

To be 'the most correct', you must use reampling, both of the times as
the factor between 44.1kHz and 8kHz is not an integer but a rationnal.


You can search for polyphase resampling.

http://cnx.rice.edu/content/m10443/latest/


Of course, as suggested in another post, just taking one sample every N
samples would be an easy way to proceed. And linear interpolation for
upsampling.


Another solution is to use a speech compression algorithm that will give
you <64kbps bitrate with good quality.


Sylvain
 
First, are you FORCED to have 8khz, or can you do with 8.82 khz or 7.350
khz ?

Theses gives respectively a nice 1/5 and 1/6 ratio.

Then for upsampling that would be (not tested ...) :


#define UPSAMPLE 5

int is,os,us;
unsigned short in[SIZE_IN], out[SIZE_IN*UPSAMPLE];
unsigned short lut[UPSAMPLE] =
{ 0x0000, 0x3333, 0x6666, 0x9999, 0xCCCC };

for (os=0, is=0 ; i<SIZE_IN-1 ; i++)
for (us=0 ; us < UPSAMPLE ; us++, os++)
out[os] = ( in[is] * (0x10000 - lut[us])
+ in[is+1] * lut[us])) >> 16;

/* Copy last sample */
/* Note that if it's a continuous stream, that will be part
of the next frame */
out[SIZE_IN*UPSAMPLE - 1] = in[SIZE_IN-1];



Marky wrote:
Any one have an code example how to implement upsampling interpolation
using a microcontroller and lookup table?

cheers
mark


Sylvain Munaut wrote:

john smith wrote:

Hi guys,

I am trying to store 8 kHz speech onto flash memory. I am using an msp430
microcontroller, which has both ADC & DAC for recording and playing back. To
minimise hardware, I want to set the ADC sample rate at 44 kHz and the down
sample it to 8 KHz for storage, and to play back I want to up sample it back
to 44 KHz.

How would I do this? What kind of digital filters do I need (assuming I
filtered out the microphone input to roll off 3dB at 4 KHz) for the down and
up sampling?



Any help will be appreciated

To be 'the most correct', you must use reampling, both of the times as
the factor between 44.1kHz and 8kHz is not an integer but a rationnal.


You can search for polyphase resampling.

http://cnx.rice.edu/content/m10443/latest/


Of course, as suggested in another post, just taking one sample every N
samples would be an easy way to proceed. And linear interpolation for
upsampling.


Another solution is to use a speech compression algorithm that will give
you <64kbps bitrate with good quality.


Sylvain
 

Welcome to EDABoard.com

Sponsor

Back
Top