How Beat Slicing Works: Transient Detection, Spectral Flux, and Sample Chopping for Producers
Every drum hit, note attack, and rhythmic event in an audio file announces itself with a sudden spike in energy. That spike is a transient. Beat slicing is the process of finding those transients automatically and cutting the audio at each one so that each individual hit becomes its own sample file. The technique dates back to hardware like the Akai MPC and software like ReCycle, but the underlying math has not changed: locate the onset, cut the buffer, export the pieces.
This tool does that entirely inside your browser. No audio is uploaded to any server. The spectral flux algorithm runs in JavaScript using a radix-2 FFT on overlapping frames, the same method used by research-grade onset detectors described in Bello et al. (2005) "A Tutorial on Onset Detection in Music Signals" (Journal of IEEE Signal Processing). You get the same detection quality used in professional DAW plugins, without needing Ableton, Logic, or any installed software.
What the Sensitivity Slider Actually Controls
The sensitivity slider sets the threshold multiplier used in peak-picking. After computing the spectral flux curve, the algorithm calculates a rolling mean and standard deviation over a 20-frame window at each point. A point is marked as an onset only if its flux value exceeds the mean plus (sensitivity × standard deviation).
At a sensitivity of 1.5, which is the default, a frame needs to be 1.5 standard deviations above the local average to qualify as a transient. That catches the clear snare hits and kick drums in a standard drum loop without triggering on the bleed between hits. At 0.5, the threshold drops and the slicer finds softer events like ghost notes and quiet hi-hat openings. At 3.0 or higher, only the loudest, sharpest transients pass, which is useful for slicing a mix where the full arrangement is playing and you only want the four-on-the-floor kicks.
The minimum slice length setting prevents two onsets from being placed so close together that one slice is shorter than the threshold you specify. On a dense breakbeat at 170 BPM, the slicer might detect 20 onsets in one bar. If the minimum slice is set to 100 ms and several of those onsets are only 40 ms apart, the closer ones are merged into the previous slice. This is the right behavior for building a clean sample kit where every file has enough content to be musically useful.
The Spectral Flux Algorithm: Step by Step
Spectral flux is computed by comparing the magnitude spectrum of consecutive audio frames. Here is what happens when you click Detect and Slice:
- Mono mix for analysis: The stereo (or multichannel) audio buffer is averaged to mono. This prevents a transient that appears only in one channel from being missed or double-counted. The stereo buffer is preserved separately for the actual export.
- Overlapping frames: The mono data is split into 1024-sample frames with a 512-sample hop (50% overlap). At 44,100 Hz, each frame is about 23 ms long and each hop is about 11.6 ms.
- Hann windowing: Each frame is multiplied by a Hann window before the FFT. This reduces spectral leakage at the frame boundaries, which would otherwise create false flux peaks.
- Radix-2 FFT: A Cooley-Tukey in-place FFT converts each windowed frame from the time domain to the frequency domain.
- Magnitude spectrum: The complex FFT output is converted to a magnitude spectrum by computing the square root of the sum of squares of the real and imaginary parts for each frequency bin.
- Positive difference sum: Spectral flux for each frame is the sum of all positive differences between the current frame's magnitude spectrum and the previous frame's. Negative differences (energy decreases) are discarded because transients are characterized by sudden energy increases, not decreases.
- Peak picking with dynamic threshold: A frame is an onset if it is a local maximum in the flux curve and its value exceeds the dynamic threshold (rolling mean + sensitivity × rolling standard deviation).
The result is a list of sample positions, one for each detected onset. The original stereo buffer is sliced at those positions. Slice zero always starts at sample 0, and the last slice runs to the end of the file.
Fixed Grid Mode vs. Transient Mode
Transient detection works well for drum loops with clear hits. For material where the transients are ambiguous or where you want perfectly uniform chops regardless of the content, fixed grid mode is the better choice.
Fixed grid mode ignores the spectral flux algorithm entirely. You set a BPM value, and the tool calculates the number of samples per beat (sample rate × 60 / BPM) and places an onset at each beat boundary throughout the file. A 4-bar loop at 90 BPM recorded at 44,100 Hz gets an onset every 29,400 samples, giving you 16 equal chops.
This is the standard approach for chopped-and-screwed productions, where the goal is uniform 1-bar or 1-beat segments that can be rearranged or time-stretched independently. It is also useful when slicing a sample pack that was recorded to a click track, because every slice will land exactly on the beat grid rather than at the nearest transient. Use the Key and BPM Finder to detect the BPM of your loop before switching to grid mode.
Fade Per Slice and Normalization
Cutting an audio buffer at an arbitrary sample position rarely lands on a zero crossing. When the signal value at the cut point is not zero, there is an instantaneous discontinuity at the start or end of the slice. That discontinuity shows up as a click or pop when the slice is triggered in a sampler.
The fade in/out control applies a linear gain ramp over the specified number of milliseconds at the start and end of each slice. A 5 ms fade takes about 220 samples at 44,100 Hz. The gain goes from 0 to 1 at the start and from 1 to 0 at the end over those samples. That is short enough that it does not audibly affect the attack of a drum hit but long enough to prevent any click artifact at the boundary. For slices with sharp transient attacks you want to preserve, keep the fade at 1 to 3 ms. For melodic material where the exact start point is less critical, 10 to 20 ms is fine.
The normalize option scales each slice so that its peak sample value reaches 0 dBFS (or just below, at 0.99). This is useful when chopping a drum recording where the kick hits at -3 dBFS and the hi-hats are at -18 dBFS. Without normalization, when you load the slices into a sampler and map them across a keyboard or pad layout, the hits will have wildly different volumes. Normalizing before export means every slice starts at the same peak level, and you can then apply velocity scaling in the sampler to add dynamics back in a controlled way.
Note that normalizing a slice with no sustained content (a short click or bleed artifact) can amplify that artifact to 0 dBFS. If the normalized output sounds wrong for a particular slice, turn normalization off and re-export, or just delete that slice from the kit in your sampler.
Practical Workflows: What to Do with Your Slices
Building a sample kit from a drum loop: Load a royalty-free drum loop, set sensitivity to 1.5 and minimum slice to 80 ms, and click Detect. Each drum hit becomes a separate WAV file. Import the ZIP into an MPC, Maschine, or any sampler with a "load folder" feature. You now have a custom drum kit built from a single loop. The individual slices track differently from the original loop, which is the point.
Re-slicing for a DAW arrangement: Import each slice as a separate clip in your DAW (Ableton Live, FL Studio, Logic Pro). Because each slice starts at a transient, they snap cleanly to the beat grid. Rearrange, reverse, pitch-shift, or time-stretch individual slices to build new patterns from old material.
Chopped vocal phrases: Upload a vocal sample and use a higher sensitivity (2.5 to 3.0) so the slicer only catches the syllable onsets rather than the subtle pitch changes within a sustained vowel. Each word or syllable lands in its own file. Load them into a sampler and re-sequence them for a vocal chop effect common in house, UK garage, and neo-soul production.
After exporting your slices, the Audio Trimmer lets you fine-tune the start and end points of any individual slice. The Pitch Shifter lets you transpose any slice to a target key before building your kit. And the LUFS Loudness Meter gives you integrated loudness readings if you need to match slice levels to a specific target rather than peak-normalizing.
Why WAV Export and ZIP Bundling
Each slice is exported as a 16-bit PCM WAV file. WAV is the standard format for samples in every piece of hardware and software used in music production. Every sampler, MPC, drum machine, DAW, and plugin accepts WAV without any conversion step. MP3 or OGG exports would introduce compression artifacts at the start and end of each slice, which is audible when slices are triggered repeatedly at fast tempos.
The ZIP bundling uses the JSZip library with STORE compression (no compression, just container). Audio data does not compress meaningfully with general-purpose algorithms because it is already pseudo-random at the sample level. Using STORE means the ZIP generates instantly rather than spending CPU cycles trying to compress incompressible data.
Files are named sequentially: slice_01.wav, slice_02.wav, and so on. The numbering preserves the original chronological order of the slices, which is important when importing into samplers that sort by filename. When you drag the entire ZIP contents into Ableton's Drum Rack or Native Instruments Battery, the pads load in the correct order.
Supported Audio Formats and Limitations
The tool decodes audio using the browser's native Web Audio API, which supports WAV, MP3, OGG Vorbis, FLAC, and AAC in all major browsers. The stereo or mono content of the input file is preserved in every exported slice: a stereo input produces stereo WAV slices, and a mono input produces mono WAV slices.
There is no hard file size limit, but files above 100 MB may take several seconds to decode and analyze in the browser depending on your device's CPU speed. For very long files (full DJ sets, live recordings), it is more practical to use the Audio Trimmer to isolate the section you want to chop before running it through the slicer.
The spectral flux algorithm performs analysis on the CPU in the main JavaScript thread. For files longer than about 5 minutes at 44,100 Hz, detection may take 2 to 4 seconds. The UI shows a "Detecting..." state during this time. All audio processing is private: nothing is sent to any external server.