Cabbage Logo
Back to Cabbage Site

Midi inexplicably affecting audio

duck.csd (3.2 KB)

As far as I can tell this should not affect audio, but when I put it on a track and hit play, when I hit a note there’s a weird effect that happens, sounds all distorted and stuff.

It’s most likely because each MIDI note will trigger instrument 1. This is an effect right? In that case don’t use -+rtmidi=null -M0, just use -n -d. When you create a ‘new effect’ file in Cabbage it sets the correct flags. With the MIDI flags set each MIDI channel will trigger the corresponding instrument. Notes on MIDI channel 1 will trigger instr 1, MIDI channel 2, instr 2 and so on. If you ever wish to use MIDI, AND have an instrument running all the time, use a higher instrument number like 100, which is well outside the number of available MIDI channels. :+1:

It’s a midi effect, so when the button is on I want it to trigger the envelope with midi, and when it’s off I want it to just be an auto ducker.

When I have it in midi trigger mode there’s this weird distorted transient, and in audio mode the midi causes the audio to spike, even with an instrument number of 999.

duck.csd (3.3 KB)

The problem with the original was that on each MIDI note you would have several instances on instr 1 working. I assume this is not the intended behaviour?

No, I don’t think so. Why would that be the result?

I assume the solution is to use the event opcode?

I mean that one instance is always running, while the other instances will play over it. But honestly, I haven’t had a chance to look at the code in much detail. I might have time tomorrow or the day after.

Oh that makes sense! Thank you

Nah nvm I can’t figure it out. I don’t get why the midi is affecting the audio when all I’m trying to do is check whether or not the midi is equal to 0. How do I make it so the midi doesn’t keep starting new instances?

Okay so I figured out a solution. One thing that’s puzzling me though is the release for transegr is not working correctly. It does not always reach 0, especially on shorter release times. Why is that?

duck.csd (3.4 KB)

Figured it out. So for anyone else having this problem

  1. Use massign to send midi to specific instruments that you want to trigger and global variables within those instruments if you want to use the variables in other instruments
  2. Make sure if you have things in the midi triggered instruments that have to happen after a noteoff that you have the instrument running in CsScore.

test.csd (1.3 KB)

Great that you figure it out :+1: And thanks for letting us know the solution.