Replay Gain

Create issue
Issue #7 closed
mike created an issue

I use resample_soxr with a param-file to set the volume in real time. Due to buffering I have unwanted volume changes usually in the last few seconds of the song because of my replay gain process picking up the next song while the current song is still in the buffer. Passing the replay gain correction separately by running resample_soxr or volrace twice would solve the problem. I assume adjusting volume twice, even at 64 bit precision is a compromise? Any suggestions?

Thanks again, Mike

Comments (8)

  1. mike reporter

    Doing the following works fine: replaygain is a value I pass to volrace for each song, tmpvolumefile is changed in realtime to control the volume. I am considering adding replaygain to volrace or resample_soxr as another input to avoid doing volume twice. Am I correct in assuming there would be a mathmatical advantage only doing it once?

    volrace --volume=replaygain | resample_soxr --param-file=tmpvolumefile --inrate=44100 --outrate=192000

    ps. Thanks for race option, my initial listen to it was fascinating


  2. mike reporter

    Update: I was hoping to do the following: resample_soxr --param-file=myparamfile --replaygain=.8 --inrate=44100 --outrate=192000 --bandwith=99.0 --phase=45

    I was hoping to add the --replaygain parameter (if I can figure out the code), any chance you could add it as a new feature?

    I found that resample_soxr would crash with a segmentation fault if I was using race and a bandwidth over 98.1. Is this a limit of the race function or maybe a bug? I was using a 96000 24 bit file to test.

    Probably not ideal but as a work around I am doing this: resample_soxr --volume=$replaygain --inrate=44100 --outrate=192000 --bandwith=99.0 --phase=45 | volrace --param-file=myparamfile (with volume and race settings)


  3. frank_l repo owner

    Mike, Thanks for your input. Here are some remarks.

    • applying several volume changes (with reasonable values) should be absolutely no problem mathematically.
    • avoiding the pipe and running resample_soxr and volrace as in your last example could make a difference.
    • I have added an option --replay-gain to resample_soxr as suggested. Does this solve your issue?
    • the segfault you got with a combination of race and the resampler was indeed a bug. This is fixed in commit e2808a8.


  4. mike reporter

    Thanks Frank, works great, solved my replay gain issue.

    Minor issue that could confuse someone, missing the r and c option on this line of code while ((optc = getopt_long(argc, argv, "i⭕P:B✌s:u:n:d🅰l:F🅱fⓂpVh",

    I ran the test files for the previous version of resample_soxr and sent the results to - the graphs look slightly better than sox I assume due to the 64 bit math. Only a few products measuring below -180 db.

    I have settings that I like for DSD that I will post under my DSD question.

    Thanks again, Mike

  5. frank_l repo owner

    Thanks for the feedback. I have fixed the recognition of all short options.

    I will remember your hint if I get some DSD file.


  6. Log in to comment