Playing the raw file created by QAudioInput using windows media player? ["SOLVED"]



  • How do we play the file with ".raw" extension created when microphone audio is recorded by QAudioInput, using the windows media player? Basically what are the steps to convert the raw file to a format compatible to windows media player?


  • Moderators

    Hi,

    You can use a 3rd-party library like libsndfile to do the conversion. Google can show you other ways: http://www.google.com/search?q=convert+raw+to+wav

    Alternatively, you can use "QAudioRecorder":http://qt-project.org/doc/qt-5/qaudiorecorder.html to record directly into a .wav file, so you don't need to do any conversions.



  • @JKSH- Thank you very much for the reply. I am currently using Qt4.8.5 which doesn't have QAudioRecorder. I'll switch to Qt 5.0 and above, so that it makes my life easy :-)


  • Moderators

    You're welcome :)

    If you want to switch to Qt 5, this guide will help you: http://qt-project.org/doc/qt-5/portingguide.html

    I recommend Qt 5.2 -- it has many improvements over Qt 5.0.

    All the best with your project!



  • @JKSH - I am not switching to Qt 5.0 due to some constraints currently. However my goal finally is not to create a wav file but I just wanted to play the file using my windows media player. I currently managed to play the raw file but found out that my raw file contains only noise. It is not recording any audio from microphone.

    Could you please look at my other post on microphone issue and let me know whats the problem in my code?

    Regards,
    Jeevan


  • Moderators

    [quote author="jeevan_reddy" date="1391072733"]I just wanted to play the file using my windows media player. I currently managed to play the raw file but found out that my raw file contains only noise. It is not recording any audio from microphone.[/quote]It doesn't "contain noise". It contains raw PCM data.

    However, like I explained in your "other thread":http://qt-project.org/forums/viewthread/37736/, your raw file does not contain information about the audio format, so Windows Media Player cannot understand it.

    Windows Media Player doesn't know whether your file contains 8-bit or 16-bit audio. It doesn't know if your data represents integers or floats. It doesn't know if you have 1 channel or 2 channels. (and there are lots of other things it doesn't know)

    When Windows Media Player tried to guess the format, it guessed wrongly so your audio came out as noise.

    You can use Audacity to play raw PCM files, and save it in a format that Windows Media Player can understand. See my reply your other thread.



  • @JKSH - I haven't used windows media player to play raw file. My colleague copied the wave header content to the raw file and converted it to wav file. I believe there is genuimely problem with the content in my file. I feel QAudioInput is fails to read the audio content from my desktop's microphone.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.