-
-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: Unify ReplayGain handling and calculation #3438
Conversation
I need some help with the tests for |
3d916d1
to
3d9c058
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine thanks!
f481679
to
62488c3
Compare
Hi! Do you need anything more with this PR? If @smimram has approved it I trurst y'all 🙂 |
How do I plan to test
|
Okay. Do you mean you would like some support writing the test? |
Yes, I do!
|
62488c3
to
3ae26bf
Compare
Sorry for the delay.
I think the pattern we seemed to have been following mostly is:
Thus, I would say
Yes, that's how we already do it. See for instance in (rule
(alias citest)
(target file1.mp3)
(action
(run
ffmpeg
-hide_banner
-loglevel
error
-f
lavfi
-i
"sine=frequency=220:duration=5"
-ac
2
%{target}))) You can then put this file has a dependency of your test: (rule
(alias citest)
(package liquidsoap)
(deps
195.liq
./file1.mp3
../../src/bin/liquidsoap.exe
(package liquidsoap)
(:test_liq ../test.liq)
(:run_test ../run_test.exe))
(action (run %{run_test} 195.liq liquidsoap %{test_liq} 195.liq)))
at test time works!
at test time works! To run a test, we use the Once a new test is placed in % dune build @gendune --auto-promote This will re-generate the dune files to include your test in the test suite. If your test does not have generated test files, you can run it manually from within ../../liquidsoap ../test.liq ./my-test.liq If it does, the best is to run all the tests: % dune build @citest Once all the tests are ran, if your test still has issues you can manually go to ../../../../liquidsoap ../test.liq ./my-test.liq If you edit the file inside Hope this helps! |
3ae26bf
to
f198274
Compare
@vitoyucepi I had to change the test runner configuration. If you push another commit, they should run this time. |
@toots, I'd like to create another PR with additional test methods. def test.not_equals(first, second)
def test.almost_equals(~places=7, first, second)
def test.not_almost_equals(~places=7, first, second) I'm planning to replace null.defined(g) and abs(null.get(g) - 7.37) < 0.05 with test.not_equals(g, null())
test.almost_equals(g, 7.37) |
Sounds great! Unless you want to also convert a bunch of tests to use the new API, you could also introduce it here directly. |
I've created a separate PR with the required test functions. |
f1447a3
to
7865145
Compare
I think this PR is ready. |
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. BREAKING CHANGE: Remove unnecessary ebu_r128 parameter from replaygain. BREAKING CHANGE: Extract replaygain_track_gain always in dB.
7865145
to
2fb7634
Compare
This looks really good sorry for the delay reviewing this. Setting it for auto-merge now! |
Summary
This PR unifies ReplayGain handling by:
A new
metadata.replaygain
method extracts a unified replay gain value in dB from metadata, handlingr128_track_gain
andreplaygain_track_gain
internally to provide a single gain value.Adding a
compute
parameter tofile.replaygain
andenable_replaygain_metadata
to control gain calculation when metadata is missing replaygain tags.enable_replaygain_metadata
callsfile.replaygain
internally with the compute value.Removing the unnecessary
ebu_r128
parameter fromreplaygain
since EBU R128 data will be extracted from metadata when available.Breaking changes
replaygain
no longer has theebu_r128
named parameter.r128_track_gain
is now always processed from metadata in themetadata.replaygain
function.metadata.replaygain
extracts gain fromreplaygain_track_gain
always in dB.Additional
Closes #3435.
Requires #3478.