Forums > MaxMSP

Clicks and Pops when triggering samples

June 25, 2007 | 9:21 pm

When i trigger samples from msp using the play~ object with a line~ in the left inlet, there is a little pop at the beginning of the sample. anyone know how i can remedy this? i know it is probably a simple solution… thanks.

j


June 26, 2007 | 9:28 am

it could be a number of different issues… if you want help, post a patch so we can see!

j


June 26, 2007 | 9:40 am

it could be a number of different issues… if you want help, post a patch so we can see!

j


June 26, 2007 | 10:40 am

Quote: folkbot@gmail.com wrote on Mon, 25 June 2007 23:21
—————————————————-
> When i trigger samples from msp using the play~ object with a line~ in the left inlet, there is a little pop at the beginning of the sample. anyone know how i can remedy this? i know it is probably a simple solution… thanks.
>
> j
—————————————————-

(wild guess as I didn’t see the patch)
We suppose that all your samples last two seconds. When playing the first sample, most probably you send a [0., 2000. 2000.( message to the [line~]. If you send again this message for playing the sample a second time, the line first goes from 2000. to 0. in no time. Actually, this reads the sound from 2000. to 0. ("rewind") in no time, which produces a kind of "click".

One solution for avoiding this can be muting the sound when the line goes from 2000. to 0.. You can try something like this for playing maybe (order is important, use a [trigger] object) :
1. (provided that no sample is being read) mute the sound in no time
2. send [0.( to the line~ ("rewind")
3. (possibly with a slight delay) unmute the sound in no time
4. send either [2000. 2000.( or [0., 2000. 2000.( to the line~

It’s better to rewind just after the sample is finished if you can …


June 26, 2007 | 4:33 pm

On Jun 26, 2007, at 6:41 AM, julienbreval wrote:

>
> Quote: folkbot@gmail.com wrote on Mon, 25 June 2007 23:21
> —————————————————-
>> When i trigger samples from msp using the play~ object with a line~
>> in the left inlet, there is a little pop at the beginning of the
>> sample. anyone know how i can remedy this? i know it is probably a
>> simple solution… thanks.
>>
>> j
> —————————————————-
>
> (wild guess as I didn’t see the patch)
> We suppose that all your samples last two seconds. When playing the
> first sample, most probably you send a [0., 2000. 2000.( message to
> the [line~]. If you send again this message for playing the sample a
> second time, the line first goes from 2000. to 0. in no time.
> Actually, this reads the sound from 2000. to 0. ("rewind") in no time,
> which produces a kind of "click".
>
> One solution for avoiding this can be muting the sound when the line
> goes from 2000. to 0.. You can try something like this for playing
> maybe (order is important, use a [trigger] object) :
> 1. (provided that no sample is being read) mute the sound in no time
> 2. send [0.( to the line~ ("rewind")
> 3. (possibly with a slight delay) unmute the sound in no time
> 4. send either [2000. 2000.( or [0., 2000. 2000.( to the line~
>
> It’s better to rewind just after the sample is finished if you can …
>

Also, note that there will often be a slight difference between 0,
2000. 2000. and 0. 0. 2000. 2000. Conceptually, they do the same (the
first is actually read as 0. 0. since there is no time specified), but
the first one will possibly have a hiccup because it requires the
scheduler between events. (that is, it’s two discrete scheduled events
instead of one like the second one because of the comma; line~ sees two
messages: 0., and then 2000. 2000.)

The second one will be more reliable because it doesn’t need the
scheduler after line~ receives the message.

Other issues:
Make sure that your buffer begins and ends at a zero value. Otherwise,
you’ll definitely have problems with clicks. This is definitely a
potential issue if you’re stopping somewhere in the middle of the
buffer. For instance if at 2000 ms into the file, line~ stops, but
play~ continues to output a sample value of 0.2 (because that’s the
value at 2000 ms) you’ll be introducing a very nasty DC offset into
your mix which will kill headroom and damage your speakers potentially.

If this is what’s causing the clicks, try downloading killdc~.

If you want to do a synced envelope, then check out wave~. Use one
wave~ for your sound, and one wave~ for your envelope. (or trapezoid~
or envelope…) Instead of doing a line from 0 0. 2000. 2000. you’d
feed it a line from 0. 0. 1. 2000. and make sure to set the start and
stop points of wave~ to 0. and 2000.

Hope this helps.

Peter McCulloch

http://www.petermcculloch.com


June 27, 2007 | 1:52 am

great advice…. thanks so much. i will work with this info and get back… maybe i will post the patch next time.

thanks again.

smiles,
justin


June 27, 2007 | 10:12 pm

Also, you can try using groove~ instead of play~ (it works in oneshot or loop mode, and it has an additional sync ramp signal output, which is useful for controlling amplitude envelopes like trapezoid~, for example). The xgroove~ external is even more complete.


Viewing 7 posts - 1 through 7 (of 7 total)