Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

MP3's that end Loudly

by ALDUMAS (Initiate)
on Nov 20, 2008 at 21:51 UTC ( [id://724999]=perlquestion: print w/replies, xml ) Need Help??

ALDUMAS has asked for the wisdom of the Perl Monks concerning the following question:

Hello, exalted Monks. I've searched for an answer, lo, these many eons and no dice. I've written a little perl ditty that will randomly play mp3's from a list. Usually, it is my list of classical music. Many of these recordings transition directly to the next track on their "home-album" with no silence between, thus when moving randomly to the next track that my script chooses, the cutoff is HARSH! I'd like to find and flag any files that end thusly (at non-zero volume level) and when they come up randomly, I can tack on the track that follows so I don't have to grit my teeth. Thank you all for any enlightenment you might provide. ALDUMAS

Replies are listed 'Best First'.
Re: MP3's that end Loudly
by almut (Canon) on Nov 20, 2008 at 23:44 UTC

    You might want to take a look at Audio::FindChunks, which provides some related functionality... (e.g. the method output_levels()).

      Almut, that is a great suggestion. The author of Audio::FindChunks, Ilya Z., seems to have several programs closely related to parsing over mp3's. Much Obliged!
Re: MP3's that end Loudly
by andyford (Curate) on Nov 20, 2008 at 23:39 UTC
      Thanks, but the problem is that i already converted my cd collection to mp3's and there may be 100's of such files (it's mostly classical). I honestly don't know and I don't have the patience to go through album by album. I want to make a program examine the files for me while I do like listen to music that doesn't end loudly. ;) Rgds
Re: MP3's that end Loudly
by mikelieman (Friar) on Nov 20, 2008 at 21:57 UTC
    Plug the output from the PC into an outboard audio limiter, and adjust that to your desired peak-level, before it hits your amplifier?

      Just to elaborate: this is called dynamic range compression ... not to be confused with audio data compression. The former is what makes the MP3's in the first place -- but the latter actually limits the output audio and prevents it from "being too loud."

      This can be done in Perl, i am quite sure ... but the problem is how does one attach a "virtual filter" to the output of the program playing their MP3 files? This is why so many people just solve the problem with hardware instead.

      UPDATE: drats -- I had it right the first time, sasdrtx. :) I used to be a janitor but I don't do that no more. Someone else can fix it. ;)

      jeffa

      L-LL-L--L-LL-L--L-LL-L--
      -R--R-RR-R--R-RR-R--R-RR
      B--B--B--B--B--B--B--B--
      H---H---H---H---H---H---
      (the triplet paradiddle with high-hat)
      

        You have your latter and former mixed up.

        sas
      I'm very appreciative of the reply, but I guess I didn't say clearly what I want to program... Let us say that you buy an audio CD and you want to listen to your favorite song. You look at the track listings and see that it's divided into TWO tracks, #1 and #2! The division is at a logical point, yes, but at a point where there is plenty of sound activity. If you tell your player to play just #1, the song will end suddenly. I want to avoid exactly that! Thus if i have a track whose last frames are not silence, I want to flag it to avoid playing that track by itself. So, how can I use a perl module to seek to the end of the MP3 track and check the volume level? Thank you so much. Please don't make me have to ask the C-Monk(ey)s Regards, ADUMAS

        I would just merge the files then:

        cat 1-05 Another_Brick_In_The_Wall >> 1-04_Happiest_Days_Of_Our_Lives
        Is one that works. Remember, some songs merge directly into the next song even though they are completely unrelated. These days I only deal with lossless files and appropriately merge them first before making my MP3 collection.

        I do think your idea is a good one however -- but how will it work for iTunes or XMMS users?

        jeffa

        L-LL-L--L-LL-L--L-LL-L--
        -R--R-RR-R--R-RR-R--R-RR
        B--B--B--B--B--B--B--B--
        H---H---H---H---H---H---
        (the triplet paradiddle with high-hat)
        
Re: MP3's that end Loudly
by tweetiepooh (Hermit) on Nov 21, 2008 at 17:05 UTC
    I like this question. Hopefully the OP will report back a good solution.

    I too have issues with classical music (and long talks, lectures etc) and the MP3 format. When ripped the piece is split according to breaks on the CD into separate MP3 files. Mostly this is OK. But if you want to listen to the whole you don't want the breaks you want to "join" the parts to a single whole as far as the ear is concerned but still maintain the ability to rewind or progress to set points. With simply MP3 playback of random tracks Amarok crossfades reducing the harshness but you don't want that if listening sequentially.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://724999]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-03-19 05:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found