Skip to content
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

Beginning of songs are cut too much when using cue_cut #390

Closed
smlz opened this issue Feb 4, 2017 · 1 comment · Fixed by #391
Closed

Beginning of songs are cut too much when using cue_cut #390

smlz opened this issue Feb 4, 2017 · 1 comment · Fixed by #391

Comments

@smlz
Copy link
Contributor

smlz commented Feb 4, 2017

Hi, we are currently renewing our studio automation software and liquidsoap really safes our day. Thanks to everyone contributing to this fine piece of software.

I recently discovered a small problem when using cue_cut. We use silan (https://github.com/x42/silan) to detect of silent parts at the beginning and the end of audio files, and then use this information with the cue_cut operator. When the time of the cue_in point is small (< 0.04s, smaller than the frame length) which quite often is the case, not just a couple of milliseconds, but around half a second is cut off.

It looks like this has happened to others as well: https://forum.sourcefabric.org/discussion/16854/begin-of-songs-are-cut/p1

Tested with:

$ liquidsoap --version
Liquidsoap 1.2.0
Copyright (c) 2003-2016 Savonet team
Liquidsoap is open-source software, released under GNU General Public License.
See <http://liquidsoap.fm> for more information.

$ liquidsoap 'out(cue_cut(single("annotate:liq_cue_in=\"0.001\":test.flac")))'

I think that the fseek function in the file decoder forgets to account for the contents in the pre-buffer when seeking backwards. See https://github.com/savonet/liquidsoap/blob/1.2.1/src/decoder/decoder.ml#L429-L433

smlz added a commit to radiorabe/liquidsoap that referenced this issue Feb 4, 2017
@toots toots closed this as completed in #391 Feb 4, 2017
toots added a commit that referenced this issue Feb 4, 2017
Account for buffer contents when seeking backwards (#390)
@smlz
Copy link
Contributor Author

smlz commented Feb 6, 2017

Thanks for the merge.

Just for the record: here's a quick work-around we use for the current versions of Liquidsoap:

def fix_cue_in(~cue_in_metadata='liq_cue_in', m) =
    cue_in = float_of_string(m[cue_in_metadata])
    if cue_in < 0.04 then
        [(cue_in_metadata, "0")]
    else
        []
    end
end

s = map_metadata(fix_cue_in, s)
# or
# s = map_metadata(fix_cue_in(cue_in_metadata="whatever_youre_calling_it"), s)

# and then
s = cue_cut(s)

I don't know, whether the frame size is always 1/25 of a second in Liquidsoap. So, the value of 0.04 might need to be adjusted according to your setup.

hairmare added a commit to radiorabe/libretime that referenced this issue Feb 19, 2017
This is the workaround for <savonet/liquidsoap#390>.

I still need to do proper testing on it and maybe we should figure out the proper "formula" for getting to the 0.04 value.
hairmare added a commit to radiorabe/libretime that referenced this issue Feb 22, 2017
This is the workaround for <savonet/liquidsoap#390>.

I still need to do proper testing on it and maybe we should figure out the proper "formula" for getting to the 0.04 value.
hairmare added a commit to radiorabe/libretime that referenced this issue Feb 23, 2017
This is the workaround for <savonet/liquidsoap#390>.

I still need to do proper testing on it and maybe we should figure out the proper "formula" for getting to the 0.04 value.
hairmare added a commit to radiorabe/libretime that referenced this issue Mar 4, 2017
This is the workaround for <savonet/liquidsoap#390>.

I still need to do proper testing on it and maybe we should figure out the proper "formula" for getting to the 0.04 value.
hairmare added a commit to radiorabe/libretime that referenced this issue Mar 12, 2017
This is the workaround for <savonet/liquidsoap#390>.

I still need to do proper testing on it and maybe we should figure out the proper "formula" for getting to the 0.04 value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant