Results 1 to 1 of 1

Thread: Audio Recording from microphone in Qt

  1. #1
    Join Date
    Jul 2011
    Location
    Paris
    Posts
    31
    Thanks
    5
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Audio Recording from microphone in Qt

    Hello, I am trying to do an application with the purpose of being able to record phrases and have them automatically saved in a chosen directory as wav files. For this I am trying to use the QAudioRecorder class. When I hit the record button I speak something into the microphone and .wav file gets saved into the directory that I chose with the name that I want but when I playback the file it is just noise. I don’t think I am using the recording class properly.

    What I have so far is :


    Qt Code:
    1. void RecordingWidget::startRecording()
    2. {
    3. if(audioRecorder->state() == QMediaRecorder::StoppedState)
    4. {
    5.  
    6. //Set Audio Input
    7. audioRecorder->setAudioInput(audioRecorder->defaultAudioInput());
    8.  
    9. // Sets Output location where to store the file
    10. if(!m_outputLocationSet)
    11. setOutputLocation();
    12.  
    13. // Set recording Settings
    14. QAudioEncoderSettings settings;
    15. settings.setCodec("audio/amr"); // Not sure what to put here
    16. settings.setSampleRate(16000);
    17. settings.setBitRate(32);
    18. settings.setQuality(QMultimedia::HighQuality);
    19. settings.setEncodingMode(QMultimedia::ConstantQualityEncoding);
    20.  
    21. audioRecorder->setEncodingSettings(settings);
    22. audioRecorder->record();
    23. }
    24.  
    25. else {
    26. stopRecording();
    27. }
    28. }
    To copy to clipboard, switch view to plain text mode 



    Any guidance on how to correctly set this up greatly appreciated! Thanks.
    Last edited by Sergex; 24th April 2013 at 11:51.

Similar Threads

  1. mp3 audio recording
    By dhe in forum Qt Programming
    Replies: 1
    Last Post: 26th August 2012, 11:00
  2. Audio Recording in qt
    By BalaQT in forum Qt Programming
    Replies: 8
    Last Post: 12th September 2009, 10:01
  3. Audio Recording with Phonon
    By Nemo in forum Qt Programming
    Replies: 4
    Last Post: 12th June 2008, 07:31
  4. recording and replaying
    By samirg in forum Qt Programming
    Replies: 1
    Last Post: 11th September 2007, 10:49
  5. Is there an audio *recording* facility in Qt?
    By johnny_sparx in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2006, 22:51

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.