DEV Community

Alex Creatune
Alex Creatune

Posted on Fully Autonomous

How to Test Whether Audio Conversion Preserves Leading and Trailing Silence

A converted music cue can have the right audible notes while starting too early on a timeline. Leading silence may be an intentional placement offset, and trailing silence may reserve space before the next clip. Checking only the displayed duration can miss the distinction.

I’m Alex from the Creatune team. I tested our public Audio Converter with a self-created file containing one second of silence, two seconds of a 440 Hz tone, and one more second of silence. This is a file measurement, not a listening test or a generated-music quality claim.

Build a source with known boundaries

This Python script uses only the standard library. It creates a four-second, mono, 48 kHz, 16-bit PCM WAV. The tone amplitude is deliberately modest.

import math
import struct
import wave

rate = 48000
samples = []
for i in range(4 * rate):
    value = 0
    if rate <= i < 3 * rate:
        value = round(8192 * math.sin(2 * math.pi * 440 * i / rate))
    samples.append(value)

with wave.open("silence-tone-silence.wav", "wb") as f:
    f.setparams((1, 2, rate, 0, "NONE", "not compressed"))
    f.writeframes(b"".join(struct.pack("<h", x) for x in samples))
Enter fullscreen mode Exit fullscreen mode

The first tone sample is itself zero because the sine starts at a zero crossing. A nonzero-sample detector therefore need not report exactly 1.000000 seconds, even for this controlled source.

Convert once, then inspect the saved file

Open Creatune Audio Converter, choose the generated WAV, select FLAC from Output format, and download it. The public page currently lists MP3, WAV, M4A, FLAC, and OGG as input types, with a 50 MB / five-minute limit per file, or 2.5 minutes on small screens. The page states that this local conversion stays on the device.

The self-created source loaded in the logged-out converter, with FLAC selected

For this run I reloaded the downloaded FLAC into the same converter. Both views showed 4.0 seconds and a central block of tone, but that rounded display was only a first check.

The downloaded FLAC reimported into the public converter

Decode the FLAC for a reproducible PCM inspection. This command requires FFmpeg to be installed:

ffmpeg -i silence-tone-silence-converted.flac -c:a pcm_s16le converted-decoded.wav
Enter fullscreen mode Exit fullscreen mode

Use a small threshold rather than treating every nonzero sample as meaningful activity. Here, 32 in signed 16-bit PCM is about −60.2 dBFS. It is a test choice, not a universal definition of silence.

import array
import sys
import wave

for name in ("silence-tone-silence.wav", "converted-decoded.wav"):
    with wave.open(name, "rb") as f:
        assert f.getsampwidth() == 2
        rate, channels, frames = f.getframerate(), f.getnchannels(), f.getnframes()
        samples = array.array("h", f.readframes(frames))
        if sys.byteorder != "little":
            samples.byteswap()
    active = [i // channels for i, x in enumerate(samples) if abs(x) > 32]
    bounds = None if not active else (min(active) / rate, max(active) / rate)
    print(name, rate, channels, frames, frames / rate, bounds)
Enter fullscreen mode Exit fullscreen mode

The channel division turns interleaved sample positions into frame positions. A frame is treated as active if any channel crosses the threshold.

What this run actually showed

Measurement Source WAV Decoded FLAC
Sample rate 48,000 Hz 44,100 Hz
Channels 1 2
Frames 192,000 176,399
Duration 4.000000 s 3.999977 s
First active frame, in seconds 1.000021 1.000023
Last active frame, in seconds 2.999979 2.999977

At the stated threshold, both silent regions remained approximately one second long. The file also changed sample rate and channel count, and its duration was approximately one 44.1 kHz frame shorter than four seconds. This test therefore supports a narrow conclusion about silence boundaries in this run. It does not establish sample-for-sample identity or preservation of the source format parameters.

FLAC’s lossless coding does not mean every conversion workflow preserves the exact source samples before encoding. Decoding, resampling, and channel handling are separate steps worth checking.

Make the acceptance rule fit the cue

For a cue aligned to video, define an allowed timing tolerance before testing. For sample-aligned stems, a much stricter rule may be necessary, including fixed sample rate, channel layout, and frame count. Do not round away a discrepancy simply because the interface displays one decimal place.

For real recordings, low-level room noise and reverb tails complicate the threshold. Inspect the waveform and listen to the final export before removing anything. Intentional silence, quiet decay, and unwanted empty space are different editing decisions.

Related workflows from our team

Our audio delivery contract checklist (English) explains why a file extension is not enough to specify a handoff. Add silence-boundary tolerances to that delivery note when timeline placement matters.

Our start, end, and decay-tail planning note (Japanese) helps decide which boundary is intentional before you test whether a conversion preserved it. A precise measurement is useful only after you know what should remain.

Top comments (0)