I want to use gstreamer library to work with sound in my c++ application. Can you tell me there are any ways to c开发者_Python百科hange sound tempo, pitch, etc?
Thanks.
With pitch plugin you can change sound pitch:
$ gst-launch filesrc location=sound.mp3
! decodebin ! audioconvert
! pitch pitch=3
! autoaudiosink
Or tempo:
$ gst-launch filesrc location=sound.mp3
! decodebin ! audioconvert
! pitch tempo=2
! autoaudiosink
Or rate.
Also there is huge LADSPA-library wrapper ladspa. I had some bad expirience with it, but maybe it is more stable now. It has several plugins to control pitch, tempo and much more.
This also may be of interest if you are planning to work with sound:
- nice plugin library audiofx with various filters, e.g. there is compressor/expander plugin audiodynamic.
- equalizer plugin.
Starting from max taldykin's suggestion, which returned an error in my version of GStreamer (0.10.35), I found a pipeline that does work. For example, to shift the song 1 step up maintaining the tempo, you should pitch 6%:
gst-launch-0.10 filesrc location=02-have_you_ever.mp3 ! \
decodebin ! audioconvert ! pitch pitch=1.06 tempo=1.0 ! \
audioconvert ! audioresample ! autoaudiosink
does the job for me.
精彩评论