Important: Please read the Qt Code of Conduct -

AudioRecording Help

  • Hello,
    When creating a voice application under reconnaissace QtCreator I want to add two buttons, one for voice recording of a microphone and one for stop and the voice is automatically saved in a .wav file I would like to know the source code and the library used to achieve this.
    it's urgent

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    QAudioInput is your friend.

  • Thanx for reply
    I am a beginner in QtCreator, I want a complete function for recording if possible, in order to call this function by the button in the application.
    it's urgent please

  • @aminnov
    Here is one example.

  • Thanx for reply
    I found a function in this site, and I paste in my code but an error servenu: QAudioInput :: No such file or directory?
    I searched this problem but I have not solved.
    the code is :

    QFile outputFile;         // class member.
    QAudioInput *audioInput;  // class member.
    void startRecording()
        outputFile.setFileName("/tmp/test.raw"); QIODevice::WriteOnly | QIODevice::Truncate );
        QAudioFormat format;
        // set up the format you want, eg.
        QAudioDeviceInfo info = QAudioDeviceInfo::defaultInputDevice();
        if (!info.isFormatSupported(format)) {
            qWarning()<<"default format not supported try to use nearest";
            format = info.nearestFormat(format);
        audioInput = new QAudioInput(format, this);
        QTimer::singleShot(3000, this, SLOT(stopRecording()));
        // Records audio for 3000ms

  • Lifetime Qt Champion

    Because you are missing QT += multimedia in your .pro file.

    On a side note, asking on a community forum for someone to do the work for you because it's urgent for you isn't exactly professional. If you are in such a hurry then consider hiring someone with the expertise you need.

Log in to reply