mucke
mucke copied to clipboard
Replaygain support
Would it be possible to add replaygain support? Most of the other open source music players include it.
It looks like I'm not getting any replay gain information for the music files. So unfortunately, this is rather unlikely to be implemented. A manually set gain for all songs, per album, or per song should not be a problem, though.
Poweramp supports album and track gain from music files. So it's certainly possible. And for a musicplayer that's largely based on shuffle play it's essential.
@FriederHannenheim do you think, it would be possible (and viable) to get the replay gain info via metadata_god?
Yes it should be possible. metadata_god doesn't support it by default but since we're using my own fork anyway I could add that. I will look into it in the coming days
@moritz-weber I added ReplayGain support to metadata_god in my fork. If you want to use it just run flutter pub upgrade
. There are new fields on Metadata for TrackGain/TrackPeak and AlbumGain/AlbumPeak. If you want to I can look into implementing this in mucke or you could do it yourself. I'm not so sure how to do it.
@FriederHannenheim thanks for the great work. If you like, you can look into this topic. I have no experience with replay gain myself. Maybe, @wozeparrot and @KolyaKorruptis can give us some hints. Perhaps point to an app that implements this well.
As for the implementation in mucke, I suspect that we would need to calculate the desired volume level for each song - given the fields that you mentioned in your comment - and then set the volume accordingly.
The AudioSource
class that describes the songs in terms of the actual audio player does not have an option to specify the volume. Thus, we would probably need to set the volume for every song by listening to some stream (e.g. current index or song stream).
just_audio
has a method for that: player.setVolume(0.5);
gain information is written into the file beforehand by tools like mp3gain. you don't need to calculate it. these tools usually calculate album gain and track gain, but for a shuffle play centered player like mucke only track gain is interesting.
Thanks for the response. I tested mp3gain, but I'm not really sure, how to interpret the results. For example:
Song x has a recommended track gain g = -0.435 dB
. I'm guessing, this means that the song is a bit too loud. In our case, we would need to calculate a linear value from the dB value: l = 10^(g/20) = 0.95
. So we would need to call setVolume(0.95)
.
Does this make sense?