kartik-venugopal / aural-player

An audio player for macOS, inspired by Winamp.
MIT License
906 stars 47 forks source link

Add a new ReplayGain mode to consider all tracks in the Play Queue #12

Open jonathanlie opened 5 years ago

jonathanlie commented 5 years ago

Hi, just a suggestion to improve list of things cleared up from README.

kartik-venugopal commented 5 years ago

Hi, thanks for the suggestion. It has been suggested before, and I briefly looked into it. It is challenging to implement, but I will definitely keep it in mind for the future.

Thanks for your interest in the project !

Cheers !

LesterJitsi commented 3 years ago

I'm a new Aural user and it would be nice if replay gain was implemented. I understand it has to be actually challenging as two years have elapsed. That said it's a very interesting application, my congrats!

kartik-venugopal commented 3 years ago

Thanks, I am currently busy with other work, so I don't know when I will return to working on Aural, but thank you for your kind words :)

Stay safe. Best wishes, mC

kartik-venugopal commented 2 months ago

@LesterJitsi - I have been looking into replay gain recently ... I can now implement replay gain reading from track metadata ... in the future, I may also be able to implement active scanning of tracks to compute replay gain (I found a couple of C / C++ libraries to do it). If I figure out how to integrate those libraries into Aural, I can do it.

Anyway, I should be able to release metadata-based replay gain in v4.0.0 😄

LesterJitsi commented 2 months ago

@kartik-venugopal Great! 👍

kartik-venugopal commented 2 months ago

@LesterJitsi - Implemented in the v4 "preview9" release (updated just now). Aural will look for metadata and if none is found, it will scan / analyze the file / album for loudness. There's also a pre-amp to adjust the baseline gain. It shows up as a new effects unit (on the effects window) ... enable it by clicking the power button on the unit. Also there are some hidden options in the presets / settings menu (3 dots / ellipsis auto-hiding icon below the power button)

Screenshot 2024-08-25 at 2 00 30 AM

Screenshot 2024-08-25 at 2 03 16 AM

See the release notes in the release Zip archive for all the details.

And let me know if it works for you. Cheers!

LesterJitsi commented 2 months ago

Yes, it works 😀 Now I'll reveal my ignorance posing a dumb question (please refer to the screenshots).

Screenshot 2024-08-26 alle 18 25 35_1

Screenshot 2024-08-26 alle 18 25 52_1

The tracks are taken from two Sheryl Crow's CDs mastered at markedly different loudness levels. No matter what the order of tracks in the Play Queue, the louder one is normalized to the less loud level (I hope my choice of words is not fully inaccurate). That's how it works ReplayGain or is it possible to reverse the effect? Disabling clipping prevention makes very little difference if none at all.

I'm asking just for sake of knowledge. I hate inflated loudness like this:

stoogeswave2

Thanks a lot!

kartik-venugopal commented 2 months ago

Hey @LesterJitsi , I think I understood what you're trying to say. Correct me if I didn't.

The way that ReplayGain generally works is based on the idea of a "target loudness" ... this is generally 89 dbSPL (Sound Pressure Level) or in the computer world, -14 dbFS (Full Scale) or -18 LUFS (Loudness Units Full Scale) .. Aural uses -18 LUFS as its target loudness. Think of this value as a baseline ... anything louder than it will be made quieter, and anything softer than the baseline will be made louder. That is how track gain works. Album gain is the same thing but for an album as a whole ... album gain is based on the average loudness for the entire album as a whole. But read the next paragraph ...

The way that Aural uses "Album gain" is ... first of all, tracks must have the same value for the "Album" metadata field in order to be considered as part of the same album. If your tracks in the Play Queue come from different albums (as in your case), then album gain will not be the right setting for you ...

That said, I can see from your screenshots that what has been applied is Track gain, not Album gain. So the target loudness (and individual track loudness) is the deciding factor in what becomes louder / softer.

That said, maybe what Aural needs is to consider all the tracks currently in the Play Queue as an "album" ... maybe this would be another "Mode" ???

What do you think ?

kartik-venugopal commented 2 months ago

And clipping prevention won't take effect unless it predicts (based on track / album peak metadata) that clipping MAY occur ... if your loudness is already at a safe level, clipping will never happen and prevention makes no difference.

LesterJitsi commented 2 months ago

That said, maybe what Aural needs is to consider all the tracks currently in the Play Queue as an "album" ... maybe this would be another "Mode" ???

Oh yes, that would be perfect 💯 You understood what I meant, I should have searched better. Ok also for clipping prevention, I mentioned it not being sure about what has to be considered a "safe level".

That said, you're doing an outstanding work 🥇 All paid alternatives to Aural for Mac I know about are less worthy, IMHO.

kartik-venugopal commented 2 months ago

Great, I am reopening this issue to add the new replay gain mode. Thanks buddy ... by the way, I hope you saw your name in the "Contributor Attributions" section on the main page 😉

https://github.com/kartik-venugopal/aural-player?tab=readme-ov-file#contributor-attributions

kartik-venugopal commented 2 months ago

I mentioned it not being sure about what has to be considered a "safe level".

No worries. So, it's basically some mathematics ... it looks at the previously recorded "track peak" or "album peak" amplitude (which is a number between 0 and 1) ... and then based on the replay gain value (esp. if the gain is positive), it checks if the replay gain will cause the max amplitude to cross that threshold value beyond which the signal will get "clipped" or cut off, producing a distorted buzzy sound that we have all heard when blasting music on our stereo speakers 😄

It's just a safety mechanism to prevent that unpleasant sound distortion that may occur ... or in worse cases damage your equipment or your ears !... whether or not it has an effect kind of depends on how much the amplitude varies from its quietest to loudest within a song / album - "dynamic range", and how much replay gain is applied.

This is a highly simplified explanation. Watch out for all the audiophiles who will come in here and correct me 😆