Important: Please read the Qt Code of Conduct -

Playing audio file at different pitches. Phonon? Qt Multimedia?

  • Hi

    I'm working on an app that play sounds (from audio files, let's say wav) at different pitches than the original pitch of the audio file. I did my test app on Mathematica and now that the concept is alright I want to make a stand alone app with Qt.
    For the GUI etc Qt covers everything I need but I have been seeking for a good solution to play files at different pitches and I don't seem to find it. Phonon seems a good and easy solution but I would have to find an effect for pitch shifting, which doesn't seem to be easy. I checked my windows 7 laptop with the phonon capabilities app and no pitch shifting effect appears. Besides, I need this app to be portable so I'm not sure if I depend on the backend of the computer where I install my software. If no pitch shifting effect, no app working fine.
    On the other hand Qt offers QT Multimedia with QSound etc. I haven't found a way of changing the pitch of the audio file neither. Any advice on Phonon vs QTMultimedia as well as on where to find pitch shifting effect for windows would be much appreciated.
    Thank you very much in advance.
    Best reagds

  • The Qt developers recommend QtMultimediaKit (which afaik is part of the mobility api) over Phonon (see also "here": However I personally think it would be easier to realize with Phonon. For that I'd have a look over at "KDE's Phonon website": where Phonon is being maintained.

  • Thanks for your reply!

    I'll have a look to the links you mention. Still, either with Phonon or Qt Multimedia, I can't solve my main problem, I need to play sounds at different pitches of the original pitch of the given audio file.

    I've been exploring different possibilities for this. I report here just in case somebody is interested.
    Here is a list of C++ libraries and utilities for audio playing and processing. I'm still trying to figure out which one is the best that suit my needs.

    C++ audio libraries:


    There are others but maybe too complete (real time processing, synthesis, etc etc) for what I'm trying to do (just play a file at different pitches). I wouldn't want to link my app to a huge library just to use a very small part of it.

  • According to the Phonon::Effect documentation:
    [quote] An effect is a special object which can perform transformations on the specified path. Examples may include simple modifiers such as fading or pitch shifting, or more complex mathematical transformations. [/quote]

  • Hi, again thanks for your reply.

    The thing is that it doesn't come with an effect, you must look for one in your system. Me, I don't have it and don't know e¡ther where to find a suitable effect for use with Phonon. It must also be in any computer willing to run the app, so this makes the portability very weak.

  • You're right. I didn't see a built in effect either. As you mentioned there are sound processing libraries you could use (which would probably be easiest) or you'd have to write a Phonon effect yourself (keep in mind though, that Phonon itself is a library you have to link against)

  • Without the backend capabilities, you could probably go the way it would be done for Music IR. Get the raw data and apply your mathematical transformation on it. Although, this was experimental in Phonon when I tried it about 6 months ago. Hopefully its stable now.

    In Phonon::AudioDataOutput, there is a signal dataReady, from which you can get the raw data.

    Once you get the raw data, you can use any library to do the transformation. You could insert the AudioDataOutput in between your source and sink. I'm not sure, this will solve all your problems, because you will still need to send the modified data to the sink. But, maybe you can figure something out.

  • Hi,

    It looks like I'll have to work it the way you mention abov (jim_kaiser)e. Get the raw data, transofrm with external library and try to put it back in data that Phonon understands. Or maybe if I have to use an external library I could do all the job inside it, meaning, reading the audio file, transformation of pitch with constant duration and then playback using the particular external library capabilities.
    I'll report back if I make it work in any of this two ways.
    Thank you all for your interest and replies.

Log in to reply