Cabbage Logo
Back to Cabbage Site

--midi-key-oct Doesn't seem to be working?


I am making an attempt at designing my own synth for senior project. I am having trouble getting my MIDI keyboard set up for testing. I would like my Mac’s keyboard to map to the keyboard on-screen but regardless of the --midi-key-oct flag being set to 4, my Mac always seems to map to the 1st octave. So the letter A on my keyboard is C1, even though the CsOptions section specifies it should be C4. Pictured below is my code with the CsOptions. Thanks in advance for the help! This platform has been fantastic for getting acclimated with Csound.

I think there is some confusion here. --midi-key-oct doesn’t set the octave. In fact I’m not sure what it does, but what you’re looking for is the keyboard identifier keypressBaseOctave(val)

keypressBaseOctave(val) This sets the base note that is played when you press a key on the computer keyboard. The value must be between 0 and 10. The default is 3 that means the C note of the third MIDI octave (C1 key on the widget keyboard, if you don’t change the default ‘middleC’ value).

And you might want midieC too:

middleC(val) Sets the octave number that will appear on the middle C key. By default this is set to 3.

Where is your school? Using Csound for a senior project sounds far more interesting than anything I ever did in school :slight_smile:


The keypressBaseOctave identifier worked! The code keypressBaseOctave(6) was what put me at C4. Thank you so much for replying to my post.

I attend Saint Joseph’s University in Philadelphia, Pennsylvania. Before I started studying at college, my passion was in music production. My father and I had a conversation about realistic expectations and from there I switched to a Computer Science major with a promise to return to music one day. Fortunately, now my senior capstone is allowing me the opportunity to explore sound synthesis at a level I never imagined.

Again, thank you for making CSound so accessible. When I started the semester, I was going crazy wondering how I was going to get acclimated with this language I’d never seen. Now I see the light at the end of the tunnel :joy:

Best Regards,

Brendan Hannum

Ah when you said senior project I assumed it was a school project rather than a university project. That’s great that you get a chance to pursue some audio stuff as part of the degree. It should offer a nice introduction to the world of audio programming. It’s quite an interesting language. What language have your studies focused on so far, C/C++? Csound must look pretty strange in comparison :slight_smile:

It’s been great for exploring the subject of audio programming, truly. I actually started with Java! That’s what my first three core CompSci classes were based off of. Then, my algorithms course introduced C++, and I just finished a Web Development course last semester which gave me Javascript/HTML/CSS. You’re right, CSound is so different syntactically! But I’m determined to understand it, well, at least some parts :sweat_smile:

Sounds good. And you know that there is a JS wrapper for Csound too? So you can embed your instrument directly into your websites. It’s really nice.