Trying to get MIDI into Csound

I’ve looked at the examples for cpsmidi and ampmidi but I’m still having trouble getting my code to work. I’m also getting an error with the line that defines k1. Thanks in advance!

Hi!

Have a look at the linen opcode: https://csound.com/manual/linen

  • the second, third and fourth parameter must be i-variables.

midic7 works also at init-time, you can change your kAttack etc to iAttack etc. Of course then the values of the according controllers are read into these parameters only when the instrument is started.

Looks like you are using CsoundQt. To get started, I suggest to use CsoundQt’s internal MIDI (Configure-> Realtime MIDI, choose your input device, uncheck Csound MIDI modules). Try “Test Audio Setup” on the same page in Configure dialog and test if you see any MIDI data (like CC ) coming in.

Greetings,
tarmo

Kontakt Liam via The Csound Community (<noreply@forum.csound.com>) kirjutas kuupäeval E, 7. oktoober 2024 kell 07:21:

1 Like

Hi Liam, welcome to the forum. :+1: The linen opcode takes i-rate parameters. In fact, almost all of the time based envelope opcodes take i-rate parameters because the duration of each segment needs to be fixed when the instrument is started. If you change kAttack, kDecay, etc, to iAttack, iDecay, etc, then you will no longer get any errors. Btw, it’s probably better to post the entire example, or upload the .csd file rather than paste an image of it :slight_smile:

1 Like

Thanks Rory!