Professional Crossfader
A completely new UI component that sits between the two decks, allowing you to mix audio channels smoothly.
Under the Hood:
State Management:
The crossfader position is a number between -1 (Left/Deck A) and 1 (Right/Deck B). Linear Mixing Algorithm: We use a linear interpolation formula. Deck A Volume = max(0, 1 - (position + 1) / 2) Deck B Volume = max(0, (position + 1) / 2) This ensures that at the center (0), both tracks are at equal volume, and dragging to one side smoothly silences the other.
"Real" Waveform Visualization Replaced the generic animation with a scientifically accurate waveform generated from the actual audio file you drop in.
Under the Hood:
Web Audio API:
When you drop an MP3, we use AudioContext.decodeAudioData() to read the raw PCM (Pulse Code Modulation) data—the actual digital values of the sound. Downsampling: A 5-minute song has millions of data points. Rendering all of them would crash the browser. We "downsample" this chunk of data into ~1000 representative peaks (using a Root Mean Square calculation) to make rendering instant and smooth.
Canvas Rendering: We use the HTML5 element instead of standard DOM elements . This allows us to draw the waveform lines at 60 frames per second without performance lag.
Automatic BPM Detection
An intelligent algorithm that analyzes the song structure to guess the tempo (Beats Per Minute) automatically.
Under the Hood:
Low-Pass Filter:
Before analyzing, we run the audio through a digital Low-Pass Filter (cutoff at 150Hz). This removes vocals and melodies, leaving only the "thump" of the kick drum and bassline.
Peak Detection:
The code runs through the filtered audio looking for volume spikes (beats).
Interval Analysis:
It measures the time distance (in milliseconds) between every spike. Example: If it consistently finds peaks 500ms apart, it calculates: 60,000ms / 500ms = 120 beats per minute.
Confidence Scoring:
If the intervals are messy and random, the "Confidence Score" drops. If they are perfectly regular, it rises. We only display the BPM if the algorithm is reasonably confident.

Log in or sign up for Devpost to join the conversation.