Important: Please read the Qt Code of Conduct -

New AudioEffect | processing pcm audio data

  • Hi

    I am looking for a way to add a custom audio effect in the media pipeline either Phonon or QtMultimedia.

    What I want to do is read from different files (wav, mp3, ogg, etc) and get pcm data that I can process and give it to some output.

    I can't figure it out how to read plain data to a QIODevice - probably there will not be much problem to play audio from there...

    Does have anyone have an advice or ideas?

    Sincerely yours forever,

  • Moderators

    QIODevice::read and QIODevice::write spring to mind.

  • Yes, the question is exactly about what to write in those methods! :)

  • [quote author="lebeg" date="1300177288"]Yes, the question is exactly about what to write in those methods! :) [/quote]

    Actually, it isn't. At least, those methods do you appear in your original question. Perhaps you should try to rephrase your question then, if it was really about QIODevice::read() and ::write()?

  • Ok, the question is not how to work with QIODevice - its about encoding audio pcm data. Is there a unified method to get pcm data INTO a QIODevice from any encoded file such as ogg or mp3?

  • You know what? Good question.

    I was digging through the Qt Phonon documentation a bit, and I could not find any reference on how to access the actual data stream. Even the documentation for the Effect class, which is what you are supposed to use if you want to manipulate the data, doesn't mention how to actually access that data. I fear you'll have to dig into the source code for Phonon/MediaNode and Phonon/Effect to find out more, or perhaps refer to the KDE documentation. That "documentation":, at least the section for backend developers, seems to tell you a bit more about the details of the involved classes. But I fear it will take digging into the sources to really find out how it works.

  • You can't access the raw data with phonon (at least the one in Qt), period. Investigate QtMultimedia.

  • Thank you for your fast answers!

    I know that with Phonon it is not a simple story - writing additional backends, adding them to common API etc... But Phonon can be used for playback, since it can read data from an QIODevice.

    QtMultimedia is much better to use and understand. Playback from an QIODevice can be done via QAudioOutput and all nice format classes such as QAudioFormat are present too. But there is still no chance to push pcm data to a QIODevice. A QMediaRecorder could do the encoding (probably?) but does not work with buffers either.

    I have started to implement an custom loader with plugins and stuff but then i realized that the best way to do that would be submit code directly to Qt - that would avoid using a bunch off unnecessary intermediate interfaces and make a simple audio effect program look really simple. Where should i start to Qt contribution?

  • If you want to contribute code to Qt, you make your own branch of the Qt git repository at That will allow you to do a merge request. Be prepared that, at least as long as the open governance is not in place, it can be a long and painful process. Perhaps best discuss your plans on IRC on #qt-labs first to see if there might be support for including your work at all, in order to prevent wasting loads of time.
    Also relevant are the "coding guidelines": if you want to contribute to Qt. If your contribution doesn't match those, you can be sure it will be rejected.

  • Ok, thank you!

  • Here's a relevant JIRA task:

    Andre above has posted a lot of the details on making a merge request etc. You'll need to clone the mobility repo:

    since that's where QtMultimedia currently lives (modularization of Qt and QtMobility will change this, but that isn't ready at the moment)

  • That's great! Thanks! It start to sound very promising to me!

Log in to reply