MorganS:
WAV is a very specific form of compression that works well for audio data. A small WAV file holds many megabytes of audio.
The Arduino memory is just a few kilobytes. It cannot hold even 1 second of uncompressed audio. What do you want to do with that tiny piece of data?
thank you for MorganS reply
I have a project about speech recognition using Arduino.The idea is to convert the wav file(The file size is about 8K) to Base64 to facilitate server identification.
MorganS:
WAV is a very specific form of compression that works well for audio data. A small WAV file holds many megabytes of audio.
That's not true at all. WAV is a container format and can contain audio data in a variety of different codecs. However, most commonly, WAV is used to store uncompressed linear PCM data.
I'm not sure if I read all the information contained in the entire wav file.
Why don't you? You know (or could, the library knows) the size of the file. You know how many bytes you read from the file. The numbers match and you've read all the data, or they don't, and you haven't.
Hi wgq6959424, and others,
A long time ago (1990) I managed to play wav files using a PC printer port and DAC/ADC. On the dark age on information. I get some information about .wav on magazines ans other pre internet information media.
The microsoft wave file have a 44 bytes of header, one of these bytes store the bit sample size, 8bit, 16 bits, etc.
I starting my study of Arduino, I dion't know all functions of API/ABI.
If wav file always have same format, just ignore first 44bytes and read rest of data according of know bit sample size.
If wav file always have same format, just ignore first 44bytes and read data according of bit sample size.
If you ignore the first 44 bytes, you won't know the bit sample size, so reading the rest of the data "according of bit sample size" isn't going to work too well.
pksato:
Hi wgq6959424, and others,
A long time ago (1990) I managed to play wav files using a PC printer port and DAC/ADC. On the dark age on information. I get some information about .wav on magazines ans other pre internet information media.
The microsoft wave file have a 44 bytes of header, one of these bytes store the bit sample size, 8bit, 16 bits, etc.
I starting my study of Arduino, I dion't know all functions of API/ABI.
If wav file always have same format, just ignore first 44bytes and read data according of bit sample size.
The current idea is to open the wav file and then read each byte.
File myFile = SD.open("16k.wav");
byte buffer[256];
uint16_t bufLen=myFile.read(buffer,256);
for (uint16_t i=0;i<bufLen;i++){
Serial.print(buffer*,HEX);*
}*
myFile.close();* I'm not sure if I read all the information contained in the entire wav file. [/quote] Ok, was what you read "binary"? By now you surely realize every byte on every file is "binary". Paul
MorganS:
That will read bytes from the file. But they are meaningless without decompression
Nonsense. It is a standard WAV file, 16-bit PCM sampled at 16kHz. NO compression.
All that is required to read it, is to read two bytes at a time and that will give the 16-bit samples.
Or read the whole thing into a suitably sized buffer of signed 16-bit integers.