avoiding clicks in a voice patch using mouse

R_Gol's icon

R_Gol

3月 25 2024 | 10:03 午前

I'm using the x axis and y-axis of the mouse in order to play musical scale and control its volume.

I have the following main patch:

mallets_main.maxpat
Max Patch

and the poly patch:

p_mallet~.maxpat
Max Patch

there is some undesirable clicks when moving from note to note (x axis) - how can I solve that?

Thanks

Source Audio's icon

Source Audio

3月 25 2024 | 10:34 午前

before using poly~ test your patch like this.

than you might better see where to tame repetitions

and also voicing.

R_Gol's icon

R_Gol

3月 25 2024 | 2:28 午後

I try the above patch but there is plenty of clicks when moving on the x axis

R_Gol's icon

R_Gol

3月 25 2024 | 2:34 午後

here is a short recording of the clicks I'm getting

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

Source Audio's icon

Source Audio

3月 26 2024 | 8:05 午前

sure they are clicks, the patch was only to see where you produce clicks

when mousing arround, and the fix that.

like this for example

R_Gol's icon

R_Gol

3月 30 2024 | 2:41 午後

It is sound better but I am still facing some clicks.

What can Solve them?

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

edit: the use of poly will solve it?

Source Audio's icon

Source Audio

3月 30 2024 | 3:58 午後

you must disable input to a voice if it is still sustaining.

Or fade it down, then pass input

R_Gol's icon

R_Gol

3月 30 2024 | 4:16 午後

How shall I do so?

The problem I'm thinking is accusing is that the moving of the mouse along x axis is faster then the note time (envelope) and therefore clocking is happening. If using poly each note that is playing will fade out completely right?

Source Audio's icon

Source Audio

3月 30 2024 | 4:38 午後

are you not using poly~ ?

patch I posted was just example how to avoid repetitions.

now you have to send notes to poly~ instances, and make sure to prevent

voice retrigger till it ends completely, or then first fade it out.

R_Gol's icon

R_Gol

3月 30 2024 | 4:40 午後

now you have to send notes to poly~ instances, and make sure to prevent
voice retrigger till it ends completely, or then first fade it out.

what do you mean by send notes to poly~ ?

R_Gol's icon

R_Gol

3月 30 2024 | 4:44 午後

here is my patch with poly and still clicks accrue:

Main:

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

poly:

p_mallet3

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

Source Audio's icon

Source Audio

3月 30 2024 | 4:48 午後

your next problem is curve~

it bangs when it reaches destination.

it does so after 5ms and then after it fades out

you need to make something better for busy status of a voice

R_Gol's icon

R_Gol

3月 30 2024 | 4:54 午後

What would be better for busy status of a voice?

Source Audio's icon

Source Audio

3月 31 2024 | 7:53 午前

received note = busy, function reached 0. = free again

R_Gol's icon

R_Gol

3月 31 2024 | 7:58 午前

I'm not sure I understand how to do so

What about using makenote:

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

Source Audio's icon

Source Audio

3月 31 2024 | 8:02 午前





R_Gol's icon

R_Gol

3月 31 2024 | 8:10 午前

still happening

main;

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

p_mallet3~

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

Source Audio's icon

Source Audio

3月 31 2024 | 9:53 午前

you have no voice management at all.

no note prepended, or target message ...

if you use note message, 12 notes will get routed to any free instance.

If you link note index to voice (target number)

then 1 note can not be heard twice...

here is note example

Mallets-note.maxpat
Max Patch

p_mallet4.maxpat
Max Patch
Source Audio's icon

Source Audio

3月 31 2024 | 10:26 午前

P.S.

you disabled voice stealing in all examples you posted.

Which means no new note if all voices are bussy.

check the difference :

R_Gol's icon

R_Gol

3月 31 2024 | 10:48 午前

Thank you very much for this. It is working great!

How can I generate another voice on top of the played voice?

So if the note 60 is played it will also will play his major chord

Building a chords on top of the root note

R_Gol's icon

R_Gol

3月 31 2024 | 11:11 午前

Right now - each time the note 60 is played a minor chords is play above it.

Any smarter more productive way of doing so?

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

Source Audio's icon

Source Audio

3月 31 2024 | 11:33 午前

too many voices using cycle sound terrible.

but if you want 12 notes to produce 12 chords,

multiply number of voices needed.

If you want to play melodies and add a chord here and there,

consider a key that enables adding chord or not.

you could create coll with note numbers and chords...

passing only single note or chord depending on

R_Gol's icon

R_Gol

3月 31 2024 | 12:53 午後

is it possible to sustain the note as long mouse stay at the same note?

Source Audio's icon

Source Audio

3月 31 2024 | 12:56 午後

why not ?

but then you need to make the logic outside of poly.

And different way to apply adsr, using proper note on/off

note mono mode

R_Gol's icon

R_Gol

3月 31 2024 | 1:16 午後

something like this?

Main:

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

p_mallet5

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

Source Audio's icon

Source Audio

3月 31 2024 | 1:54 午後

no, you don't want curve and adsr both running.

remove curve and scale input level for adsr

you need no poly~ for a single voice

R_Gol's icon

R_Gol

4月 07 2024 | 7:04 午前

no sound is coming out when using the above patch/ poly

R_Gol's icon

R_Gol

4月 07 2024 | 7:50 午前

how can I sustain the note only if the mouse is clicked?

Source Audio's icon

Source Audio

4月 07 2024 | 8:20 午前

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

here one option, mouse click triggers note and enables input

no need for poly~ because it's mono voice

option 2, see what serves you better

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

R_Gol's icon

R_Gol

4月 07 2024 | 8:25 午前

Thanks! how can I do the same but without the mouse click? meaning that as long I'm with the mouse on a specific note (lets say 60) it will sustain the note. the moment I'm moving with the mouse to a different note (lets say 64) it will release the previous held note

Source Audio's icon

Source Audio

4月 07 2024 | 8:34 午前

it does so allready without any gates

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

remove red line to disable

mouse click - stops note

R_Gol's icon

R_Gol

4月 07 2024 | 8:40 午前

great! and in order to make it work as polyphonic I need to place the adsr~ inside a poly object?

Source Audio's icon

Source Audio

4月 07 2024 | 8:55 午前

how would you do this polyphonic if notes are sustaining till

next note gets triggered ?

makes no sense, unless you want a bit of crossfading

when notes change, then use 2 voices

R_Gol's icon

R_Gol

4月 07 2024 | 8:58 午前

I'm working with a screen sensor that can detect two hands. how can I incorporate the other hand in the playing? (we can look at it as if I am using two mouse instead of one

Source Audio's icon

Source Audio

4月 07 2024 | 9:03 午前

wholy crap, all this questions ???

why don't you try something yourself ?

duplicate everything for each hand

here 2 pictsliders as 2 hands simulatuion

allready have range 0 - 11 and 10 - 127

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

R_Gol's icon

R_Gol

4月 07 2024 | 9:04 午前

how would you do this polyphonic if notes are sustaining till

next note gets triggered ?

makes no sense, unless you want a bit of crossfading

when notes change, then use 2 voices

like this?

Main:

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

poly - p_pantonesadsr~

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

Source Audio's icon

Source Audio

4月 07 2024 | 10:28 午前

sorry, bur this gets a bit too chaotic for me to look at.

what are this multiple udpreceivers, and mixture of

some udp input and screen size ?

tame your 2x x/y input and use that example above, add a bit of pan at the end if you want.

this is my last take on this,

take it or leave it.

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

R_Gol's icon

R_Gol

4月 07 2024 | 10:46 午前

Thanks for you patch. I tried it with mouse but no sound is coming out

Edit: Its working, I just needed to move the pan ui object

R_Gol's icon

R_Gol

4月 07 2024 | 10:57 午前

what are this multiple udpreceivers, and mixture of

some udp input and screen size ?

Its for the data coming from a sensor that can detect two hands on the screen and their x and y position among other data

Roman Thilenius's icon

Roman Thilenius

4月 07 2024 | 11:00 午前

unless you use scripting to create new objects or connections at runtime, those nasty clicks usually arise at the domain transition from data to signal.

in this case (i havent checked) probably when the envelope is stopped and retriggered.

in many cases it is appropiate to interpolate numbers to signal domain using line~, but for an envelope you probably want to do something else. for example the "attack" shape could be generally bandlimited, or you could even use 2 poly voices for one logical voice, so that even in unisono mode the envelopes of successive note events can overlap a bit.

Source Audio's icon

Source Audio

4月 07 2024 | 11:11 午前

loadmess 0.5 to pan dials

R_Gol's icon

R_Gol

4月 07 2024 | 11:18 午前

When I'm releasing my hands from the screen a constant note is keep playing. I'm guessing is because some date is still passing?(the last data that was passed?)

R_Gol's icon

R_Gol

4月 07 2024 | 11:25 午前

ok I fixed it using split. the x position of the sensor is back to an offset number that sending the number 1. after the scale. I took it out using split

R_Gol's icon

R_Gol

4月 07 2024 | 11:42 午前

Ok the above not really helped.

What happened is that when I'm releasing my hand the x position is jumping to a constant number and causing the synth to play that note without stopping

Source Audio's icon

Source Audio

4月 07 2024 | 12:12 午後

then use hand off state to kill the note

R_Gol's icon

R_Gol

4月 07 2024 | 12:26 午後

This what I have try but there is still sound of it before killing it

Source Audio's icon

Source Audio

4月 07 2024 | 12:35 午後

you try wrong

R_Gol's icon

R_Gol

4月 07 2024 | 12:39 午後

True! I managed now!

Source Audio's icon

Source Audio

4月 07 2024 | 12:44 午後

this would be safe way to do so

delaying x a bit makes sure that gate closes before value jumps.

flush last note 250 ms later

R_Gol's icon

R_Gol

6月 03 2024 | 8:32 午前

How can I replace the behavior of the mouse in the below patch?

right now - when moving the mouse on screen notes are playing and when clicking the mouse - note is release.

I would like to do that as long the mouse is pushed and hold note is playing. When stop holding the mouse - note is release

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

Source Audio's icon

Source Audio

6月 03 2024 | 8:43 午前

R_Gol's icon

R_Gol

6月 03 2024 | 9:02 午前

working greats thanks!!

R_Gol's icon

R_Gol

8月 05 2024 | 7:14 午前

I have and addition to the above patch that should play a sound only one the two screens are outputting 1.

right now sound is coming out even when the condition is resulting in 0. Why is that?

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

Source Audio's icon

Source Audio

8月 05 2024 | 9:06 午前

you should post only part of the patch that should be fixed / looked at.

I have no time to follow all send- receives, and try to detect what you mean by 2 screens etc.

if you have 2 inputs from 2 screens and want only 1 of them to activate something ?

show where is that input and what should it do

R_Gol's icon

R_Gol

8月 05 2024 | 9:35 午前

I marked in yellow the part that send either 1 or 0 that should control if there is sound play or not

Here is the relevant patch:

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

Source Audio's icon

Source Audio

8月 05 2024 | 9:52 午前

all I can see is that if value is 0, then after 1 ms (pipe 1)

all held midi notes should get flushed.

I guess that works ok for that part,

but that does not affect what else you input into that audio patch

and at what time.

Maybe one could see it better if you remove all parts that are not in use

R_Gol's icon

R_Gol

8月 05 2024 | 10:09 午前

Here is a patch with only the usable objects. I hope this is more clear

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

Source Audio's icon

Source Audio

8月 05 2024 | 1:23 午後

I simplified your patch to see what is going on.

If I understand correctly :

if h1compare is LOWER than set threshold then play.

if NOT then disable play and mute sound (flush).

At same time that value sets loudness, which means if you activate sound it will be low level.

When that is fixed so in your non-working patch

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

Is that really what you want ?

R_Gol's icon

R_Gol

8月 05 2024 | 1:36 午後

Is that really what you want ?

That Exactly!

Thank you very much

R_Gol's icon

R_Gol

8月 05 2024 | 1:55 午後

can you please direct me how to make the option to move between different scale? make it more modular? for example to have the option to choose between 4 different scale and to choose the octave range and be able to make transformation of the base note etc

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

Source Audio's icon

Source Audio

8月 05 2024 | 2:17 午後

scales -

you can store lists of scales/notes that you want to use like

in your last patch, and dump it into notes coll.

to transpose, simply add + at notes coll output.

In your patch you play mono and flush previous note before entering new one.

That helps to avoid hanging notes when changing scales or transposing

R_Gol's icon

R_Gol

8月 05 2024 | 3:36 午後

How can I augmented the scale range to more then 1 octave without the need to add more numbers inside the coll scale object?

Roman Thilenius's icon

Roman Thilenius

8月 06 2024 | 12:00 午前

encode the incoming note number into two numbers, one for key and one for octave, rescale the key values, rebuild the note.

Source Audio's icon

Source Audio

8月 06 2024 | 6:34 午前

As first - you scale mouse range to 1 - 12.

at least it was so in your last patch.

Now with added scales - either adjust mouse range to number of notes in scale,

or extend scale to 12 notes

0 2 4 5 7 9 11 12 14 16 17 19 = 1 1/2 oct major scale

how you deal with key and octave transposition depends on what you want.

You did not mention anything about that.

maybe use third hand to shift octaves , ha ha ?

R_Gol's icon

R_Gol

8月 06 2024 | 8:24 午前

As first - you scale mouse range to 1 - 12.

I would like to make it modular like this:

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

so the base case is 1 octave of each chosen scale (this is already store in coll scales)

I would like to add a feature to manually select how many octave in the chosen scale and update automatically the mouse scale range.

Source Audio's icon

Source Audio

8月 06 2024 | 9:09 午前

then you also have to dump as many octaves into notes coll.

but you should NOT add 12 at end of scale !!!

1, 0 2 4 5 7 9 11 12; wrong !!!!

1, 0 2 4 5 7 9 11; OK !!!!

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

R_Gol's icon

R_Gol

8月 06 2024 | 9:23 午前

Thanks!! what is the use of the uzi 4 0 is for?

Source Audio's icon

Source Audio

8月 06 2024 | 9:27 午前

to count octaves and multiply scale

R_Gol's icon

R_Gol

8月 06 2024 | 12:43 午後

right now the lower note is 0 (+ octave offset) and it will play first note when input is o and last note when input is at the last index of scale note.

that is mean that when the mouse is at the most left hand side of screen the lowest note is the root (0 + octave offset) and when the mouse is at the most right side of screen the higher note is last note of scale.

how can I scale everything that middle point of screen will play the root note and the left side from screen will play lower note then root and left side from middle screen will play higher notes from root.

Hope this make sense

Source Audio's icon

Source Audio

8月 06 2024 | 4:01 午後

Why not ask that from the beginning, so that one can help you straight with what you want ?

You could change scale to notes calculation completely , now that you know how to do it.

or if you don't want to change that set offset so that it matches middle of the notes range.

for example if wished middle note is 43 and you had 4 octaves set,

then instead of adding 43 , add 2 octaves lower = 19.

have fun with odd octave numbers, and also check what to do with scale output

which is float and has no real midde.

R_Gol's icon

R_Gol

8月 06 2024 | 5:48 午後

Great thanks!!!