NEON DJ generates all its built-in music programmatically — no audio samples are loaded from disk. A suite of low-level synthesis functions creates each instrument sound by schedulingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/kepabilbao67-bot/musicplayer2/llms.txt
Use this file to discover all available pages before exploring further.
OscillatorNode, noise buffers, BiquadFilterNode, and GainNode objects with precise time-based envelopes. Every function accepts an AudioContext (either a live AudioContext or an OfflineAudioContext) and a destination node, making them usable both during offline track rendering and in real-time FX playback.
Utility
makeNoise
AudioBuffer of the given duration by filling a single-channel buffer with uniformly distributed random samples in the range [−1, 1].
The audio context used to allocate the buffer. The buffer’s sample rate matches
ctx.sampleRate.Duration of the noise buffer in seconds. Drum functions typically pass
1.5 to have enough noise for any scheduled burst.AudioBuffer. The same noise buffer is shared across all percussion voices in a single generateTrack() render.
Percussion Functions
synthKick
OscillatorNode with a steep pitch envelope and a gain envelope.
The rendering context.
Destination node (typically the track’s master gain or an offline context destination).
Start time in seconds (
ctx.currentTime-relative for live playback, or absolute step offset for offline rendering).synthSnare
The rendering context.
Pre-allocated white noise buffer (from
makeNoise).Destination node.
Start time in seconds.
dest independently.
synthClap
The rendering context.
Pre-allocated white noise buffer.
Destination node.
Start time of the first burst. Subsequent bursts are scheduled at
t + 0.012 and t + 0.024.synthHat
open parameter controls whether the hat is open (long decay) or closed (short decay).
The rendering context.
Pre-allocated white noise buffer.
Destination node.
Start time in seconds.
true for open hi-hat (0.28 s decay), false for closed hi-hat (0.045 s decay).t + dur + 0.02 to allow a clean tail without early cutoff clicks.
Melodic Functions
synthBass
The rendering context.
Destination node.
Start time in seconds.
Fundamental frequency in Hz. Typically derived from
midiToFreq(midiNote).Note duration in seconds. The gain envelope reaches peak at
t + 0.012 then decays to near-zero at t + dur.t + dur + 0.03.
synthLead
The rendering context.
Destination node.
Start time in seconds.
Frequency in Hz.
Note duration in seconds.
Oscillator waveform type:
"sine", "square", "sawtooth", or "triangle". Different genres use different types — synthwave arpeggios use "square", house pads use "sawtooth".Peak gain value. Typical range 0.05–0.12 when layering chords; higher for solo leads.
t + 0.01). The note decays from vol to near-zero at t + dur.
synthChord
WaveShaperNode and a lowpass filter.
The rendering context.
Destination node.
Start time in seconds.
MIDI note number of the chord root. The three voices are
rootMidi, rootMidi + 7 (perfect fifth), and rootMidi + 12 (octave).Chord duration in seconds.
Peak output gain after distortion and filtering.
Distortion drive amount fed into
makeDistCurve(k). Higher values produce heavier saturation. Rock Spanish uses 16, Heavy Metal uses 26.GainNode (pre, gain 0.3) → WaveShaperNode (soft-clip curve, oversample "2x") → BiquadFilterNode (lowpass, 3200 Hz) → output gain envelope.
synthWobble
The rendering context.
Destination node.
Start time in seconds.
Fundamental frequency in Hz.
Note duration in seconds.
LFO oscillation rate in Hz. The dubstep genre uses 5 Hz on beat 1 and 8 Hz on beat 3 for rhythmic variety.
freq * 1.005) for a thick chorus effect. The lowpass filter sits at 600 Hz with Q = 9. The LFO depth is ±450 Hz, producing a dramatic cutoff sweep. Total node lifetime: t + dur + 0.03.
FX One-Shot Functions
FX functions trigger sounds in real time through the liveAudioContext and master output. They do not accept time parameters — they fire immediately at ctx.currentTime.
fxRiser
fxAirhorn
fxImpact
fxZap
Master FX Functions
flangerThrow
masterFlangerWet.gain:
- 0 → 0.85 over 0.1 s (instant throw)
- Holds at 0.85 until
t + 2.6 s - 0.85 → 0 over the next 0.7 s (total duration: 3.3 s)
cancelScheduledValues before the new ramp is set.
echoThrow
masterEchoWet.gain:
- 0 → 0.6 over 0.05 s
- Holds at 0.6 until
t + 2.0 s - 0.6 → 0 over the next 0.6 s (total duration: 2.6 s)
brakeAll
brake() on any deck that is currently playing. Each deck’s brake() method ramps source.playbackRate from its current value down to 0.001 over 0.7 s using linearRampToValueAtTime, then stops the source after 730 ms and leaves the deck paused at the braked position. This is the “tape stop” or vinyl brake effect.
All synth functions use
exponentialRampToValueAtTime for gain envelopes rather than linearRampToValueAtTime. Exponential ramps sound perceptually smoother because human hearing perceives loudness on a logarithmic scale. The setValueAtTime call immediately before each ramp is required — Web Audio will ignore an exponential ramp if there is no preceding scheduled value for the parameter.