Search code examples
linuxsoxlibsox

Combining fade function and convert to a flac file


I'm using linux trying to fade and convert an audio file to flac see command below

sox /tmp/audio1.wav /tmp/audio2.flac fade h 0:60 0 0:60

How can I add the flac option "-b 16" to the line above

thanks


Solution

  • The bits-per-sample option goes before the output file, i.e.:

    sox infile -b 16 outfile
    

    Are you sure you want the fade in/out over 60 seconds?

    As an illustration, here is a working example that fades in over .05 seconds at the beginning and end of a sweep:

    sox -n -d synth 1 sine 10k-1k fade h .05 0 gain -20
    

    Volume adjusted to avoid ear damage.

    You can visualize the signal with the spectrogram effect, e.g.:

    sox -n -d synth 1 sine 10k-1k fade h .05 0 gain -20 spectrogram -o specgram.png