Important: Please read the Qt Code of Conduct -

QAudioInput example : bad values with unsigned integers

  • Hello.

    I am currently working with the Qt multimedia module and I am facing a strange behavior with the audio input example.

    When I set the audio format sample type to unsigned int, I get strange values with the sound level :

    • almost always "65535" with unsigned 16-bit integers
    • almost always "129" with unsigned 8-bit integers

    Everything is normal when I set audio format sample type to signed int.

    Does anyone faces the same issue ?

    Kind regards

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You should add which version of Qt you are using as well as OS. Also, did you check that the format you are trying to use is supported by your sound card/driver ?

  • Hi.

    Thank you for your reply.

    Of course I forgot the basis.
    I'm using Qt 5.4 for Windows 7.

    According to Qt the format I use is supported (QAudioDeviceInfo:: isFormatSupported returns true).

    By the way does it really change the bits I receive from my microphone ?


    PS : I just realize I need 16 bit signed (not unsigned) PCM data for my 3rd party library, and I realize I spent hours for nothing :-)

  • Lifetime Qt Champion

    Your microphone will send the same noise, it's how it's represented that will change however, you don't always get what you request on windows.

Log in to reply