Page 1 of 1

Speed up .mp3 music in love

Posted: Wed Aug 02, 2017 2:30 am
by harrison
I need to somehow tell my background music to speed up during execution. Is there a way to tell the engine to "play this .mp3 file at 1.34 times speed"?

If I can't figure this out I will have to reprogram my game with a different game engine :death:


relevant thread from 2014 where people said it was impossible (unresolved):
https://love2d.org/forums/viewtopic.php?t=78131

Re: Speed up .mp3 music in love

Posted: Wed Aug 02, 2017 3:36 am
by raidho36
You just set pitch to higher value. That's it.

Try browsing the manual. That's a sure way to know all relevant features.

Re: Speed up .mp3 music in love

Posted: Wed Aug 02, 2017 4:05 am
by harrison
But if I set the pitch to be higher, it will make my music all squeaky, won't it? Sorry if I have an incorrect understanding of pitch, I don't know much about music.

Re: Speed up .mp3 music in love

Posted: Wed Aug 02, 2017 4:29 am
by raidho36
Well yeah if you increase pitch both playback speed and frequency increase. It's impossible to make it play faster or slower without both pitch change and audible glitches, it's either one or the other.

Re: Speed up .mp3 music in love

Posted: Wed Aug 02, 2017 5:49 am
by Santos
I think what you're looking for is time stretching. LOVE doesn't do this currently unfortunately. :( I wonder if it's possible or likely in the future? Maybe one of the devs could say.

Re: Speed up .mp3 music in love

Posted: Wed Aug 02, 2017 7:39 am
by zorg
Santos wrote: Wed Aug 02, 2017 5:49 am I think what you're looking for is time stretching. LOVE doesn't do this currently unfortunately. :( I wonder if it's possible or likely in the future? Maybe one of the devs could say.
I'm not a dev but i'll say that it's highly unlikely for it to ever be supported. (as someting inbuilt)

Also good luck finding a game engine that does this kind of thing, without external plugins; this is hard to code.

That said, it's possible to implement even with löve (0.11 that is), since the time domain, or the frame-based approach from the above wikipedia article may be fast enough and not too demanding for it to run at acceptable speeds.