QAudioFormat format; format.setSampleRate(44100);
QAudioFormat format; int sampleRate = 16000; format.setSampleRate(sampleRate);In this example, we again create an object of QAudioFormat named format, and set its sample rate to 16,000 Hz using the setSampleRate() function. Package/library: Qt Multimedia Module.