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

Colin McPhail colin.mcphail at mac.com
Thu Apr 26 16:53:48 BST 2018


Hi,

> On 26 Apr 2018, at 12:13, Alex Tu <alex_tu at gmx.de> wrote:
> 
> 
> 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.

What happens if you add      settings.setEncodingMode(QMultimedia.ConstantBitRateEncoding)
to your setup?

— Colin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180426/45c5e0f3/attachment.html>


More information about the PyQt mailing list