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

saichaitanya88's icon

hi

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.

Thanks

Sincerely,
Sai C.

Exit Only's icon

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-

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

edit: spelling is hard

Luke Hall's icon

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.

lh

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

saichaitanya88's icon

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

Sincerely,
Sai C.

Luke Hall's icon

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.

lh