kwnow frequency of songs with Love 2d

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
Flautarian
Prole
Posts: 2
Joined: Sun Aug 25, 2013 11:08 am

kwnow frequency of songs with Love 2d

Post by Flautarian »

Hi people , im new in the love 2d libraries and i have a project, i hope that i can develop with this engine.

The game that i want to do is a space invaders with the rytm of the music , for the music i need to know more information of them that i playing (frequency ,volume , tempo) , but i cant find any information in the original sound libraries of love2d.


I find a library named LuaFFT that do these things but i cant find example code for inicializate in the love2d engine, only that i found was little bit info in thi page but the code was not completed or compiles wrong.

Please , anybony have a little example of a love2d project with LuaFFT playing songs?


Sorry for my bad english :awesome:
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: kwnow frequency of songs with Love 2d

Post by raidho36 »

Well first thing to say is that it's really complicated matter.

You can obtain frequencies histogam via fourier transform on a limited timelapse frame. Figuring tempo is, on the other hand, is hard to the extent it's only possible with songs with very easily distinguishable volume peaks on beats. Basically, you figure tempo by obtaining histograms for a few seconds and then performing another fourier transform on them. The lowest frequency that match one another on multiple sound frequency bands is probably your tempo, which might be not. The easy part is volume, you simply obtain absolute value across certain number of samples and select the peak volume, that would be your volume for the samples span.
Flautarian
Prole
Posts: 2
Joined: Sun Aug 25, 2013 11:08 am

Re: kwnow frequency of songs with Love 2d

Post by Flautarian »

and for obtain a frequency of the second that te song is playing? , its complicated in love 2d? , they are an example implemented in love 2d? support large songs like videoclips ?




Thanks
User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: kwnow frequency of songs with Love 2d

Post by micha »

As raidho said, sound processing is not easy in any programming language.
I am pretty sure that in music based games (like guitar hero or sing star) such data is hard coded and not determined on the fly.
and for obtain a frequency of the second that te song is playing?
What exactly do you mean by frequency?
szensk
Party member
Posts: 155
Joined: Sat Jan 19, 2013 3:57 am

Re: kwnow frequency of songs with Love 2d

Post by szensk »

I've seen it done in shaders (WebGL warning) on the fly. Of course, I think getting the audio data as a shader input would be the issue.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: kwnow frequency of songs with Love 2d

Post by Jasoco »

Someone here, I forget who, recreated this in Löve a while ago, but I forget who and the search function won't find it by its original name...

User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: kwnow frequency of songs with Love 2d

Post by Boolsheet »

szensk wrote:I've seen it done in shaders (WebGL warning) on the fly.
The shader just displays the data it gets from the WebAudio browser API. Passing data to the shader is not a problem. Doing it efficiently is.

Just to avoid confusion: Oscillofun has the data for the visuals already encoded in the audio. The thing Jasoco mentioned loaded the whole track into memory with SoundData and worked with the data from there. This is ok for a proof of concept, but is unacceptable as a final product.

Audio rhythm games are probably very hard to pull of in LÖVE for several reasons. One issue is latency (be it play function call to an actual full buffer, or buffer to the speakers). Our ears and brain are very good at picking up tiny differences. Another issue is that you just can't access the stream from the Decoders and pass it back into the Source. Processing in Lua would be horribly slow anyway and LuaJIT can only go so fast.

You may need to rethink your approach so that you don't need to access to the audio data during the game. Another option is to modify LÖVE and add stuff like this, but I don't know if you want to go there.
Shallow indentations.
Post Reply

Who is online

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