Qt World Summit: Submit your Presentation

How to do Audio Recording from microphone to wav file in Qt

  • hey anyone please tell me how to to audio recording from microphone to wav file in qt.
    i have already did it through qaudiorecorder but this is not suitable for mr.
    i want to do something in which i can set chunk size ,sample rate, bit rate ,format according to my need.
    or tell me how to convert .amr file in .wav file.

  • Hello,

    didn't you already create a Thread? "how to to Audio Recording from microphone to wav file in Qt":http://qt-project.org/forums/viewthread/39110/
    I am sure these guys were able to help you. It just doesn't always go that fast. Also your recording worked, you could play it in the WIndowsMediaCenter.

    Well, i'll still try to find a solution, give me a second for that.

    Based on the "AudioRecorder":http://qt-project.org/doc/qt-5.0/qtmultimedia/multimedia-audiorecorder.html class i found out that this should basically work:
    @audioRecorder = new QAudioRecorder;

    QAudioEncoderSettings audioSettings;


    In the "QAudioEncoderSettings":http://qt-project.org/doc/qt-5.0/qtmultimedia/qaudioencodersettings.html you can set all the necessary settings. To start recording i would create a signal in QML which emits when you want to start the recording, combined to a Cpp slot which executes this code:

  • i didnt get ant any solution till now.....
    actullay using QAudiorecorder i can create .wav file .....and iis working fine in media player....but when i added this file in matlab ..i am getting error invalid wavfile.........inavlid chunk size.....so please tell me how to set chunk size, sample rate, bit rate ...every thing that can work fine in matlab also...

    or if u have any solution how i can change .amr file to .wav file please tell me .....its urgent for me.....

  • Well it doesn't look like it is a Qt or Cpp problem. I have not worked with matlab yet so i might be wrong but maybe you have to set the correct chunksize and other necessary settings in matlab?

    bq. so please tell me how to set chunk size, sample rate, bit rate

    You'll find all the record-settings here: "QAudioEncoderSettings":http://qt-project.org/doc/qt-5.0/qtmultimedia/qaudioencodersettings.html

Log in to reply