Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: SoX - Sound eXchange latest version (Windows) (Read 1040 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

SoX - Sound eXchange latest version (Windows)

Hello, can anyone provide me with the latest sox audio utility with latest FLAC version + all other audio processing tools needed like MP3, AAC etc ? I want to resample FLAC 2.0 192/96khz to FLAC 2.0 48khz for further encoding in opus using opusenc. I know ffmpeg does all the job. But I read on this https://linuxmusicians.com/viewtopic.php?t=26649 and on other sites saying sox do well in this.

SoX command I found -: sox -SG "input.flac" -b 24 -r 48000 "output.flac"

ffmpeg command -: ffmpeg -i "input.flac" -ar 48000 -af aresample=resampler=soxr -c:a flac -compression_level 12 "output.flac"

opusenc command -: opusenc --bitrate 192 --music "input.flac" "output.opus"

I'm basically downloading music FLAC files from Tidal, Qobuz etc than encoding them in Opus for storage purpose. opusenc works well only with 44.1/48khz input files as I read on internet.

Can anyone help me with this ?

Re: SoX - Sound eXchange latest version (Windows)

Reply #1
rem Place ffmpeg in your system PATH
rem Save as batch and change your audio files path
set src="z:\src"
set out="z:\out"
for %%I in (%src%\*.flac) do ffmpeg -y -i "%%I" -resampler 1 -osr 48000 -ochl FL+FR -c:a libopus -b:a 512k "%out%\%%~nI.opus"

https://www.animmouse.com/p/ffmpeg-binaries/

Re: SoX - Sound eXchange latest version (Windows)

Reply #2
Is the issue real, that opusenc does a bad job downsampling higher resolution? Sure I have seen the claim, accompanied by spectrograms where the artefacts look obvious - at some inaudible level like way beyond the 20th bit. I guess that's what you get when creating spectrograms in 32-bit integer.

Letting SoX guard against clipping on a per-track basis, might get you in trouble. Imagine if track 5 has to be attenuated 3 dB more than track 6. Then play them in track order. Unfortunately, SoX does not understand floating-point (it is 33 years old!), and so it needs this protection against clipping - but most lossy codecs don't. (Sure maybe during playback, but not upon encoding.)

Re: SoX - Sound eXchange latest version (Windows)

Reply #3
THANK YOU FOR YOUR REPLY  :) @ha7pro . Can you explain it to me ? As i see you are not using standard ffmpeg commands -resampler 1 -osr 48000 -ochl FL+FR.

I used ChatGPT for usual ffmpeg command, this is what I got -:
ffmpeg -i "input.flac" -ar 48000 -ac 2 -c:a libopus -b:a 192k -vbr on "output.opus"

From ffmpeg docs it says it uses 'swr' resampler as default. There is also 'soxr' but don't know how to use it.
Also can you tell me why not use SoX instead of ffmpeg ?


Re: SoX - Sound eXchange latest version (Windows)

Reply #4
 -resampler 1 == sox

 

Re: SoX - Sound eXchange latest version (Windows)

Reply #5
I'm using following command for Opus encoding when FLAC 2.0 is in 24-bit 192/96 khz -:
ffmpeg -i "input.flac" -ar 48000 -af aresample=resampler=soxr -c:a libopus -b:a 192k -vbr on "output.opus"

When FLAC 2.0 is already in 16-bit 44.1/48 khz I'm using following command for Opus encoding-:
opusenc --bitrate 192 --music "input.flac" "output.opus"

What are your thoughts ? Is there anything else to be added or remove ?