Solved [PyQT] QAudioRecorder settings not correct in recorded .wav file
-
Hey everyone,
I'm using the QAudioRecorder to record some audio to do some speech recognition.
The sample rate of the output should be 16kHz.
My settings look like this:settings = QAudioEncoderSettings() settings.setCodec(self.supportedAudioCodecs()[0]) settings.setBitRate(32000) settings.setSampleRate(16000) settings.setChannelCount(1) settings.setQuality(QMultimedia.VeryHighQuality) recorder.setAudioSettings(settings)
if I print out the settings, it shows the correct values.
But checking the recorded .wav file with Audacity, the sample rate is always 96kHz and the bitrate is 192k instead of the 32k.
Currently I'm downsampling the .wav file before sending it to the speech recognizer but I want to implement a streaming mode as well, where it's not possible to downsample the piecesof audio beforehand.If anyone knows a solution to my problem, I'd be glad to hear it :)
Thanks in advance, -
@axelfowlie Maybe it's because you use QMultimedia.VeryHighQuality?
-
@jsulm said in [PyQT] QAudioRecorder settings not correct in recorded .wav file:
@axelfowlie Maybe it's because you use QMultimedia.VeryHighQuality?
Oh my god. I feel so stupid. This kind of went over my head.
I removed the quality setting and set the encodingMode to ConstantBitrateEncoding,
now it's working as intended.
Big thank you!