-
-
Notifications
You must be signed in to change notification settings - Fork 309
-
Hello @pschatzmann.
I try to coded a simple WAV recorder, to capture audio from LineIn jack of Audiokit A1S with ES8388v2, but not always the file end fine, sometimes the file is closed good and is possible to play the file under windows but others says corrupt file .
This is the simple code. kitStream is the object of board. The same configuration is used to play MP3 and capture samples without problems.
Could you help me to know where is the issue of file corruption?
Thanks in advance.
Code
new_sr.sample_rate = 22050;
kitStream.setAudioInfo(new_sr);
AudioInfo enc_sr = encoderOutWAV.defaultConfig();
enc_sr.sample_rate = 22050;
encoderOutWAV.setAudioInfo(enc_sr);
MultiOutput cmulti;
StreamCopy copier(cmulti, kitStream); // copies data to both file and line_out
cmulti.add(encoderOutWAV);
cmulti.add(kitStream);
AudioInfo ecfg = encoderOutWAV.defaultConfig();
ecfg.sample_rate = 22050;
ecfg.channels = 2;
ecfg.bits_per_sample = 16;
encoderOutWAV.setAudioInfo(ecfg);
// recording loop until STOP flag!
while (!STOP)
{
copier.copy();
}
// End stream and closing file.
copier.end();
cmulti.end();
wavfile.flush();
wavfile.close();
Beta Was this translation helpful? Give feedback.
All reactions
I already solve the problem. Is needed encoderOutStream.begin() always for each new WAV file.
Replies: 2 comments 1 reply
-
I already solve the problem. Is needed encoderOutStream.begin() always for each new WAV file.
Beta Was this translation helpful? Give feedback.
All reactions
-
.. as you can find in the documentation...
Beta Was this translation helpful? Give feedback.
All reactions
-
Yes. I found the solution in the documentation. Thanks
Beta Was this translation helpful? Give feedback.