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

Sample playback loops when not expected, and there's a slight click in playback #421

Open
ericclack opened this issue Dec 30, 2018 · 7 comments

Comments

@ericclack
Copy link

ericclack commented Dec 30, 2018

Hi,
Apologies, this is perhaps not an issue, more of a question.

Is this expected behaviour: when I playback a freesound sample with release option the sample loops? I was hoping to use this option to fix a slight click at end of sample playback.

(def stick (freesound 82280))

(stick) ; this plays with a click at the end

(stick :release 0.1) ; this loops a little 

(stick release 2) ; this loops a lot

The player in the file:https://github.com/overtone/overtone/blob/master/src/overtone/sc/sample.clj

@ericclack
Copy link
Author

From conversation in Slack: https://clojurians.slack.com/archives/C053Q1QSG/p1546177050008000

A simple player has no click sound -- and obviously none of the other features of the regular sample player:

(def stick-buff (load-sample (freesound-path 82280)))
(definst stick [] (play-buf 1 stick-buff))
(stick)

I'd like to fix the looping and click and submit a pull request.

Is anyone willing to review and comment on my work, when ready?

Cheers,
-Eric.

@ericclack ericclack changed the title Release option on sample playback loops Sample playback loops when not expected, and there's a slight click in playback Jan 7, 2019
@hlolli
Copy link
Member

hlolli commented Jan 7, 2019

I will review it. But how are you thinking about solving non looping of sample envelope if the total envelope time is greater than one? How do we know if this isn't used in many music tracks already and we'd be making breaking changes? Note that release time is time added to an envelope, if you want to shorten the sample, you may want to decrease the sustain time. Are you sure that this click in your stick sample doesn't also appear when you play it in a DAW (some players like VLC may have anti-click faders on pause/end of media).

@hlolli
Copy link
Member

hlolli commented Jan 7, 2019

Behind every sample, freesound or non-freesound, there's a buffer id, that you can use with a phasor to iterate over the samples in the sample. You have total freedom to manipulate it the way you want. I'd say, we should stick with the default behaviour of Supercollider, which is gated based envelopes. If a gate triggers after the whole sample is played, then it loops, except when looping is turned off in PlayBuf.

@ericclack
Copy link
Author

Thanks for your comments and advice. I don't have any answers to your questions right now, but it's good to know the broader requirements. I'll have a think and post my progress to this thread...

@ericclack
Copy link
Author

I've a question: what's the advantage of using the phasor and buf-rd over the simpler play-buf? Is this to support the variable start and end points? Could this be done with a envelope instead?

Here's where I've got to in my own repo:
https://github.com/ericclack/overtone-loops/blob/68116ddceb9bdb8917529882bbad95b6a90ae51b/src/overtone_loops/loops.clj#L128

I'm way off a Pull Request and really just experimenting at the moment. Comments welcome.

I think my next step is to explore how widespread the click problem is with the standard implementation (e.g. trying some other computers), and looking at documenting the expected behaviour with the release and loop? options.

@hlolli
Copy link
Member

hlolli commented Jan 8, 2019

Clicks are inherently constant problem in every audio signal. For example a punchy kick with low attack time has always click, but it just dies in the loudness other things happening. An poorly enveloped audio recording will click, just because the spatial sounds attack otherwise silent speaker on full force. So declicking is something I always bear in mind, a battle of tradeoffs that never ends. The advantage you ask about, doesn't matter if you play the sample linearly, for granular effects, hopping back and forth on a sample, you may need more low level tool, like a phasor and buffer read.

@theJohnnyBrown
Copy link

I've had the same problem, also solved by straightforward use of load-sample.

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

No branches or pull requests

3 participants