Trimming songs on a waveform with preset loop caps
Turning a favorite song hook or personal voice recording into a custom phone alert takes accurate start markers and clean loop boundaries. Building ringtones locally inside browser memory lets you trim songs into custom phone ringtones locally without sending music files to external servers.
Decoding audio tracks and enforcing 30s, 40s, and 5s caps
Drop any WAV, MP3, M4A, OGG, FLAC, AAC, or WebM track onto Drop an audio file here, or click Load sample ringtone clip to open the 8.0-second stereo chime (sample-ringtone.wav). Compressed audio decodes locally through the MDN BaseAudioContext decodeAudioData reference, while uncompressed RIFF WAV parses in JavaScript.
Clicking iPhone Ringtone (30s cap), Android Ringtone (40s cap), or Text / Alert Tone (5s cap) under Ringtone preset constrains selection length immediately (Auto-capped badge shown when trimmed). If your favorite melody sits inside a downloaded video clip, extract soundtracks from MP4 video clips before cutting.
Sliding 20 ms waveform markers and auditioning loops
Ringtone selection waveform renders 140 normalized bars scaled by (peak / max)^0.75 inside a 1,000-unit SVG canvas with a shaded window and vertical edge lines. You can type exact numbers into Start (s) and End (s) (0.1-second step) or drag the 20 ms-step range sliders.
clampWindow enforces a minimum 50 ms span and maintains the active duration limit whenever switching presets. Inside the preview card, the HTML5 <audio controls loop> player keeps Loop playback enabled active so you can verify repeating chorus seams immediately.
Why do peak normalization and raised-cosine fades smooth loops?
Quiet music intros produce weak phone speaker output, while sudden boundary cuts generate sharp electrical clicks as the loop restarts. Peak normalizing to -1 dBFS maximizes audibility without digital clipping, while raised-cosine edge fades guide both ends smoothly to zero amplitude.
Lifting quiet clips to -1 dBFS before edge fading
Inside everyday.worker.ts using the MDN Web Workers API guide, renderRingtoneClip copies [startIdx, endIdx) from decoded Float32Array channels. Checking Normalize peak to -1 dBFS measures peak amplitude across all channels and scales the selection uniformly to -1.0 dBFS (0.891 amplitude, clamped [-1, 1]).
Running normalization before edge fading maximizes body volume inside the hook without lifting boundary endpoints away from silence. When a live concert track or voice memo contains an unwanted middle verse or cough, use mid-track cough excision with crossfades before creating the ringtone.
Applying raised-cosine fade-in and fade-out envelope ramps
Fade in (ms) defaults to 300 ms and Fade out (ms) defaults to 500 ms, adjustable on sliders up to 3,000 ms or numeric boxes up to 5,000 ms. applyCosineFadesInPlace multiplies boundary samples by 0.5 * (1 - cos(pi * i / N)).
Unlike abrupt linear drops, the smooth S-shaped cosine curve hides boundary transitions between consecutive phone rings. Both ramps clamp automatically to half the trimmed ringtone length so short 5-second notification chimes never invert or distort.
Ringtone presets, length limits, and device format rules
Mobile operating systems enforce strict file extensions and length ceilings before displaying custom tones in system sound pickers. Apple devices expect MPEG-4 AAC audio streams matching the Library of Congress MPEG-4 AAC format specification inside .m4r MP4 containers for iOS syncing.
| Preset or control | Duration or range | Default setting | Target device behavior | Practical tuning advice |
|---|---|---|---|---|
| iPhone Ringtone (30s cap) | Up to 30 seconds |
Active default | Imports as .m4r AAC via Finder or GarageBand |
Trim 20–28 seconds around main chorus |
| Android Ringtone (40s cap) | Up to 40 seconds |
40 seconds cap |
Plays WAV or .m4a from Ringtones folder |
Captures full verse-to-chorus progressions |
| Text / Alert Tone (5s cap) | Up to 5 seconds |
5 seconds cap |
Fits short SMS and chat chime notifications | Keep 1–3 seconds with 50 ms fades |
| Fade in (ms) & Fade out (ms) | 0 to 5,000 ms |
300 ms / 500 ms |
Pulls loop boundaries smoothly to zero | Use 400 ms–700 ms tails on music loops |
| Normalize peak to -1 dBFS | Checked / Unchecked | Checked (On) | Sets loudest sample peak to -1.0 dBFS |
Leave checked for quiet acoustic tracks |
Comparing an iPhone 30-second .m4r loop against an Android 40-second .wav clip shows why room noise matters when boosting quiet phone recordings. Clean noisy voice memos with quiet microphone hiss before peak lifting so custom chimes stay clear.
Tip: Set Fade out (ms) between
400 msand700 mswhen cutting a30-second iPhone.m4rringtone; iOS inserts a brief pause between ringtone cycles, and a gentle cosine tail avoids abrupt cutoff clicks before silence.
Exporting iPhone .m4r, .m4a, and WAV ringtones locally
Clicking Create ringtone reveals the Ringtone ready badge, exact duration, sample rate, channel layout (Mono or Stereo), and output WAV size. Every exported file downloads straight from client memory with -ringtone appended to your source filename.
Encoding WebCodecs AAC .m4r versus universal WAV
When your browser supports the W3C WebCodecs specification AudioEncoder (mp4a.40.2 AAC at 128 kbps), Download iPhone .m4r and Download .m4a appear beside Download WAV ringtone. mp4-muxer packages AAC chunks into a fast-start MP4 container labeled audio/mp4.
On browsers where WebCodecs AAC encoding is unavailable (such as some Firefox or Linux builds), Download iPhone .m4r stays hidden while universal 16-bit PCM Download WAV ringtone works everywhere. Android reads WAV natively, and desktop Finder or GarageBand converts short WAV clips into .m4r cleanly.
Transferring custom .m4r files to iOS and Android
On macOS Finder or Windows Apple Devices, connect your iPhone over USB or Wi-Fi and drag your exported -ringtone.m4r file onto the device window to install it under Settings, Sounds & Haptics, Ringtone. Alternatively, share .m4r or .wav into iOS GarageBand to export locally on-device.
Android users copy -ringtone.wav or -ringtone.m4a directly into the phone’s Ringtones or Notifications storage folder and pick it in Sound settings. To update artist tags or album art on .m4a clips first, open them in Audio Metadata Editor.