SOX audio tool Quick Reference Guide: Difference between revisions

From www.ReeltoReel.nl Wiki
Jump to navigation Jump to search
Line 36: Line 36:
Trim digital silence from start and end.
Trim digital silence from start and end.
  sox input.wav trimmed/output.wav silence 1 0.1 0 1 0.1 0
  sox input.wav trimmed/output.wav silence 1 0.1 0 1 0.1 0
 
-
  sox infile outfile gain -n
  sox infile outfile gain -n
normalises to 0dB, and
normalises to 0dB, and

Revision as of 11:25, 27 November 2022

Generate 1 second of white noise.

sox -n output.wav synth 1 noise

Generate a 1-second sine tone.

sox -n output.wav synth 1 sine 440

Generate a 10-second sine sweep.

sox -n output.wav synth 10 sine 0:20000

Exponential sine sweep

sox -n -r 44100 sine-sweep.wav synth 10 sine 5/22050

play

Play synthesized audio.

play -n synth sine 440 trim 0 1 gain -12

modify

Reduce level by 12dB

sox speech.wav output.wav gain -12

Crop to the first 1 second of the file.

sox speech.wav output.wav trim 0 1

Reverse the contents.

sox speech.wav output.wav reverse

Normalise the contents to 0dBFS.

sox speech.wav output.wav norm

Equaliser (-6dB @ 100Hz, -24dB @ 8000Hz)

sox speech.wav output.wav bass -6 100 treble -24 8000

Add room modelling reverb.

sox speech.wav output.wav reverb 50 50 100

Trim digital silence from start and end.

sox input.wav trimmed/output.wav silence 1 0.1 0 1 0.1 0

-

sox infile outfile gain -n

normalises to 0dB, and

sox infile outfile gain -n -3

normalises to -3dB.

effects

chorus effect: A typical delay is around 40ms to 60ms; the modulation speed is best near 0.25Hz and the modulation depth around 2ms. For example, a single delay:

play guitar1.wav chorus 0.7 0.9 55 0.4 0.25 2 -t

Two delays of the original samples:

play guitar1.wav chorus 0.6 0.9 50 0.4 0.25 2 -t  60 0.32 0.4 1.3 -s

A fuller sounding chorus (with three additional delays):

play guitar1.wav chorus 0.5 0.9 50 0.4 0.25 2 -t 60 0.32 0.4 2.3 -t 40 0.3 0.3 1.3 -s

compand

The following example might be used to make a piece of music with both quiet and loud passages suitable for listening to in a noisy environment such as a moving vehicle:

sox asz.wav asz-car.wav compand 0.3,1 6:-70,-60,-20 -5 -90 0.2

The transfer function (`6:-70,...') says that very soft sounds (below -70dB) will remain unchanged. This will stop the compander from boosting the volume on `silent' passages such as between movements.

However, sounds in the range -60dB to 0dB (maximum volume) will be boosted so that the 60dB dynamic range of the original music will be compressed 3-to-1 into a 20dB range, which is wide enough to enjoy the music but narrow enough to get around the road noise.

The `6:' selects 6dB soft-knee compand-ing. The -5 (dB) output gain is needed to avoid clipping (the number is inexact, and was derived by experimentation).

The -90 (dB) for the initial volume will work fine for a clip that starts with near silence, and the delay of 0.2 (seconds) has the effect of causing the compander to react a bit more quickly to sudden volume changes.