Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt recorder messes up wav.header?
DRVDS last edited by
I am trying to record sound via the microphone with Qt but I have come across something really strange. Although my code is almost identicall to the one of the audiorecorder examplte provided in the Qt documentation, the file that is produced by the audiorecorder in my code has always an alleged length of of 13:31:35. How do I fix this problem?
Here is my code:
QAudioRecorder* audioRecorder = new QAudioRecorder;
if(record == false)
QAudioEncoderSettings audioSettings; audioSettings.setCodec("audio/pcm"); audioSettings.setSampleRate(44100); audioSettings.setBitRate(32000); audioSettings.setQuality(QMultimedia::EncodingQuality(16000)); audioSettings.setEncodingMode(QMultimedia::ConstantQualityEncoding); audioRecorder->setEncodingSettings(audioSettings,QVideoEncoderSettings(),"audio/x-wav"); audioRecorder->record(); record = true;