Recording wav works, but playback fails #1635
-
I am recording a wav file to sd. The file records fine, it can be played on a pc. I doubt, this is really a codec problem, but I cant find anything wrong in my sketch.
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 19 replies
-
Display a hex dump of the header of the WAV file: there seems to be something wrong! I see the following problems:
Finally set the log level to info so that you can check what's happening. I guess your logic just deletes the file with the valid WAV header. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I created a new wav file with audacity:
and a new minimalistic sketch to just play it:
This also does not play, but the headers is at least recognized now:
This might be a completely different issue. |
Beta Was this translation helpful? Give feedback.
-
So i narrowed it down to the ConverterFillLeftAndRight object. The following sketch runs without any problems (only on one channel). BUT: As soon as the "filler" is added to the copier in the loop, the old Error occurs (Wav Format 0 not supported). //Audio Setup AudioInfo sd_info(48000, 1, 32); I2SStream out; VolumeMeter meter(in); WAVDecoder wav; File file; // final output stream MultiOutput multi_out; StreamCopy copier; ConverterFillLeftAndRight<int32_t> filler(RightIsEmpty); // fill both channels - or change to RightIsEmpty // Arduino Setup // change to Warning to improve the quality // start I2S out auto config_in = in.defaultConfig(RX_MODE); auto configvol = volume.defaultConfig(); multi_out.add(volume); //Start I2S Devices conv.begin(info, sd_info); volume.setVolume(20.0); // Open SD drive record(); // Cleanup if necessary // open file copier.begin(multi_out,meter); void play(){ //open File to play encoded.begin(info); copier.begin(encoded, file); bool playing = false; |
Beta Was this translation helpful? Give feedback.
Using the filler when you play back is a big mistake: this changes the signal which also includes the header!
Use 2 separate copiers or a ConverterStream on the recording side only