Sign in

username:

password:



Not a member?

Search compdsp



Search tips

comp.dsp by Keywords

Adaptive Filter | ADPCM | ADSP | ADSP-2181 | Aliasing | AMR | Anti-Aliasing | ARMA | Autocorrelation | AutoCovariance | Beamforming | Bessel | Blackfin | Butterworth | C6713 | CCS | Chebyshev | CIC Filter | Circular Convolution | Code Composer Studio | Comb Filter | Compression | Convolution | Cross Correlation | DCT | Decimation | Deconvolution | Demodulation | DM642 | DSP Boards | DSP/BIOS | DTMF | Echo Cancellation | Equalization | Equalizer | ETSI | EZLITE (Ez-kit Lite) | FFT | FFTW | FIR Filter | Fixed Point | FSK | G.711 | G.723 | G.729 | Gaussian Noise | Goertzel | GPIO | Hilbert Transform | IFFT | IIR Filter | Interpolation | Invariance | JTAG | Kalman | Laplace Transform | Levinson | LPC | McBSP | MIPS | Modulation | MPEG | Multirate | Notch Filter | Nyquist | OFDM | Oversampling | Pink Noise | Pitch | PLL | Polyphase | QAM | QDMA | Quantization | Quantizer | Radar | Random Noise | Reed Solomon | Remez | Resampling | RTDX | Sampling | Sharc | TI C6711 | Undersampling | Viterbi | Wavelets | White Noise | Wiener Filter | Windowing | XDS510PP | Z Transform


Discussion Groups

Free Online Books

See Also

Embedded SystemsFPGAElectronics

Discussion Groups | Comp.DSP | WAV to PCM conversion

There are 28 messages in this thread.

You are currently looking at messages 0 to 10.


WAV to PCM conversion - 2006-05-11 06:20:00

Hi all,

I've recorded a wav file at 8KHz with an 8bit sample size. I now want
to write code to convert the data from the wav file to PCM, so that I
can send it over my ISDN Card to a phone. I've read that a wav file is
basicaly the PCM data with some headers. If this is true, it shouldnt
be that difficult to convert it. However, I havent been able to figure
out how to do this.... 

Could someone please help me out...

______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: WAV to PCM conversion - Mark - 2006-05-11 09:27:00



see:


http://ccrma.stanford.edu/CCRMA/Courses/422/projects/WaveFormat/
Mark

______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: WAV to PCM conversion - Erik de Castro Lopo - 2006-05-12 08:17:00

S...@gmail.com wrote:
> 
> Hi all,
> 
> I've recorded a wav file at 8KHz with an 8bit sample size. I now want
> to write code to convert the data from the wav file to PCM, so that I
> can send it over my ISDN Card to a phone. I've read that a wav file is
> basicaly the PCM data with some headers. If this is true, it shouldnt
> be that difficult to convert it. However, I havent been able to figure
> out how to do this....

Don't convert the file, just read it as it is using 

    http://www.mega-nerd.com/libsndfile/

Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
"The lusers I know are so clueless, that if they were dipped in
 clue musk and dropped in the middle of pack of horny clues, on
 clue prom night during clue happy hour, they still couldn't get
 a clue."   --Michael Girdwood, in the monastery
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: WAV to PCM conversion - David Kirkland - 2006-05-13 09:56:00

S...@gmail.com wrote:
> Hi all,
> 
> I've recorded a wav file at 8KHz with an 8bit sample size. I now want
> to write code to convert the data from the wav file to PCM, so that I
> can send it over my ISDN Card to a phone. I've read that a wav file is
> basicaly the PCM data with some headers. If this is true, it shouldnt
> be that difficult to convert it. However, I havent been able to figure
> out how to do this.... 
> 
> Could someone please help me out...
> 

You may want to look at the Sox utility at sourcefourge.

Cheers,
David
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: WAV to PCM conversion - Michel Rouzic - 2006-05-14 20:22:00

S...@gmail.com wrote:
> Hi all,
>
> I've recorded a wav file at 8KHz with an 8bit sample size. I now want
> to write code to convert the data from the wav file to PCM, so that I
> can send it over my ISDN Card to a phone. I've read that a wav file is
> basicaly the PCM data with some headers. If this is true, it shouldnt
> be that difficult to convert it. However, I havent been able to figure
> out how to do this....
>
> Could someone please help me out...

Funny, it seems that I'm the only one out there who wrote his own
input/output .wav functions. They are quite simple and can read and
write 8-bit, 16-bit and 32-bit IEEE-754 float format and output the PCM
data to a bidimensional array of doubles as well as an array with the
content of each tag in it. Drop me a mail if you'd like to see the code.

______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: WAV to PCM conversion - Richard Dobson - 2006-05-15 05:54:00

Michel Rouzic wrote:
..
> Funny, it seems that I'm the only one out there who wrote his own
> input/output .wav functions. They are quite simple and can read and
> write 8-bit, 16-bit and 32-bit IEEE-754 float format and output the PCM
> data to a bidimensional array of doubles as well as an array with the
> content of each tag in it. Drop me a mail if you'd like to see the code.
> 

Well , not quite the only one! Eric has already posted about libsndfile, 
which should be enough to dissuade most people from ever needing to roll 
their own. I have my own library as I don't just use file formats, I 
design them too, - it may get published some day!  There are many other 
open-source libraries "out there", mostly in C, but some in C++ (e.g. in 
Perry Cook's "STK"). Best to ask on the music-dsp list for more 
information, as those folk use such things all the time. Almost always, 
the answer is libsndfile, unless your requirements are especially esoteric.

Richard Dobson
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: WAV to PCM conversion - Erik de Castro Lopo - 2006-05-15 16:55:00

Michel Rouzic wrote:
> 
> Funny, it seems that I'm the only one out there who wrote his own
> input/output .wav functions. They are quite simple and can read and
> write 8-bit, 16-bit and 32-bit IEEE-754 float format and output the PCM
> data to a bidimensional array of doubles as well as an array with the
> content of each tag in it. Drop me a mail if you'd like to see the code.

One of the things your WAV parser probably doesn't have is code
that works around the vast number of broken and malformed files
that are generated by software people rolled themselves.
libsndfile has this.

If you really want to roll your own go for it. If it comes to
writing, please use libsndfile because if you make a mistake
I might have to add code to work around the malformed files
you create. Its not just smaller developers who get this
wrong either. There are some well know pieces of software
which have versions which create bad files.

Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
"One of Subversions biggest weaknesses is its lack of adequate internal
tracking for merges." -- William Nagle in "Subversion Version Control"
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: WAV to PCM conversion - Jon Harris - 2006-05-16 02:35:00

"Michel Rouzic" <M...@yahoo.fr> wrote in message 
news:1...@y43g2000cwc.googlegroups.com...
>
> S...@gmail.com wrote:
>> Hi all,
>>
>> I've recorded a wav file at 8KHz with an 8bit sample size. I now want
>> to write code to convert the data from the wav file to PCM, so that I
>> can send it over my ISDN Card to a phone. I've read that a wav file is
>> basicaly the PCM data with some headers. If this is true, it shouldnt
>> be that difficult to convert it. However, I havent been able to figure
>> out how to do this....
>>
>> Could someone please help me out...
>
> Funny, it seems that I'm the only one out there who wrote his own
> input/output .wav functions. They are quite simple and can read and
> write 8-bit, 16-bit and 32-bit IEEE-754 float format and output the PCM
> data to a bidimensional array of doubles as well as an array with the
> content of each tag in it. Drop me a mail if you'd like to see the code.

It's one of those things where it can be very simple to read a few types of wave 
files, but to really handle all the permutations, corner cases, errors, etc. 
gracefully it becomes a much bigger project. 


______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: WAV to PCM conversion - Ross Clement (Email address invalid - do not use) - 2006-05-16 05:20:00

I must agree with Erik. Once you use libsndfile once and find how easy
it is, I can see few reasons not to use it whenever you want to read or
write WAV files. I prefer to think of sampled data as being floating
point rather than integers, and with libsndfile, I don't ever get
exposed to the underlying data format. It's just as easy to read the
data as integers if you prefer.

Cheers,

Ross-c

______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: WAV to PCM conversion - Jerry Avins - 2006-05-16 11:42:00

Ross Clement (Email address invalid - do not use) wrote:


>     ... I prefer to think of sampled data as being floating
> point rather than integers, ...

Do you suppose there will ever be a floating-point ADC?

Jerry
-- 
Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

| 1 | 2 | 3 | next