Page 1 of 1
Need example of a MIDI Control Change
Posted: Sat Oct 03, 2015 4:00 am
by rbytes
I have been scouring the web to see how I could add a reverb setting to the Synthesizer in the smartBASIC Examples folder.
I have no problem sending notes or changing the instrument, but so far any attempt to turn reverb on or off or set the amount causes the program to quit with an error.
From the manual:
NOTES MIDI T, CMD,A,B
sends MIDI command to device, where [t] - track number (0..15), [cmd] - MIDI command, [a], - command parameters (description of MIDI commands is out of scope of this manual).
I found the attached chart showing the MIDI CC commands, and have tried a number of different ways to express that data in
the NOTES MIDI command. First I tried:
NOTES MIDI 0,176,91,127
But then I wondered if the CCs from 176 to 191 were already addressing specific tracks. In that case, I wouldn't use the 0.
So then I tried:
NOTES MIDI 176,91,127
No luck there either. If I can get just one example of a command that works, it would open the door to adding others, such as chorus, portamento, etc.
Re: Need example of a MIDI Control Change
Posted: Sat Oct 03, 2015 5:04 am
by Mr. Kibernetik
In your table the "Command" like 176-191 is a combined value. That is why it is specified as a range from 176 to 191.
It consists of a command (higher byte) and a channel (lower byte).
So, 176 means hexadecimal 0xB0, where higher byte B is a command (decimal 11) and lower byte 0 is a channel.
191 means 0xBF where B is a command (decimal 11) and F is a channel (decimal 15).
If to take first row in your table, we have "Data Byte 1" is 1 and "Data Byte 2" from 0 to 127.
In smart BASIC it will be written as:
NOTES MIDI 0, 11, 1, 127
0 - channel 0
11 - command B
1 - data byte 1
127 - data byte 2
or in a complete code example something like:
NOTES MIDI 0, 9, 60, 127 ' play C4 note
NOTES MIDI 0, 11, 1, 127 ' apply Modulation control change command
PAUSE 1
Regarding reverberation, I am not a music expert in any way, also I have no idea which of MIDI commands are implemented in Apple devices. So I cannot point out how to implement reverberation in your commands. I can suggest these links to check:
http://www.jimmenard.com/midi_ref.html
http://www.midi.org/techspecs/midimessages.php
Re: Need example of a MIDI Control Change
Posted: Sat Oct 03, 2015 5:48 am
by rbytes
Thanks for your answer. It was very helpful.
I tried using MIDI commands with this new knowledge, and I did get one to work - modulation - command 1. It was very strong at a setting of 127. Each time I made a program (instrument) change the effect disappeared, so I had to send it again. I also tried sending commands 91 (reverb) and 93 (chorus), but did not hear any change. Perhaps Apple did not Implement them. Tomorrow I will try a couple more (sustain, portamento) and post the results here.
I also reworked the synthesizer to get a full-width two octave keyboard, and added some pitch shift buttons (half tone, octave). I will post it soon.
Thanks again, Mr.K!
Re: Need example of a MIDI Control Change
Posted: Sun Oct 04, 2015 10:08 pm
by rbytes
I can now send MIDI CC commands to turn these effects on and off for each MIDI channel:
Sustain
Portamento
Tremolo
I can also set the amount of Portamento and Tremolo, and I can set each channel's volume.
But no luck with any other effects. Reverb and Chorus don't work, even though I formatted their commands exactly the same way, changing only the control number, which I confirmed from several MIDI references. It seems odd that Apple doesn't let smartBASIC access these effects. There are many synthesizer apps now that can, but they were likely developed with xCode. I would appreciate it, Mr. K., if you could get any information from Apple or other developers about any way to access these effects from smartBASIC.
Re: Need example of a MIDI Control Change
Posted: Sun Oct 04, 2015 10:15 pm
by Mr. Kibernetik
As far as I know, Apple implemented General MIDI v1. But reverb effect belongs to General MIDI v2.
Are you sure other apps implement reverb effect using MIDI interface and not by some other kind of wave manipulation?
Re: Need example of a MIDI Control Change
Posted: Mon Oct 05, 2015 5:57 pm
by rbytes
I'm not sure. I just assumed that Apple would provide basic effects that would at least be equivalent to those on a $30 sound card, but maybe not. I hope that you might have better access to them, to get this information.
Anyway, I am posting Synthesizer V2 today, including all of the effects that I have been able to implement.