Re: synth seems to generate "pops"?

Jan Stary <[email protected]> Tue, 25 Mar 2025 16:29:15 +0100
Newsgroups gmane.comp.audio.sox
Message-ID <[email protected]>
On Mar 25 11:58:15, [email protected] wrote:
> I'm thinking of using sox's synth capability to make myself a simple
> hearing tester.  It will play a bunch of tones at various frequencies,
> channels and volumes and record my response, or not.

What version of SoX is it?

> After a bit of reading I have figured that something like this:
> play -r 44100 -n -t alsa synth 0.5 sin 5000 vol -25dB remix 1 0
> wrapped into a script with the frequency, gain and remix parameters
> replaced with variables will work exactly as I had hoped.

Why do you need the 44100 sample rate?
Why are you only using half a second of sound?

> Except - when I listen to the generated sounds there is a small pop, or
> crack, at the start and end of each sound.

I suspect being off the zero crossings:
Half a second of a 5 kHz sine wave at 44100
will not result in a full, finished period of the wave.
You will have "jumps" at the seams.

play -n synth 10 sin 440 gain -3 dcshift 0.5

> The obvious answer is that this pop/crack comes from ALSA,
> or my DAC or my headphones.

I don't how that's obvious,
but I cannot replicate the pops and cracks with my SoX.

> The only thing that makes me think that it is sox is that the
> "vol" given to "synth" changes the volume of the pop/crack.  If I do, for
> example:
> play -r 44100 -n -t alsa synth 0.5 sin 5000 vol -100dB remix 1 1
> I get nothing but silence.
 
At -100 dB,there is no audible sound,
so this is not an example of anything.

> I'm taking this as sox being able to open my
> sound hardware and play the very quiet sound with no pop/crack?

With the line above, you are effectively playing silence.
There are no pops and cracks in silence.

> I've seen discussion on similar topics where duration of the tone is
> manipulated to ensure it aligns with write buffers.  I suspect that's the
> problem I am seeing

Mee too.

play -r 48000 -n synth 10 sin 480

	Jan