DSPRelated.com
Forums

Re: PCM audio samples from .txt file (convert to .wav)

Started by Jeff Brower July 7, 2006
Dinesh-

> Thank you for your response. I was able to resolve the software
> differences between the 6713 and the DM642. By EVM I was referring to
> the EVM DM642. I apologise for not making that clear.

Ok, glad you got it working.

> Our board has a built-in microphone. Eventually, audio from the input
> will be sent to the DSP, as PCM samples, and out to the PC via a USB
> controller connected to the EMIF. I have to get to programming the USB
> controller and some work with the application to listen the audio on
> the PC. Instead I'm trying to evaluate the quality of the captured
> audio by copying the contents on the receive buffer on the DSP to a
> file on the PC and then playing it back.
>
> I have been able to save the PCM samples to a file. I'm not quite sure
> how to manipulate it for playback. The problem I think is with the way
> I saved the file; as a .txt. So now I need a way to convert a .txt
> file which has PCM sample values in 32-bit signed integer
> representation to a .wav or some other PC compatible format. I have
> also thought of creating and adding my own header.
>
> While saving the file I used commas to separate the values, and stored
> the values as signed integers. If I were to add my own header will I
> need to remove the commas and store the values as hexadecimal. Also
> what extension should I use when saving the file.

To turn a .txt file into .wav file is easy -- one excellent tool you can try on trial
basis is CoolEdit. For a short-form "quick reference" on .wav header and format, try
here (look for section 4.2, Microsoft .WAV Waveform File Format):

ftp://ftp.signalogic.com/documentation/DirectDSP/Reference%20Guide/chap4.pdf

For a more formal explanation:

http://www.sonicspot.com/guide/wavefiles.html

-Jeff
> --- In c..., "Jeff Brower" wrote:
> >
> > Dinesh-
> >
> > So your board still has AIC23B, like DSK 6713? If that's the case, why
> > can't you hook up audio output just temporarily for debug purposes?
> >
> > Seems easy. Then you can focus on software differences between 6713 and
> > DM642, and go one step-at-a-time. In your board design you could
> have put
> > optional audio output commponents, to be populated only during debug or
> > for future product purposes.
> >
> > -Jeff
> >
> > Might it have been a good idea to include that codec
> > >
> > > I need suggestions for a problem I need to solve.
> > >
> > > I am running an example similar to the dsk_apps provided for the
> C6713; an
> > > audio loopback using the McASP and EDMA transfers. The program works
> > > perfectly on the EVM. Now I have to port this over to our custom
> board,
> > > which has the audio in only, i.e there is no way to loop the audio
> back
> > > out. Therefore, I'm trying to write the contents of the buffers in
> the DSP
> > > to a file. After I get it right, I can make the buffers big enough
> so it
> > > can hold sufficient audio data for analysis.
> > >
> > > Here's what I've tried so far. The EDMA is setup to transfer audio
> data
> > > received on the McASP to a block of memory. Once the block is
> full, the
> > > entire block is copied to a transmit buffer also in memory. At the
> same
> > > time the receive buffer in memory is also copied to a file.
> > >
> > > I believe that even during the routine that copies the rx buffer
> to a file
> > > the EDMA still functions in the background and keeps updating the
> buffer.
> > > So the file I have is not one entire buffer but samples from several
> > > buffers. Is there a way I can halt the entire program including EDMA
> > > transfers so I can get a copy of one whole buffer to a file?
> > >
> > > The audio is sampled at 48kHz on the AIC23B. The AIC23B is
> connected to
> > > the DM642 using the McASP and the samples are of 32-bit length.
> > >
> > > The samples are copied to a .txt file. It is my understanding that the
> > > samples copied to the file are in PCM format and knowing the
> sampling rate
> > > and resolution should be sufficient to play it back. Please let me
> know if
> > > this is correct, and how I can play it back.
> > >
> > > Any suggestions? Thanks for your time.
> > >
> > > Dinesh