-
-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new metadata.replaygain function to extract unified replay gain value in dB from metadata. - Handles r128_track_gain and replaygain_track_gain internally. - Returns single gain value. Add compute parameter to file.replaygain and enable_replaygain_metadata. - Controls whether to compute gain when metadata missing tags. - enable_replaygain_metadata calls file.replaygain with compute. Remove unnecessary ebu_r128 parameter from replaygain.
- Loading branch information
1 parent
06f8d5e
commit f481679
Showing
5 changed files
with
155 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!../../liquidsoap ../test.liq | ||
|
||
def test_metadata_replaygain() = | ||
test.equals(metadata.replaygain([("r128_track_gain", "0")]), 0.) | ||
test.equals(metadata.replaygain([("r128_track_gain", "256")]), 1.) | ||
test.equals(metadata.replaygain([("r128_track_gain", "32767")]), 32767./256.) | ||
test.equals(metadata.replaygain([("r128_track_gain", "-32768")]), -32768./256.) | ||
|
||
test.equals(metadata.replaygain([("r128_track_gain", "foo")]), null()) | ||
test.equals(metadata.replaygain([("r128_track_gain", "0 foo")]), null()) | ||
test.equals(metadata.replaygain([("r128_track_gain", "")]), null()) | ||
|
||
test.equals(metadata.replaygain([("replaygain_track_gain", "1 dB")]), 1.) | ||
test.equals(metadata.replaygain([("replaygain_track_gain", "1")]), 1.) | ||
test.equals(metadata.replaygain([("replaygain_track_gain", "-1 dB")]), -1.) | ||
test.equals(metadata.replaygain([("replaygain_track_gain", "-1")]), -1.) | ||
test.equals(metadata.replaygain([("replaygain_track_gain", "+0.424046 dB")]), 0.424046) | ||
test.equals(metadata.replaygain([("replaygain_track_gain", "+0.424046")]), 0.424046) | ||
test.equals(metadata.replaygain([("replaygain_track_gain", "-10.38500 dB")]), -10.38500) | ||
test.equals(metadata.replaygain([("replaygain_track_gain", "-10.38500")]), -10.38500) | ||
|
||
test.equals(metadata.replaygain([("replaygain_track_gain", "1 dB")]), 1.) | ||
test.equals(metadata.replaygain([("replaygain_track_gain", "1 2 dB")]), 1.) | ||
test.equals(metadata.replaygain([("replaygain_track_gain", "1 db")]), 1.) | ||
test.equals(metadata.replaygain([("replaygain_track_gain", "1 DB")]), 1.) | ||
test.equals(metadata.replaygain([("replaygain_track_gain", "1 foo")]), 1.) | ||
|
||
test.equals(metadata.replaygain([("replaygain_track_gain", "")]), null()) | ||
test.equals(metadata.replaygain([("replaygain_track_gain", "foo")]), null()) | ||
|
||
test.equals(metadata.replaygain([]), null()) | ||
test.equals(metadata.replaygain([("r128_track_gain", "foo"), ("replaygain_track_gain", "1")]), null()) | ||
test.equals(metadata.replaygain([("replaygain_track_gain", "1"), ("r128_track_gain", "foo")]), null()) | ||
|
||
test.pass() | ||
end | ||
|
||
test.check(test_metadata_replaygain) |