Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt recorder messes up wav.header?

Qt recorder messes up wav.header?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 777 Views
  • 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 Offline
    D Offline
    DRVDS
    wrote on last edited by
    #1

    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
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved