Hi, was wondering if you can trigger samples by using the keys on my laptop rather than a midi controller?
Thanks.
Hi, was wondering if you can trigger samples by using the keys on my laptop rather than a midi controller?
Thanks.
The Cabbage keyboard component can be triggered with keys. Bring the plugin window into focus (in the Cabbage IDE) and try hitting āaā for example. This will not work in all hosts. Most host handle keystrokes themselves.
Thanks Rory, unfortunately im not sure what the IDE window is lol
IDE is the instrument window? how do I bring the plugin window into focus?
Thanks
I just mean the plugin instrument window when you run it in Cabbage. If it doesnāt have focus, the keystrokes will end up passing to the text editor instead.
Ok thanks. Iāll just let you know my idea for thisā¦my plan is to have an interface that when you play numbers 1-7 on the keyboard a sample will play containing a chordā¦I also want to trigger samples that are just midi notes triggered by letters on the keyboard that I would like specifically assign (n,j,i,m,k,o,l,p). and hopefully later assign knobs and sliders that will have effects that will affect the midi note samples(reverb, chorus etc.) is this possible do you think?
Cabbage doesnāt currently allow custom mapping of key strokes, so Iām not sure how far you will get with that. Do you need a GUI? If not you could just do this with plain old Csound from the command line.
Oh, you could also use the texteditor
widget, which you can then parse for keystrokes. That might be the best actuallyā¦
I tried using the text editor example on the page but it crashes for meā¦its for an assignment for which im basing off an old p5 coding assignmentā¦but I seem to having issues with going about itā¦I think I might just try get a new idea altogether thoughā¦thanks for your replies Rory.
Donāt give up so easy Chris! Try this instrument. Itās only set up to trigger notes with 1 and 2, but it should get you started. You have to hit enter after you type the number into the text editor.
<Cabbage>
form caption("Untitled") size(400, 300), guiMode("queue") pluginId("def1")
texteditor bounds(60, 16, 248, 27) channel("textEditor1"), text("")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d
</CsOptions>
<CsInstruments>
; Initialize the global variables.
ksmps = 32
nchnls = 2
0dbfs = 1
instr 1
SKey, kTrig cabbageGetValue "textEditor1"
cabbageSet kTrig, "textEditor1", strcpyk("text(\"\")")
if kTrig == 1 && strcmpk(SKey, "1") == 0 then
event "i", 2, 0, 4, 60
elseif kTrig == 1 && strcmpk(SKey, "2") == 0 then
event "i", 2, 0, 4, 62
endif
endin
instr 2
a1 expon 1, p3, 0.01
a2 oscili 1, cpsmidinn(p4)
outs a2, a2
endin
</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
;starts instrument 1 and runs it for a week
i1 0 [60*60*24*7]
</CsScore>
</CsoundSynthesizer>
Thank you Rory, Iāve decided im going to try use the keyboard as standard. I now have a sample playing from the keyboard when I press a, s, d etcā¦but all text keys are assigned to the 1 sampleā¦how do i assign seperate keys to seperate samples?
Thanks
Iām not sure I follow. I think you might need to post your .csd?
3.csd (3.1 KB)
Ok i think its uploadedā¦each button needs to be able to trigger a sample, preferably using the keys(which are indicated by the small letters on the button). Each button will be a sample midi note corresponding to the pitchā¦does that make sense?
Sorry, I fail to see what youāre doing here, and the .csd file wonāt compile.
Iām not sure what you meant by this.
I canāt see how that is in the .csd you posted? Maybe you posted the wrong one?
I have changed from this idea with the keyboardā¦i now have an array of clickable buttons in the ā3.csdā I sent? C-D-E-F-G-A-B-C will be the pitch of the samplesā¦the smaller letters are the buttons of my text keyboard that will trigger them.
3.csd (2.2 KB)
Ok, there are a lot of issues here. Have you gone over the video tutorials. It seems that you might need to do a slight crash course on Csound and Cabbage?
There was one that seemed fitting where you used double bass samples, and i was going to base it off that but the files just wouldnt play for meā¦ill have another look though.
Thanks Rory
Let me know which ones donāt work for you, or post them here so I can take a look.
Of all the languages in the world, Iād say Csound is the hardest one to copy code for if you donāt have a good grounding in Csound. In this instrument I was being clever in using a single instrument, and starting it 8 times, but for the beginner this is rather complex. If you just want a button to trigger a sample, just do something like this:
<Cabbage>
form caption("Untitled") size(400, 300), guiMode("queue") pluginId("def1")
button bounds(10, 10, 100, 50), channel("play1")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d
</CsOptions>
<CsInstruments>
; Initialize the global variables.
ksmps = 32
nchnls = 2
0dbfs = 1
instr 1
kButton1, kTrig1 cabbageGetValue "play1"
if kTrig1 == 1 then
event "i", 2, 0, 2
endif
endin
instr 2
a1 diskin "mySample.wav", 1, 0, 0
outs a1, a1
endin
</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
;starts instrument 1 and runs it for a week
i1 0 [60*60*24*7]
</CsScore>
</CsoundSynthesizer>
Thatās about as simple as it gets, but I think you would best served starting with something simple.
ok thank you that worked
is it now possible to trigger that sample with the letter a for example??