Is it possible to change the pitch of a sound without changing its speed?
Is it possible to change the speed of a sound without changing its pitch?
Modifying sound
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Modifying sound
Short answer: no.
Long answer: LÖVE doesn't come with the audio processing library needed for that. See https://en.wikipedia.org/wiki/Audio_tim ... dification for what it requires. There may exist a multi-platform external library that does it but I'm not aware of it.
Edit: If you just want to pre-generate sounds and include them in your LÖVE file, Audacity and SoX do that.
Edit 2: Wait, SoX itself comes also as a library. Maybe you can look into using it with ffi. Here are the docs: http://sox.sourceforge.net/libsox.html
Long answer: LÖVE doesn't come with the audio processing library needed for that. See https://en.wikipedia.org/wiki/Audio_tim ... dification for what it requires. There may exist a multi-platform external library that does it but I'm not aware of it.
Edit: If you just want to pre-generate sounds and include them in your LÖVE file, Audacity and SoX do that.
Edit 2: Wait, SoX itself comes also as a library. Maybe you can look into using it with ffi. Here are the docs: http://sox.sourceforge.net/libsox.html
Last edited by pgimeno on Sat Sep 17, 2016 5:32 pm, edited 1 time in total.
- zorg
- Party member
- Posts: 3468
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Modifying sound
Medium sized answer: Depending on the file format you're using for audio, you might have an intermittent choice; if it's not a steam-like source, like mp3, ogg, wav or similar formats, but a notational kind, like MIDI or various tracker formats, it might be possible to manipulate only one of the speed/tempo or pitch values during playback.
To be fair, by default, löve processes such files as if they were streams too, so this option is not available... unless you edit the pitch or speed values within the files themselves, then reload them.
On the other hand, one could write an efficient FFI implementation of a player for such formats, and that way, it would be possible to alter playback state, even in realtime. (and for the record, i'm doing just this)
To be fair, by default, löve processes such files as if they were streams too, so this option is not available... unless you edit the pitch or speed values within the files themselves, then reload them.
On the other hand, one could write an efficient FFI implementation of a player for such formats, and that way, it would be possible to alter playback state, even in realtime. (and for the record, i'm doing just this)
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
-
- Citizen
- Posts: 87
- Joined: Tue Dec 30, 2014 6:07 pm
Re: Modifying sound
If you just need an altered sound and don't have to do it in real time with love you could just download Audacity to modify the sounds externally and maybe make a wrapper module to specify the speed/pitch to play out of preset files.
- georgeprosser
- Citizen
- Posts: 68
- Joined: Fri Mar 28, 2014 5:55 pm
Re: Modifying sound
I did exactly this for a recent music game.Skeletonxf wrote:If you just need an altered sound and don't have to do it in real time with love you could just download Audacity to modify the sounds externally and maybe make a wrapper module to specify the speed/pitch to play out of preset files.
Would it be possible to implement pitch/time shift using OpenAL? And is it even feasible to do this in real time?
Re: Modifying sound
I've done it in real time with SoX. See my 2nd edit above.
No, OpenAL doesn't have that kind of audio processing.
No, OpenAL doesn't have that kind of audio processing.
- zorg
- Party member
- Posts: 3468
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Modifying sound
One can write code to mess with audio data, and then pass that to OpenAL for playback, so that's not an issue, but i'm not sure whether it'd be possible to actually implement pitch/time shifting to work fast enough though.pgimeno wrote:No, OpenAL doesn't have that kind of audio processing.georgeprosser wrote:Would it be possible to implement pitch/time shift using OpenAL? And is it even feasible to do this in real time?
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Who is online
Users browsing this forum: No registered users and 2 guests