Important: Please read the Qt Code of Conduct -

Audio Editing

  • I’m new to QT Development and so far enjoying it very much. I have already tried building some basic. I want to build an app that will play an audio file, and i want to remove/edit some parts of that audio.

    For example, if its a 1 minute song, i could press a button to start cutting from 15 second and then press it to stop on 30 second and then press to start cutting on 50 second and stop on 5 seond, which means i get final edited audio file of 15+5 = 20 seconds.

    For now, i used a MediaPlayer QML component to play an embeded file which is working fine. So how should i proceed with getting access to binary audio data and then remove some parts of it.

    Please advise how can I approach it?

  • Lifetime Qt Champion


    Editing of files is currently outside of QtMultimedia's scope. You'd need to use another framework besides Qt for that.

    You might want to check on other open source audio application to see what framework they use for that kind of work.

  • Lifetime Qt Champion

  • Re: Audio Editing

    Please bear me for a moment, QTmultimedia framework can play the audio, which means it has access to raw audio data (bytearray). all i have to do is create a new array that includes the data from indexes which i want in final sound.

    Can this "theory" be implemened without relying on other third party library?


  • Lifetime Qt Champion

    @scotryder said in Audio Editing:

    Can this "theory" be implemened without relying on other third party library?

    I think simple cutting should be easily done the way you described it.

    You may even be able to perform other audio transformations without third party libraries - as long as you know how to implement the needed algorithms ;)

  • all i want to do is simply cut and merge, thats it.
    if u guys can guide me how to achieve that, i'd greatly appreciate.

  • @scotryder Scot, I know a little about Audio, and I know if you do what you suggest, you will end up with a broken waveform, which may lead to nasty artifacts in your Audio.0_1518439369038_58ccb3b8-e467-4ab5-b104-0d1d28e2b92a.png

  • @scotryder simple editing of audio file may be simple only if you are dealing with headerless file that contains uncompressed audio data, in all other cases you'll have to first parse the file, then decode it to get access to the audio samples, and only after that you can do editing. Also, when you finished with editing you will probably want to encode resulting audio with the same codec (or different one if you prefer) before saving it back to the disk.

    Also, the fact that 'QMediaPlayer' can play some audio file doesn't necessary means that it has access to audio samples, there can be quite a few libraries "between" high level library ('Qt Multimedia' in this case) and library that does actual audio decoding. It's even possible to have audio playback where none of the libraries involved have access to audio samples, not even the audio driver itself (in the case of hardware decoding).

    Depending on what audio file formats/codecs your app should support you may end up with using multiple third party libraries and not just one.

Log in to reply