Cabbage Logo
Back to Cabbage Site

How to put Cabbage always active (resolved)

Hi,

I would like to make a drone synthesizer, but I don’t understand how put Cabbage always active:
the amplitude of signal is activated by p5 (or midi keyboard) but if I comment the relative flags (p4 and p5) and I write 1 for oscili amplitude, the audio is activated yet by the midi Keyboard…
the freq is selected by:

if(iexte == 0) then
; external, the MIDI notes numbers and the Pitch-Bender values (+-12 semitones range) are releveated and converted in cps for oscili
kmidi cpsmidib 12    
else
; internal
kmidi = 440
endif

a1 oscili .1, kmidi, 1
outs a1, a1

…does not change anything if I write (i1 0 5000)…

can anyone help me?

R

An i-statement in the score will turn on your instrument and keep it running for as along as you like. i1 0 5000 should work, but don’t forget to pass it the required p-fields. The basic instrument template that Cabbage creates when you hit ‘New Instrument’ looks like this:

instr 1
kEnv madsr .1, .2, .6, .4
aOut vco2 p5, p4
outs aOut*kEnv, aOut*kEnv
endin

It gets triggered when you press the keyboard, and the keyboards pitch and amplitude get passed to variables p4 and p5. This is because of what is set in the . If however, we want to have it play the moment the synth is created we could use a score statement like this:

i1 0 10000 1 220

If we only wrote i1 0 10000 we wouldn’t hear any audio because both amplitude(p5) and frequency(p4) would be 0.

Hi,

thanks for reply. Please help me to understand one thing:

I would like to make a GUI selection for the realtime of my synth. If button == 0 the frequency is fixed else the frequency is set by MIDI keyboard; in both selections the amplitude is fix to 1.
I made two examples: the first has the frequency set in the score (p4). The second would be what I would do, but it does not work.
What I wrong? :cold_sweat:

Thanks…

1_Score.csd (630 Bytes)
2_Score_Or_Ext.csd (785 Bytes)

R

Hi,

Do you want it to be polyphonic? Do you want to kill sounding instruments on a button change? Do you want to kill sounding instruments on a midi key release?

There is something that can be said already:

  1. You need an always-on instrument to check for a change in the button.
  2. That instrument can’t be the one receiving the Midi note because when you release the key, you also kill that instrument.

Hi,

thanks for your reply.

In the flag section, the -M is for the realtime MIDI: my instrument gets informations by this flag. If I make one always active instrument, without MIDI control, i don’t write this flag in my projrect. I write the classic [i1 0 3600] in the score section and my instrument is turned on immediatly, (oscili with frequency and amplitude fixed). In the GUI section is present one button, and the instrument (since it is already active), reads his state ONLY at startup. If you wanted to constantly re-read their status, I have to create an algorithm kgoto or loop… and up to this point, everything is ok.

I don’t understand how to realize one REALtime/NON realtime project based on the state of a button:
If I write -M flag, this instrument is ONLY MIDI controlled. If I don’t write this flag, this instrument is controlled ONLY by the score…
Is possible to realize?

R

What you are trying to do is of course possible. I can prepare an example for you but it will not be till tomorrow as I’m pressed for time today.

I understand the realtime vs non-realtime thing Ivan, but there are a couple of questions (see my previous reply) that you need to answer first because they can condition your code. For example, my code is polyphonic. If you need it to be monophonic, the code would need to be different.

Anyway, here’s my take on the subject. I don’t know if that is the exact behavior you wanted in your instrument. Feel free to ask me anything. (Warning: I didn’t test the code properly!).

R.csd (881 Bytes)

Hi,

Goal centered! I never imagined to turn the two instruments from the score and decide through the instrument 1 to turn on/off the main instrument (with turnoff and event “i”)…

Many thanks for this support Guillermo… Thanks a lot!

R