melody-bay
melody-bay
Pure-Crystal WebAudio synthesis graph, musical sequencer, and MIDI/MOD/XM song importer for Garnet.
Features
- WebAudio Graph (
MelodyBay::AudioContext,MelodyBay::OfflineAudioContext):- Sources:
OscillatorNode(Sine, Square, Sawtooth, Triangle, customPeriodicWave),AudioBufferSourceNode,ConstantSourceNode,SoundDataSourceNode, and custom 128-sample quantumAudioWorkletNode/AudioWorkletProcessor. - Processing & Routing:
GainNode,BiquadFilterNode(all 8 types + frequency response),IIRFilterNode(with pole stability validation & frequency response),DelayNode(fractional interpolation + feedback-loop cycle support),DynamicsCompressorNode,WaveShaperNode(1x/2x/4x oversampling),ConvolverNode,StereoPannerNode,PannerNode+AudioListener(3D distance attenuation & directional cones),AnalyserNode(time/frequency domain FFT),ChannelSplitterNode, andChannelMergerNode. - Full
AudioParamtimeline automation (set_value_at_time,linear_ramp_to_value_at_time,exponential_ramp_to_value_at_time,set_target_at_time,set_value_curve_at_time,cancel_scheduled_values,cancel_and_hold_at_time) and audio-rate modulation inputs. - WebAudio channel upmix/downmix rules (
Max,ClampedMax,Explicit;Speakers,Discrete).
- Sources:
- Sequencer (
IndexedSequence,TimedSequence):- Tempo-mapped grid sequencing (
TempoMap) resolving to exact-timestampTimedSequenceplayback and offline rendering. - Graph, sample, and synth instruments with track-level parameter automation targets (
"gain","output.gain","gain#1", etc.).
- Tempo-mapped grid sequencing (
- Importers (
import_midi,import_mod,import_xm):- Standard MIDI File (format 0/1/2), ProTracker/multi-channel MOD, and FastTracker II XM importers producing
IndexedSequencewith structuredImportWarnings.
- Standard MIDI File (format 0/1/2), ProTracker/multi-channel MOD, and FastTracker II XM importers producing
- Garnet Audio Bridge:
- Seamless conversion between
MelodyBay::AudioBufferandGarnet::Audio::Sound, plus streaming 128-sample quantumAudioRendererandGarnetSoundSourceadapters.
- Seamless conversion between
Installation
Add to your shard.yml:
dependencies:
melody-bay:
github: garnet-engine/melody-bay
branch: main
Usage
require "melody-bay"
ctx = MelodyBay::OfflineAudioContext.new(2, 48_000, 48_000)
osc = ctx.create_oscillator
osc.waveform = MelodyBay::Waveform::Sine
osc.frequency.set_value(440.0_f32)
osc.start(0.0)
gain = ctx.create_gain
gain.gain.set_value_at_time(0.0_f32, 0.0)
gain.gain.linear_ramp_to_value_at_time(0.5_f32, 0.1)
ctx.connect(osc, gain)
ctx.connect(gain, ctx.destination)
sound = ctx.render_to_sound # => Garnet::Audio::Sound
Repository
melody-bay
Owner
Statistic
- 0
- 0
- 0
- 0
- 1
- about 1 hour ago
- December 4, 2026
License
MIT License
Links
Synced at
Fri, 04 Dec 2026 00:31:42 GMT
Languages