Skip to main content

Crate chiptunomatic

Crate chiptunomatic 

Source
Expand description

Procedural chiptune music from arbitrary bytes — same input yields the same audio. Core synthesis has no mandatory file or audio-device I/O so it builds for wasm32-unknown-unknown as well as native targets; [SongMetadata::from_path] is omitted on wasm32-unknown-unknown (browser) where std::fs metadata is unavailable—use [SongMetadata::from_string] there.

§WebAssembly

Use the chiptunomatic-wasm crate for wasm-bindgen bindings (incremental synth + metadata for JS). It depends on this library and is built with:

rustup target add wasm32-unknown-unknown
cargo build -p chiptunomatic-wasm --target wasm32-unknown-unknown
wasm-bindgen target/wasm32-unknown-unknown/release/chiptunomatic_wasm.wasm --out-dir pkg --target web

On wasm32, enable this crate’s js feature so getrandom is built with its js backend (the chiptunomatic-wasm crate does that). Without js, a wasm32 build must supply another getrandom backend. Use a JavaScript-capable host when js is on.

Modules§

constants
plugin
synth
Waveforms, envelope, and MIDI → Hz

Structs§

ArpeggioConfig
ArpeggioNoteReader
Wraps [SongNoteReader] and expands each SongNote::Melody into subdivisions shorter sub-notes cycling through the active chord tones. SongNote::Bass passes through unchanged.
BassNote
Note for the bass
Chiptunomatic
DrumPattern
16-step drum grid and seed bytes
DrumSampleGenerator
Generate drum samples from the steps
DrumStep
MelodyNote
Note for the melody
Mix
MixGenerator
Same per-sample peak-normalization behaviour as [IterMix], for feeding Sample values one-by-one from JS/workers.
MixSamples
Mix the incoming song and drum samples
RandomWrapper
ReadSongNotes
Yield one note at a time from a byte stream
Sample
Combine the song and drum samples
SampleDrumSteps
Iterator the sample the drum steps
SampleSongNotes
Iterator that samples the song notes
SongMetadata
Timing, key, BPM, chords, drum loop, etc. derived from a file seed.
SongNoteReader
Drives interleaved melody/bass generation from a growable byte stream (see [ByteBufferStream]).
SongSample
Single sample of the square, triangle, and voice stems
SongSampleGenerator
SquareNote
StemOutput
StemSample
Sample of an individual stem
Steps
Yield the steps of a drum pattern infinitely
Timing
TriangleNote

Enums§

ArpeggioPattern
ChiptunomaticError
ConvertWavError
GenerateError
SongMetadataFromPathError
SongNote

Traits§

Note
ReadSongNote
SampleStem

Type Aliases§

DrumSample