[PyQt] QAudioRecorder settings not correct in recorded .wav file

Alex Tu alex_tu at gmx.de
Thu Apr 26 12:13:48 BST 2018


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)
         // recorder.setEncodingSettings(self.settings) # Tried this as 
well, but no luck here either

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 chunks of audio beforehand.

If anyone knows my problem or a solution, I'd be glad to hear it
Thanks in advance,
Alex


More information about the PyQt mailing list