Announcement

Collapse
No announcement yet.

Any automated way to tell of an MP3 track is compressed

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • MainSqueeze
    replied
    I've never used SoX's "compand" effect myself but, looking at your code examples above, I'd suggest you ignore the -G and -v options and instead increase the compand attenuation itself until SoX no longer reports clipping: you've set it at -4 at the moment; try something like -12 instead to see if that reduces the number of clipped samples.

    You may also want to Google "sox compand effect clipping" (including the quotation marks); it brings up a fair number of results, e.g. the first reply in this 1-page thread or the first five posts in this similarly short thread.

    Incidentally, last year, when someone on Audio Science Review claimed that SoX was no longer being updated, one of its contributors, Mans Rullgard, who I gather is also among the top contributors to FFmpeg, had this to say: "Is there some bug you're hoping to get fixed, or are you just addicted to updates?"​ He has a wonderful way with words, and I'm sure he'd be happy to sort you out.
    Last edited by MainSqueeze; 2023-03-05, 14:47.

    Leave a comment:


  • pfarrell
    replied
    Originally posted by cliveb
    come to think of it, shouldn't a compressor always REDUCE peak levels prior to applying makeup gain? In which case why would it ever create clipping?
    Good question. sox is cool, but hasn't had any updates in a decade. There are many bugs reported, some which I ran into. Some could be trivially and quickly fixed in the HTML source. I guess the authors have moved on.

    Yeah, I ran a small selection of files with various -v from .98 down to .90 and had very little impact on the number of WARN messages.
    And the --norm and -G are supposed to fix it as well.

    The sox script finished after about 24 hours. Maybe a bit more.


    Leave a comment:


  • cliveb
    replied
    Originally posted by pfarrell
    sox is constantly warning that it has "clipped" a few thousand points in most files.
    I tried adjusting the prameter, and added three paramters that were suggested would lower the number

    -v 0.98 is supposed to lower all of the volume/gain by 98%
    I've never used the -v option, but the man page says it's a "linear" adjustment. Which suggests to me that -v 0.98 sets the volume to 98%. And of course that's a very small decrease (about 0.17dB) and won't deal with any induced clipping.

    Edit: come to think of it, shouldn't a compressor always REDUCE peak levels prior to applying makeup gain? In which case why would it ever create clipping?
    Last edited by cliveb; 2023-03-04, 23:39.

    Leave a comment:


  • pfarrell
    replied
    I have a script running sox to apply the "compand" process. Its been running for about 24 hours. I have no way to know how far its along. I guess it might be half done.
    The script looks like
    sox -V2 -v 0.98 --norm -G "/home/.../mp3/.../Angel of the South.mp3" "/home/.../mp6/.../Angel of the South.mp3" compand 0.3,1 6:-70,-60,-20 -4 -90 0.2

    sox -V2 -v 0.98 --norm -G "/home/.../mp3/.../Big Sky Country (Nashville version).mp3" "/home/.../mp6/.../Big Sky Country (Nashville version).mp3" compand 0.3,1 6:-70,-60,-20 -4 -90 0.2

    sox -V2 -v 0.98 --norm -G "/home/.../mp3/...Big Sky Country.mp3" "/home/.../mp6/.../Big Sky Country.mp3" compand 0.3,1 6:-70,-60,-20 -4 -90 0.2
    sox is constantly warning that it has "clipped" a few thousand points in most files.
    I tried adjusting the prameter, and added three paramters that were suggested would lower the number

    -v 0.98 is supposed to lower all of the volume/gain by 98%

    --norm turns on normalization

    --G turns on automatic gain respect.

    In theory, each of these will stop the warnings, but so far, not really

    Leave a comment:


  • bakker_be
    replied
    Back to your original question, best way I know to batch-check dynamic range is the foobar "Dynamic Range Meter" plugin: https://wiki.hydrogenaud.io/index.ph..._dynamic_range)

    Leave a comment:


  • pfarrell
    replied
    Originally posted by cliveb
    I can't help you with detecting pre-existing compression, but have one other comment.
    Yeah, i've given up on that idea. What I'm going to do is write a small "telltale" file into the directory that tells me it has been processed thru sox/fb2k Its gotta be batch, as of today, I'm up to 352 artists, and 3922 songs.

    BTW, I'm using the Apache license on the tools I'm writing, and its all up on github

    Leave a comment:


  • cliveb
    replied
    I can't help you with detecting pre-existing compression, but have one other comment.
    Rather than dynamic range compression, you could perhaps consider some form of gain riding instead.
    Foobar2000 has a DSP component called VLevel that will do this for you, and it's what I use when preparing music for use in the car.

    As you have probably discovered, FB2K can batch process your whole collection in one pass, and all you need to do to invoke compression and/or gain riding is to activate the DSP component(s) during the conversion stage.

    Leave a comment:


  • pfarrell
    replied
    Originally posted by MainSqueeze
    SoX's "compand" effect might work; the documentation even gives an example that matches your use case: "The following example might be used to make a piece of music with both quiet and loud passages suitable for listening to in a noisy environment such as a moving vehicle..."
    The sox website example shows a command that will not work with the current sox version
    sox --version
    sox: SoX v14.4.2​

    the example command looks like:
    sox asz.wav asz-car.wav compand 0.3,1 6:−70,−60,−20 −5 −90 0.2
    which is apparently a unicode minus sign, and the current sox version expects an ASCII minus sign.
    Unicode Character “−” (U+2212) is bad
    ASCII - (2D) is good.

    I've got the basics working, but I need to tweak my parameters. sox doesn't seem to like having the resulting values go past full scale.

    Leave a comment:


  • pfarrell
    replied
    Originally posted by bobharp
    Though storage is cheap. The little mini SanDisk 128GB (Ultra Fit) is just $14.69 on Amazon right now.
    Thanks, but you are completely missing what I am looking for. I don't care about the size of the music files, as you say, storage is cheap. I do not want the compression you get going from FLAC to MP3. I want audio compression as an effect to reduce the dynamic range of the music. Its easy to do with Audacity, one song at a time.

    It looks like sox or maybe even ffmpeg can do the dynamic range compression, if not detecting if its been done once (or twice) already to the songs.

    Leave a comment:


  • pfarrell
    replied
    Originally posted by strebor56
    https://manual.audacityteam.org/man/scripting.html ...which like you I want to compress for 'listening' in a VW T5 5cylinder van a challenge probably require a DR of about 6 !
    Great link, thanks. My Mazda CX5 is a nice crossover, but the background noise may approach your VW van, especially when I'm towing an open trailer full of dirt bikes. Back in 97, I had a Lincoln LSC, that was quiet enough that you could hear the squeaks of a thumb on the back of the neck of an acoustic guitar. My VW Passat was decent, but not as quiet as the Lincoln.

    I manually used Audacity to compress the MP3s a few years ago, but I had a lot fewer songs to process.

    Leave a comment:


  • pfarrell
    replied
    Originally posted by MainSqueeze
    SoX's "compand" effect might work; the documentation even gives an example that matches your use case: "The following example might be used to make a piece of music with both quiet and loud passages suitable for listening to in a noisy environment such as a moving vehicle..."

    It won't detect previously compressed files, though.
    thanks, that is exactly my use case.

    Leave a comment:


  • MainSqueeze
    replied
    SoX's "compand" effect might work; the documentation even gives an example that matches your use case: "The following example might be used to make a piece of music with both quiet and loud passages suitable for listening to in a noisy environment such as a moving vehicle..."

    If you like what it does to a single file, or a few representative samples, you could then use something like
    Code:
    find -name "*.flac" -exec [your SoX command goes here] {} \;
    and point it at the folder that holds the files to be companded; on a modern machine SoX will go thru 3,000 files in a few minutes.

    It won't detect previously compressed files, though.
    Last edited by MainSqueeze; 2023-03-02, 20:57.

    Leave a comment:


  • slartibartfast
    replied
    Originally posted by pfarrell
    While I'm re-ripping to flac, for the thumbdrive in my car for road trips, I need to have run the tunes thru an audio compressor. Not compressed like MP3 to save space, but an audio compressor to reduce the dynamic range. The car has so much wind noise, tire noise, engine noise, etc. that the full 96dB of dynamic range of a CD or flac file is not useful.

    When I was selecting single songs, I could just run the song thru Audacity. But now I have to process 3164 songs, and the count is growing.

    I want to automate the compression, but I'd like a way to tell if the song has already been thru the audio compression. I'd rather not double compress them.

    Any idea of tools?
    The mastering engineers have ready done the compression for you on most modern CDs 🤣

    Leave a comment:


  • strebor56
    replied
    https://manual.audacityteam.org/man/scripting.html any use?
    another which I must read thoroughly: https://medium.com/@jud.dagnall/dyna...d-621fe2b1a892
    Auto detect dynamic range I haven't looked at at as my library is all flac which like you I want to compress for 'listening' in a VW T5 5cylinder van a chalange probably require a DR of about 6 !

    bonne chance Strebor
    Last edited by strebor56; 2023-03-01, 12:30.

    Leave a comment:


  • bobharp
    replied
    Originally posted by pfarrell
    The car has so much wind noise, tire noise, engine noise, etc. that the full 96dB of dynamic range of a CD or flac file is not useful.
    Sadly no. Though storage is cheap.
    The little mini SanDisk 128GB (Ultra Fit) is just $14.69 on Amazon right now.

    Leave a comment:

Working...
X
😀
🥰
🤢
😎
😡
👍
👎