Cutting a few seconds off a recording sounds like the simplest edit there is. Yet a trimmed clip often comes back slightly wrong: a click at the cut, a tiny silence at the start, a loop that stutters, or a file that sounds a little worse than the original. None of these come from the cut itself. They come from how compressed formats such as MP3 store sound, and from re-encoding. This article explains what happens, with numbers, and how the audio trimmer avoids it by exporting WAV.
WAV is a list of samples, MP3 is a list of frames
A WAV file is almost nothing but samples: one number per channel, tens of thousands of times a second, after a 44-byte header. At 44.1 kHz stereo and 16 bits, every second is 44,100 × 2 channels × 2 bytes = 176,400 bytes. You can cut a WAV between any two samples, and the result is exactly the length you chose. Nothing is decoded or re-encoded, so nothing changes.
An MP3 is a sequence of frames. In MPEG-1 Layer III, the usual MP3, each frame describes 1,152 samples (the LAME project's technical FAQ gives 1,152 for MPEG-1 and 576 for MPEG-2). At 44.1 kHz that is 1,152 ÷ 44,100 = 26.12 ms per frame; at 48 kHz, exactly 24 ms. A tool that cuts an MP3 without decoding it can only cut at frame boundaries, so the start and end snap to a 26 ms grid. And because of the "bit reservoir", a frame may store part of its data in the frames before it, so the first frame after a lossless cut can be undecodable and some players skip or mute it.
Encoder delay and padding: why the clip starts late
When an MP3 is made, the encoder and decoder filter banks each add a delay. The LAME FAQ describes a decoder delay of 528 samples and LAME's default encoder delay of 576. Together that is 1,104 samples (often quoted as 1,105), or about 25 ms of silence at 44.1 kHz, in front of the real sound. At the end, the encoder pads the audio up to a whole frame. Take 30 seconds at 44.1 kHz: 1,323,000 samples, plus the 576-sample delay, is 1,323,576, which is 1,148.94 frames. The last frame is filled up, so at least 72 samples of padding follow, and encoders usually add a flush frame on top.
LAME writes the exact delay and padding into a tag in the first frame, and players that read it remove both, which is what "gapless playback" means. Players that ignore the tag play the extra silence. That is why a ringtone or a loop made from a trimmed MP3 can start a beat late or have a gap each time it repeats.
Re-encoding: the generation loss
When a trimming tool decodes an MP3, cuts the samples and encodes a new MP3, the sound goes through a lossy encoder a second time. The second encoder cannot know what the first one already threw away; it simply removes more. With high bitrates the difference is usually small for one pass, but it adds up with every edit, and the new file gets a fresh encoder delay and padding as well.
Exporting WAV avoids all of it. The trimmer decodes the file once, cuts at the exact sample, and writes the samples as they are. Your MP3's original loss is still there, of course: WAV cannot bring back what MP3 removed, but it does not remove anything more.
The sample rate trap in browsers
Browsers decode audio to the sample rate of the audio context, and MDN's documentation of decodeAudioData states that the decoded buffer is resampled to the context's rate. A tool that decodes a 44.1 kHz file in a 48 kHz context silently resamples it. The audio trimmer reads the rate from the file header (WAV, MP3, FLAC, Ogg) and decodes at that rate, so 44.1 kHz stays 44.1 kHz. For formats whose header it cannot read, such as M4A, it uses 48 kHz and tells you the rate it used.
A worked example
You have a three-minute podcast intro as a 192 kbit/s MP3 and want the 30 seconds from 1:10.000 to 1:40.000, fading out over the last 2 seconds.
- The MP3 is 192,000 ÷ 8 × 180 = 4,320,000 bytes (4.3 MB).
- The cut is 30 s × 44,100 = 1,323,000 frames per channel.
- As 16-bit stereo WAV it is 1,323,000 × 4 + 44 = 5,292,044 bytes (5.3 MB). The tool shows this before you save.
- The fade out covers the last 2 × 44,100 = 88,200 frames. With the equal-power curve the gain halfway through is sin(45°) = 0.707, which is −3 dB; a linear fade is at 0.5, or −6 dB, so it sounds like it drops away sooner.
- The file starts at sample 3,087,000 exactly (70 × 44,100) and has no extra silence at either end.
A full three minutes as WAV would be 44,100 × 4 × 180 + 44 = 31,752,044 bytes, about seven times the MP3. That is the price of a lossless format, and why WAV is the right format for editing and archiving rather than for sending a long recording over chat.
Common mistakes
- Saving a trimmed clip as MP3 again and again. Every encode loses a little more. Keep a WAV as your working copy and make an MP3 only at the end.
- Cutting in the middle of a sound. If the waveform is not at zero at the cut, the speaker jumps and you hear a click. A 10 ms fade (441 samples at 44.1 kHz) removes it, or move the cut to a quiet spot.
- Using a long linear fade on music. It sounds like the music disappears too early; equal power keeps the perceived loudness smoother.
- Expecting a perfect loop from an MP3. Encoder delay and padding put silence at both ends unless the player honours the gapless tag. Loop WAV.
- Choosing 24-bit "for quality" from an MP3 source. The source has less resolution than 16 bits already gives; 24-bit only makes sense for recordings that will be edited further.
- Letting a tool resample silently. Check that the sample rate of the result matches the original.
Trimming in the browser
Open the audio trimmer, choose the file and drag the start and end handles, or type the times to the millisecond. Add short fades at the edges, play the selection and download the WAV. If you still need the recording, the voice recorder records your microphone in the browser and can save WAV too.