Forums > MaxMSP

looking for an object that can mix mtof signals or cycle signals

June 22, 2009 | 8:17 pm


I’m working on a midi patch which can take a signal from the keyboard, and creates a wave signal and sends it to the output(depending on which key is pressed, the output is sent to a different channel(i have 8 channels since i presonus firepod)..

however when i have 2 signals sent from the same channel, the waves are not added properly, which causes a distorted, wavy effect on the output signal..

i attached the patch for your convenience, please let me know if you know any objects or patches that might do add the waves.


Sai C.

June 22, 2009 | 8:44 pm

I didn’t check your patch but just keep in mind that two full-scale audio signals will distort because 1 + 1 = 2, and 1 is the clipping point.

The simple solution would be to use something like gain~ on each signal that is going to the output. That way you can manually mix as you see fit.

If you know that all of the signals going to the output will be between -1 and 1 then simply divide the amplitude of the output by the number of signals that are going there. the /~ object is good for this or though multiplying by the reciprocal [*~] might be more efficient… I believe they are more or less the same if the divisor is a static number.

Here is a simple patch-

– Pasted Max Patch, click to expand. –

edit: spelling is hard

June 22, 2009 | 9:11 pm

You need to scale the output to stop the distortion. The [dac~] works with signals in the -1 to 1 range so if you send it a signal that goes outside of this range (as you are doing when you press more than one key which is routed to the same channel) then the distortion occurs. Here’s a modified version of your "midi21" subpatch which you might want to have a look at, it might not be perfect for what you intended but I hope it shows a simpler way of doing what you are trying to achieve. Also you might want to read the tutorials on the [poly~] object as using this would be much easier than duplicating your [patcher] multiple times.


– Pasted Max Patch, click to expand. –
June 23, 2009 | 3:32 pm

Thanks for your help, i did the scaling and it works really well.. but not so well for the notes that have a lower frequency, they still have an oscillation effect.

the distance between these frequencies is about 3-6 hz (21hz, 23, 24hz etc 21 is the lowest frequency), is there any way for this effect to be fixed? or is it an effect of have 2 phazes so close together on 1 speaker?

thanks for your help

Sai C.

June 23, 2009 | 3:51 pm

Frequencies this close (within a few Hz) will exhibit beat frequencies, read about it on wikipedia. There’s nothing you can do to "fix" this in your patch.


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