From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Raw PCM to WAV

I very much appreciate your response.

 

I actually did/had gone through to the best of my ability. I realize that the ChunkSize is identified via your import, but I can't seem to understand the rest of your header. Following WAVEfmt, you coded:

"10.00.00.00" for "16" for SubChunk Size
"01" for AudioFormat
"01" for Mono Channel

 

"80.3E.00.00" for "16000Hz" - which I expected "00.00.3E.80" or "3E.80.00.00" (based off my basic understanding of encoding)

 

You then have "00.7D.00.00" for Byte Rate

 

"04.00" for Bits per sample, which I don't understand? You are specifying 4 bits per sample?

 


Thanks greatly for any clarification you can offer...

0 Kudos
Message 11 of 15
(1,139 Views)

some parameter doesn't affect (in my case).

here corrected:

Positions Sample Value Description


0 - 3 (0x52,0x49,0x46,0x46)"RIFF" ==> Marks the file as a riff file. Characters are each 1 byte long.
4 - 7 (0x32,0x4F,0x00,0x00) = 0x00004F32 = 20,274 ==> File size (integer) Size of the overall file - 8 bytes, in bytes (32-bit integer). Typically, you'd fill this in after creation.
8 -11 (0x57,0x41,0x56,0x45 = "WAVE") ==> File Type Header. For our purposes, it always equals "WAVE".
12-15 (0x66,0x6D,0x74,0x20 = "fmt ") ==> Format chunk marker. Includes trailing null
16-19 (0x10,0x00,0x00,0x00 = 0x00000010 = 16) ==> Length of format data as listed above
20-21(0x01,0x00 = 0x0001 = 1) ==> Type of format (1 is PCM) - 2 byte integer
22-23 (0x01,0x00 = 0x0001 = 1)  ==> 1 Number of Channels - 1 byte integer
24-27 (0x80,0x3E,0x00,0x00 = 0x00003E80 = 16,000 ) ==> Sample Rate - 32 byte integer. Common values are 44100 (CD), 48000 (DAT). Sample Rate = Number of Samples per second, or Hertz.
28-31 (0x00,0x7D,0x00,0x00 = 0x00007D00 = 32,000) ==> (Sample Rate * BitsPerSample * Channels) / 8 ==> (16000 * 16*1) /8 = 32,000
32-33 (0x02,0x00) = (16*1)/8 = 2 ==> where (BitsPerSample * Channels) / 8. 1 = 8 bit mono, 2 = 8 bit stereo/16 bit mono4 - 16 bit stereo
34-35 (0x00,0x10 = 0x0010 = 16 ) ==> Bits per sample
36-39 (0x64,0x61,0x74,0x61 = "data")  ==>where "data" chunk header. Marks the beginning of the data section.
40-43 (0x00,0x00,0x4F,0x0E = 22238) ==> NO Little Endian. File size (data) Size of the data section.

 

see vi modified.

 

0 Kudos
Message 12 of 15
(1,131 Views)

This helps a lot!

 

On line 34-35, did you mean: "10.00" instead of "00.10" ?

And on line 40-43, what do you mean "NO Little Endian"?

 

I'm very grateful, thanks!

0 Kudos
Message 13 of 15
(1,127 Views)

sorry, you are right (is in Little Endian)

do you know what Little Endian means?

please take a look here: https://en.wikipedia.org/wiki/Endianness

 

and the next is in Little Endian too, my mistake

and here: http://soundfile.sapp.org/doc/WaveFormat/

 

 

 

 

but don't worry about that

 

on line 40~43, no need to put use Big Endian

 

0 Kudos
Message 14 of 15
(1,123 Views)

I understand the differences a little.. it's not my specialization.

 

 

Those lines HAVE TO BE little endian? I think my PCM is big endian... but I have no idea because my source is foreign. I've set everything else up the same way. I think the data is big endian too.

0 Kudos
Message 15 of 15
(1,121 Views)