Changing sound speed

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Ovidios
Prole
Posts: 29
Joined: Thu Dec 04, 2014 12:00 pm
Location: Berlin, Germay

Changing sound speed

Post by Ovidios »

Hey,

I wanted to know if there was a way to change the speed at wich a sound plays without making the sound sound brighter or darker. And is it possible to play a sound lighter but at the same speed?
Hope I'll get answers soon!

Thanks in advance!
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Changing sound speed

Post by zorg »

You mean without it sounding higher or lower in pitch? no, love can't do time stretching, only setting the pitch with [wiki]Source:setPitch[/wiki], which will also affect the playback speed.
Me and my stuff :3True 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.
User avatar
undef
Party member
Posts: 438
Joined: Mon Jun 10, 2013 3:09 pm
Location: Berlin
Contact:

Re: Changing sound speed

Post by undef »

If the sound you want to play is rather short, or if you don't have to compute the sound over and over again, you could copy certain samples of your source into a new one.
(Create a new source from samples with love.audio.newSource.)
I don't yet know how to stretch a sound, but it could be something like using the same samples multiple times and then increasing the pitch? (I have no idea if this would work^^)

Well, please let me know how you did it when you found the solution!

If you will have to dig in deeper, and maybe apply fourier transformations there's a book I can recommend, that I have partially read:

http://www.dspguide.com/ch1.htm
twitter | steam | indieDB

Check out quadrant on Steam!
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 200 guests