Qt Forum

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

    Qt recorder messes up wav.header?

    General and Desktop
    1
    1
    717
    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.
    • D
      DRVDS last edited by

      Hello,

      I am trying to record sound via the microphone with Qt but I have come across something really strange. Although my code is almost identicall to the one of the audiorecorder examplte provided in the Qt documentation, the file that is produced by the audiorecorder in my code has always an alleged length of of 13:31:35. How do I fix this problem?

      Here is my code:

      @void MainWindow::on_pushButtonrecord_clicked()
      {

      QAudioRecorder* audioRecorder = new QAudioRecorder;
      if(record == false)
      {
      audioRecorder->setAudioInput(audioRecorder->audioInput());
      audioRecorder->setOutputLocation(QUrl::fromLocalFile("test.wav"));

      QAudioEncoderSettings audioSettings;
      audioSettings.setCodec("audio/pcm");
      audioSettings.setSampleRate(44100);
      audioSettings.setBitRate(32000);
      audioSettings.setQuality(QMultimedia::EncodingQuality(16000));
      audioSettings.setEncodingMode(QMultimedia::ConstantQualityEncoding);
      
      audioRecorder->setEncodingSettings(audioSettings,QVideoEncoderSettings(),"audio/x-wav");
      
      audioRecorder->record();
      record = true;
      

      }
      else
      {
      audioRecorder->stop();
      }
      }@

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