Page 1 of 2

wave - a sound manager with audio parsing and rhythm functionalities

Posted: Thu May 05, 2016 4:00 pm
by Ulydev
Hello everyone!

I've been wanting to make an audio library for a long time.

Here's wave, an audio manager that lets you parse your source and even add rhythm-based mechanics in your game.


Code: Select all

local audio = require "wave"

function love.load()
  music = audio
    :newSource("music.wav", "stream")
    :setBPM(120)
    :onBeat(function() print("Boom!") end)
    :play()
end

function love.update(dt)
  music:update(dt)
end
Thanks to everyone who helped me out with beat detection! :awesome:

https://github.com/Ulydev/wave

This demo contains 4 examples using the library. Press space to switch between them.
The last example shows the beat detection feature used in wave. It's very experimental, so it might not work all the time.

Re: wave - a sound manager with audio parsing and rhythm functionalities

Posted: Thu May 05, 2016 6:13 pm
by whitebear
That is most amazing thing! Take my money!

Re: wave - a sound manager with audio parsing and rhythm functionalities

Posted: Thu May 05, 2016 7:00 pm
by Sulunia
The middle circle is reacting to an FFT calculation or is beat-counting based?

Re: wave - a sound manager with audio parsing and rhythm functionalities

Posted: Thu May 05, 2016 7:20 pm
by Tesselode
Woah, this looks really nice! I was working on my own dynamic music library, but I guess I won't need it anymore!

Re: wave - a sound manager with audio parsing and rhythm functionalities

Posted: Thu May 05, 2016 7:59 pm
by zorg
Sulunia wrote:The middle circle is reacting to an FFT calculation or is beat-counting based?
Neither, i looked at the source, it's basically a beat counting implementation, but it does query the sounddata every few "chunks" for one sample data, and uses that to give back amplitude data. Not that precise, but it works. (oh, and it doesn't create new sounddata objects if your source is already static, so that's good :3)

Re: wave - a sound manager with audio parsing and rhythm functionalities

Posted: Thu May 05, 2016 9:03 pm
by alberto_lara
Awesome!

Re: wave - a sound manager with audio parsing and rhythm functionalities

Posted: Fri May 06, 2016 2:38 pm
by undef
Nice!

Re: wave - a sound manager with audio parsing and rhythm functionalities

Posted: Fri May 06, 2016 6:21 pm
by qubodup
Cool beans! I heard the music before, was it in a game of yours (can't find a link..)?

Re: wave - a sound manager with audio parsing and rhythm functionalities

Posted: Wed May 18, 2016 5:28 pm
by Ulydev
Thank you guys for the feedback!

Code: Select all

-Fixed (set/get)TargetPitch, (set/get)TargetVolume
I've been trying to add a music:setOffset(milliseconds) method to offset beat detection, but I can't seem to make it work (doing "self.time + self.offset" breaks the beat when looping). Can someone please help me with this?

Re: wave - a sound manager with audio parsing and rhythm functionalities

Posted: Wed May 18, 2016 6:21 pm
by Sulunia
Ulydev wrote: Can someone please help me with this?
Imma look into your source code. If you're generating a list of times where a song will beat then you'll most likely have to update the entire list with such offset. :o:

@edit:
You calculate this in realtime. It makes it a bit harder, but i guess it's faster that way. I'm not really good with metamethods/metatables, so bear with me here. The problem is when the song ends and loops back to the beggining, or the next beat with the offset? :monocle: