Note that rate-shifting with sox -r <rate> will change the pitch and duration of the audio. To resample without audible changes, you should use the rateeffect, like so:
sox infile.wav outfile.wav rate -v 48k
-v gives the highest-quality resampling; see sox --help-effect rate for details on all the available options.
Also, it’s a teeny bit weird that you resampled with sox, but then used ffmpeg for concatenation. sox can concatenate just fine, and in fact if you want to concatenate-in a single resampled audio clip with a list of others already at the target rate, you can do that by using sox in a pipeline:
You always have to give the -t <type> of piped output streams, and sometimes of piped input streams as well. (It’s always safer to explicitly specify, just in case.) The above would make the resampled audio clip the middle of 3 concatenated files.
(But if you have to resample more than one audio clip, you’ll need to write the resampled clips to files, then use those in a sox --combine concatenate command. You can’t apply the rate effect in the middle of a pipeline, since having a 44.1k input file on the command line is incompatible with using --combine concatenate in that same command.)
Actually, you could avoid writing any of the resampled files to disk, by instead doing the concatenation in multiple steps, and writing the partial assembly to disk at the end of each step, to be picked up at the start of the next step. i.e.:
That’s what I intended to do (use sox to concat) - but got impatient and found the ffmpeg method on Stack Overflow or somewhere - and it worked - I don’t usually revisit stuff that worked - because the goal was to upload a single mp3 file to my phone, as a wake-up alarm - 'cause for the last 15 years or so - my ringtone has been “Misirlou” by Dick Dale and the Deltones (most people call it “that Pulp Fiction song” - but its actually an old old Greek love song about a Greek living in Egypt who falls in love with a Muslim girl - Dick Dale was of Lebanese descent) - and I couldn’t use that for my alarm 'cause I’d think it was work calling me in the wee hours…
Anyway - just hit another issue today. Got an ISO image of an Audio CD (not prepared to admit where or how I obtained it) that wouldn’t mount (e.g. mount -o loop file.iso /mnt/ISO).
Discovered it was created using SACD.
So - off to github - get the source and build it :
git clone https://github.com/Sound-Linux-More/sacd.git
cd sacd
make
sudo make install
then : sacd -p -s -i file.iso -o outie
And folder “outie” now has a WAV file for each track… Just gotta convert them to FLAC with ffmpeg…
'cause I’m lazy - I’ll probably just co-opt my quick and dirty “convert folder of
FLAC files to mp3 in a new folder” script…
That script I wrote to convert a folder of FLAC files to mp3 - didn’t work when I tried to change it to do “folder of WAV files to FLAC”… and script too complex for me to figure out so I gave up and just did this instead :
for F in *.wav ; do ffmpeg -i $F -compression_level 6 "${F%.*}".flac ; done