Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved AudioRecording Help

    General and Desktop
    3
    6
    826
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • aminnov
      aminnov last edited by

      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
      Thanks

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi and welcome to devnet,

        QAudioInput is your friend.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        aminnov 1 Reply Last reply Reply Quote 0
        • aminnov
          aminnov @SGaist last edited by

          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

          Ratzz 1 Reply Last reply Reply Quote 0
          • Ratzz
            Ratzz @aminnov last edited by

            @aminnov
            Here is one example.

            --Alles ist gut.

            1 Reply Last reply Reply Quote 0
            • aminnov
              aminnov last edited by

              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");
                  outputFile.open( QIODevice::WriteOnly | QIODevice::Truncate );
                  QAudioFormat format;
                  // set up the format you want, eg.
                  format.setFrequency(8000);
                  format.setChannels(1);
                  format.setSampleSize(8);
                  format.setCodec("audio/pcm");
                  format.setByteOrder(QAudioFormat::LittleEndian);
                  format.setSampleType(QAudioFormat::UnSignedInt);
                  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()));
                  audioInput->start(&outputFile);
                  // Records audio for 3000ms
              }
              
              1 Reply Last reply Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                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.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post