for anyone using QtMultimedia QAudioInput with python’s wave module to write PCM data to a wave file: to convert between QAudioFormat’s sampleSize() number and wave’s sample width number, divide by 8, e.g:

wave_file_to_write.setsampwidth(audio_format.sampleSize() / 8)

QAudioFormat’s sampleRate() number works as it is.

updated: