#effect #sound #sfx

sfxr

Reimplementation of DrPetter's 'sfxr' sound effect generator

5 releases

Uses old Rust 2015

0.1.4 Oct 13, 2019
0.1.3 Mar 8, 2018
0.1.2 Feb 25, 2018
0.1.1 Feb 25, 2018
0.1.0 Feb 24, 2018

#817 in Audio

24 downloads per month
Used in 2 crates

MIT license

31KB
661 lines

sfxr-rs

Reimplementation of DrPetter's 'sfxr' sound effect generator.


lib.rs:

Reimplementation of DrPetter's "sfxr" sound effect generator.

This crate provides tools for creating quick placeholder sound effects. The effects are primarily intended to be used in quickly made games.

Sound effects are first defined as Sample values, which has many fields for tuning the properties of the resulting sound. A simple base Sample can be created with Sample::new, but other constructors for various purposes are provided for quick random Samples.

Next, a Generator is constructed to handle filling a sound buffer with data.

Examples

Generating a smooth sine wave into a buffer

let mut sample = Sample::new();
sample.wave_type = WaveType::Sine;
let generator = Generator::new(sample);
let buffer = [0.0; 44_100];
generator.generate(&mut buffer);

Generating a random explosion effect

let sample = Sample::explosion();
let generator = Generator::new(sample);
let buffer = [0.0; 44_100];
generator.generate(&mut buffer);

Dependencies

~390KB