Important: Please read the Qt Code of Conduct -

How to record software generated audio ??

  • Dear all,
    I'm trying to encode and to save as AAC audio file a stream generated via software by my app.
    My first idea was to use the QMediaRecorder for that, but I cannot find a way to use it setting as audio input my generated stream. It seems that supports only hardware input devices :-S
    So, there is no way to use Qt Multimedia module to create apps for generating musics ??


  • Moderators

    take a look at QAudioInput and QAudioOutput classes

  • I did !
    But they are not useful for what I need to do.
    They are low-level access to the audio streams... but again, they allow to attach an hardware device to a software buffer... and they do not encode nothing.

    What I need is to encode an audio stream generated from me and not from an hardware device.

  • Moderators

    sure you can write a stream to a file using these classes. See "this example": in the docs. You just have to worry about the supported codecs.

    Alternatively "this": might also be interesting for you.

  • I'll take a look to the github project.

    And for what concern the example you posted... in the example the audio stream comes from the hardware device and it's not what I need.

    I'll try to explain in more details what I need:

    • there is a C++ method that generate an audio stream of data (RAW audio, suppose PCM 16bit unsigned)
    • I want to connect this stream of data to one of the multimedia classes for encode it into AAC and saving on the disk in MP4 format.

    From what I saw in the multimedia classes, the audio stream was always coming from an hardware device and not from a buffer or a QIODevice.
    So, I'm wondering what I miss.

    Another scenario similar to what I need:
    suppose you need to convert a file from AAC/MP4 to Vorbis/Ogg
    So, digging into the multimedia documentation there is the QAudioDecoder that allow you to load and decode the AAC/MP4 file ... but then ?!?!
    What multimedia class allow you to write the decoded audio into Vorbis/Ogg ?!?! QMediaRecorder ?!?! but how to connect to QAudioDecoder ?!?!

Log in to reply