On 6/6/24 23:42, Jan Stary wrote:
The header <speex/speex_types.h>, included in speexdsp.c,
in not even installed by speexdsp; this file is installed
by speex, and is irrelevant to the speexdsp effect.

In fact
      speexenc audio.wav audio.spx
      sox audio.spx audio2.wav
says
      sox FAIL formats: no handler for file extension `spx'

That has nothing to do with the above.

The speex _format_, as in https://speex.org/,
is not supported by SoX at all.

That surprises me.

That can only surprise you if you haven't read soxformat(7),
I see no mention of speex but a zillion other rare formats and I thought one objective of sox was supposed to be to convert files that we have in strange formats to something we can use. Stamping out speex format won't stamp out people who happen to have or receive files in speex format.

or just not yet like M4A?

m4a _was_ kinda supported at one point, via calling ffmpeg.
That is long gone, thank god.

Again, m4a files exist and are common, so are you saying that sox should not be able to read them? Idem WMA format, so at present people need a range of tools, sox and ffmpeg and sndfile-* (or sox -t sndfile) to be able to read different formats, which seems the opposite of what sox was supposed to do, but it looks like our views differ on this point.

I tried to use sox to process a large archive of recordings and ended up with:

filetype="$(filetype "$audiofile")"
    case "$filetype" in
    WAV)
        # Many tracks clip as recorded but they have no musical
        # information above 15175Hz so apply a brick-wall
        # low-pass filter to them, immensely improving the sound.
        if wavclips "$audiofile"
        then
            sox -V1 "$audiofile" -t wav - vol 0.8 sinc -15k > $wavtmp
            wavin="$wavtmp"
        else
            wavin="$audiofile"
        fi
        ;;
    FLAC|OGG|MP3|WMA)
        case "$filetype" in
        FLAC)
            flac -s -d -o "$wavtmp" -f "$audiofile" ;;
        OGG)
            oggdec -Q -o "$wavtmp" "$audiofile" ;;
        MP3)
            mpg123 --no-control -q -w "$wavtmp" "$audiofile" ;;
        WMA)
            # If in the background, it always stops when overwriting a file
            rm -f "$wavtmp"
            ffmpeg -v fatal -i "$audiofile" "$wavtmp" ;;
        *)
            echo "Internal error decoding $audiofile" 1>&2
            return ;;
        esac
        if wavclips "$wavtmp"
        then
            sox -V1 "$wavtmp" "$wavtmp2" vol 0.8 sinc -15k
            mv "$wavtmp2" "$wavtmp"
        fi
        wavin="$wavtmp"
        ;;
    *)
        echo "Unknown format to decode in $audiofile" 1>&2
        return
        ;;
    esac

where "filetype" is

# Figure out what type of audio is in a file,
# regardless of its filename extension
filetype() {
    local audiofile fileout type
    audiofile="$1"

    # Don't rely on filename extensions because there are MP3s in
    # files named *.midi *.aiff and *.wav
    fileout="$(file "$audiofile")"
    type=
    case "$fileout" in
    *WAVE*)                                     echo "WAV" ;;
    *MPEG*|*"Audio file with ID3"*|*": data")   echo "MP3" ;;
    *ASF*)                                      echo "WMA" ;;
    *FLAC*)                                     echo "FLAC" ;;
    *"Ogg data, Vorbis audio"*)                 echo "OGG" ;;
    esac
    echo "$type"
}

and that's without the M4A runes yet. Sox disapponted me here.

    M

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel

Reply via email to