Over the last weeks I worked on a port of the awesome sfxr sound generator to pure Lua. My goal was to allow easy dynamical creation of sound effects based on in-game events. Think about infinite, completely procedurally generated games.
The source is on GitHub: http://github.com/nucular/sfxrlua
Here's some code since people love examples:
Code: Select all
local sfxr = require("sfxr")
function love.load()
local sound = sfxr.newSound()
sound:randomize()
sound:play() -- generates a SoundData and plays it
end
- Editable documentation wiki at http://github.com/nucular/sfxrlua/wiki
- Output samples of a Sound instance can be generated using an iterator
- All 7 preset generators are implemented
- Demo application based on LoveFrames that resembles the original
- Export to the RIFF WAV format
- Saving and loading of the binary format used by vanilla sfxr
- Embedding into the love-loader framework or other kinds of threaded sound generation
The entire thing is a work in progress, that means sudden crashes and wild API changes may happen.
Known issues can be found here: http://github.com/nucular/sfxrlua/issues
Pull requests are always welcome!
You can check out the original sfxr here: http://www.drpetter.se/project_sfxr.html
Also, here's a little introduction to it: https://www.youtube.com/watch?v=Sgah1W4y6Zs
The attached demo application may not be up-to-date with the version on the repo.