Avoid "click" when playing part of buffer using [play~]

kmll's icon

I want to play a small piece of a buffer using the [play] and I send the following message (using javascript) - "start 3900 4166 266" . This works fine but I get a small noise in the beginning and in the end of the playback caused by the abrubt cut in the sample. If anyone have an elegant/easy solutions to this please let me know.
(I am currently looking into a solution using [line] etc but I suspect there are better ways of accomplishing this which I am not aware)

brendan mccloskey's icon

Hi
the common method is to envelope the output to mask the discontinuities:

Max Patch
Copy patch and select New From Clipboard in Max.

You should be able to adapt this to suit your own system, which you should post to illustrate your own approach

Brendan

Christopher Dobrian's icon

Here are examples of a couple different methods, using either line~ or trapezoid~. Any comparable windowing (enveloping) method will work.

kmll's icon

Thanks for the advise. I believe I am getting closer to a solution now where I am using a task object in javascript to gain down before the play object ends. The solution is not ready yet but your input was helful in thinking out the idea - thanks:)

f33d's icon

hey guys,

Christopher Dobrian,

I had the same problem and could integrate the "Example 21 Random access" - solution perfectly in my "auto sampler" patch based on sfplay -
there is only one problem: I already use one line~ for controlling the sample length. So the two envelopes have to merge somehow.
Between sfplay~ and m4l-gain I have the line~-sample-length hooked to the right inlets of the 2(left-right) *~. If I put the signal from the anti-click-line into the same inlet I get a distorted sound.
I thought, maybe the right inlet can not just take more than one signal & merge on its own.
So I made another pair of *~ to multiply both envelopes.
Still distorted. Now this I think is because if both envelopes multiply they go over 1 very fast. But now I don't know how to multiply both having max 1 at the end. Could be just basic maths, or advanced or impossible. I don't really know. Maybe sb. knows a way out?

thanks
f33d

achzo's icon
Max Patch
Copy patch and select New From Clipboard in Max.

if i understood you correctly, you multiplying two modulations. Try this:

otherwise, post a part of the patch with the issue.