sfxr.lua is a pure Lua port of the sfxr game sound generator. It still performs comparatively fast, though :P


This single-file library allows you to dynamically create retro sound effects based on parameters from your code. It also comes with a demo application as shown above based on Löve Frames.

Usage example (plays a random sound on every keypress):

local sfxr = require("sfxr")
function love.keypressed(key, rep)
    local sound = sfxr.newSound()

It supports all 7 preset generators for Pickup/Coin, Laser/Shoot, Explosion, Power-Up, Hit/Hurt, Jump and Blip/Select sounds and also both a randomizing and a mutating function. It also has all parameters from the original synthesizer, including basic envelopes, frequency slides, vibrato, change, square duty sweeping, phaser effect, low and high pass filters and sweep repeating.