Combining fade function and convert to a flac file

185 Views Asked by At

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

2

There are 2 best solutions below

0
On BEST ANSWER

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
1
On

in case someone needs this the syntax it's

sox /tmp/infile.wav -b 16 /tmp/outfile.flac fade h 0:60 0 0:60

this will output a 16bit flac file with 60 second fade in and 60 second fade out