====== Audio Conversions ====== ===== Split FLAC files ===== $ sudo apt install cuetools shntool flac $ shnsplit -f input.cue -t %n-%t -o flac output.flac ===== Convert from APE to FLAC ===== You'll need flac, bchunk and ffmpeg. If you run Debian or Ubuntu, just type $ sudo apt-get install flac ffmpeg The first step is to convert the whole .ape into .wav. $ ffmpeg -i input.ape output.wav And convert to flac. $ flac --best output.wav Then you split the .wav into individual tracks. $ shnsplit -f cuefile.cue -t %n-%t -o flac output.flac You can then remove the .ape, .cue and interim .wav files. ===== Down convert 24-bit FLAC to 16-bit FLAC ===== ==== Basic example - without resampling ==== $ ffmpeg -i input.flac -sample_fmt s16 -ar 44100 output.flac List sample formats: ffmpeg -sample_fmts List additional flac encoding options: ffmpeg -h encoder=flac ==== With resampling ==== FFmpeg supports two resamplers: the default swresample library, and the external SoX resampler (soxr). === aresample filter example === $ ffmpeg -i input.flac -af aresample=out_sample_fmt=s16:out_sample_rate=44100 output.flac Either example will result in the same output: you can verify with the hash muxer. Changing the dithering method See the -dither_method option for a list of available dithering methods and additional resampling options. Example: $ ffmpeg -i input.flac -dither_method triangular_hp -sample_fmt s16 -ar 44100 output.flac === The SoX resampler === To use soxr your ffmpeg must be compiled with --enable-libsoxr. Then choose it with the -resampler option: $ ffmpeg -i input.flac -resampler soxr -sample_fmt s16 -ar 44100 output.flac Or use the aresample filter to do it all: $ ffmpeg -i input.flac -af aresample=resampler=soxr:out_sample_fmt=s16:out_sample_rate=44100 output.flac