Open xtramo opened 4 years ago
I haven't been able to reproduce this problem. I just tested the code you posted on an Arduino UNO, and it worked fine.
The bank only changes the channel or the note number (depending on whether you're using CHANGE_CHANNEL
or CHANGE_ADDRESS
). It doesn't change the instrument.
Changing instruments is usually done by changing patches or programs using MIDI program change events.
You could use something like this:
MIDI_Controller.MIDI()->send(PROGRAM_CHANGE, channel, program);
// channel [1, 16] and program [0, 127]
Thanks for getting back to me. Please explain as Im using a Leonardo? how did you verify that this works if you didnt duplicate my setup? the usb is connected to the rasberry? How would I verify this if I wanted to test on a windows pc? I have fl studio on win 10.
90% of the code is the same, only the MIDI backend is different on Leonardo. All code has been tested on a Leonardo before.
MIDI is platform independent. I haven't tried Yoshimi, but I did confirm that the bank selector correctly changes the channel or address of the MIDI messages in question. You can confirm this by using a MIDI monitor on your PC or RPi.
If it doesn't change the instrument in Yoshimi, this is most likely a problem with the configuration in Yoshimi.
Im using your code to test and nothing happens?
What does "nothing happens" mean?
again thanks for the quick response. Im not a pro when it comes to these things just getting into this amazing tech. so let me explain from a layman perspective and maybe Im trying to do the wrong thing. When the synth is open I have managed to map a potentiometer to the volume control on the synth and can adjus this from the arduino. Now Im trying to 1. change the "bank"? if that swhat it is from default to say chorus, and then to change the instrument to a human voice and be able to use a button to increment through different banks and instruments , so when i use my arduino keypad it will then play those sounds.
this is the code Im using for the synth and arduino. Now I wanted to add the bank program, instrument change and got stuck.?
#include “MIDI_Controller.h” // Include the library
const int c = 60;
const uint8_t velocity = 0b1111111; // Maximum velocity (0b1111111 = 0x7F = 127)
const uint8_t addresses[3][4] = { // button keymap
{c+0, c-5, c+2, c+3},
{c+4, c+5, c+6, c+7},
{c+12, c+9, c+14, c+11},
};
ButtonMatrix<3, 4> buttonmatrix({7, 6,5}, {11, 10, 9, 8} , addresses, 1, velocity);
// Create a new instance of the class ‘Analog’, called ‘potentiometer’, on pin A0,
// that sends MIDI messages with controller 7 (channel volume) on channel 1
Analog potentiometer1(A0, MIDI_CC::Channel_Volume, 1);
// Create a new instance of the class ‘AnalogHiRes’, called ‘potentiometer’, on pin A1,
// that sends MIDI Pitch Bend messages on channel 1
AnalogHiRes potentiometer2(A1, 1);
// Create a new instance of the class ‘?’, called ‘potentiometer’, on pin A2,
// that sends ??? on channel 1 Reverb
Analog potentiometer3(A2, MIDI_CC::Reverb, 1);
// Create a new instance of the class ‘?’, called ‘potentiometer’, on pin A3,
// that sends ??? on channel 1 Echo
Analog potentiometer4(A3, MIDI_CC::Echo, 1);
void setup() {}
void loop() {
MIDI_Controller.refresh();
}
Hi,Im getting this error when trying the line you gave in your example code 07 :
MIDI_Controller.MIDI()->send(PROGRAM_CHANGE, [1, 16], [0, 127]); .07.BankSelectors:58:1: error: 'MIDI_Controller' does not name a type
On Tue, Jan 21, 2020 at 12:53 PM wayne ross wayross@gmail.com wrote:
again thanks for the quick response. Im not a pro when it comes to these things just getting into this amazing tech. so let me explain from a layman perspective and maybe Im trying to do the wrong thing. When the synth is open I have managed to map a potentiometer to the volume control on the synth and can adjus this from the arduino. Now Im trying to 1. change the "bank"? if that swhat it is from default to say chorus, and then to change the instrument to a human voice and be able to use a button to increment through different banks and instruments , so when i use my arduino keypad it will then play those sounds.
this is the code Im using for the synth and arduino. Now I wanted to add the bank program, instrument change and got stuck.?
include “MIDI_Controller.h” // Include the library
const int c = 60;
const uint8_t velocity = 0b1111111; // Maximum velocity (0b1111111 = 0x7F = 127) const uint8_t addresses[3][4] = { // button keymap {c+0, c-5, c+2, c+3}, {c+4, c+5, c+6, c+7}, {c+12, c+9, c+14, c+11}, };
ButtonMatrix<3, 4> buttonmatrix({7, 6,5}, {11, 10, 9, 8} , addresses, 1, velocity);
// Create a new instance of the class ‘Analog’, called ‘potentiometer’, on pin A0, // that sends MIDI messages with controller 7 (channel volume) on channel 1 Analog potentiometer1(A0, MIDI_CC::Channel_Volume, 1);
// Create a new instance of the class ‘AnalogHiRes’, called ‘potentiometer’, on pin A1, // that sends MIDI Pitch Bend messages on channel 1 AnalogHiRes potentiometer2(A1, 1);
// Create a new instance of the class ‘?’, called ‘potentiometer’, on pin A2, // that sends ??? on channel 1 Reverb Analog potentiometer3(A2, MIDI_CC::Reverb, 1);
// Create a new instance of the class ‘?’, called ‘potentiometer’, on pin A3, // that sends ??? on channel 1 Echo Analog potentiometer4(A3, MIDI_CC::Echo, 1);
void setup() {}
void loop() { MIDI_Controller.refresh(); }
On Tue, Jan 21, 2020 at 12:40 PM tttapa notifications@github.com wrote:
90% of the code is the same, only the MIDI backend is different on Leonardo. All code has been tested on a Leonardo before.
MIDI is platform independent. I haven't tried Yoshimi, but I did confirm that the bank selector correctly changes the channel or address of the MIDI messages in question. You can confirm this by using a MIDI monitor on your PC or RPi. If it doesn't change the instrument in Yoshimi, this is most likely a problem with the configuration in Yoshimi.
Im using your code to test and nothing happens?
What does "nothing happens" mean?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tttapa/MIDI_controller/issues/102?email_source=notifications&email_token=AOD2EDPJ654B53HI4PW3ZA3Q63GKZA5CNFSM4KJGJRVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJPJD3I#issuecomment-576623085, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOD2EDOTHT2LTLBPD26FL2DQ63GKZANCNFSM4KJGJRVA .
MIDI_Controller.MIDI()->send(PROGRAM_CHANGE, [1, 16], [0, 127]); .07.BankSelectors:58:1: error: 'MIDI_Controller' does not name a type
You have to use that code inside of a function. By [1, 16], I meant "any number from 1 to 16", it's not actual code.
Now Im trying to 1. change the "bank"? if that swhat it is from default to say chorus, and then to change the instrument to a human voice and be able to use a button to increment through different banks and instruments , so when i use my arduino keypad it will then play those sounds.
I don't think using a "MIDI Controller Bank" is what you're looking for. The voices and instruments are determined by the settings in Yoshimi, not by the notes sent by the MIDI Controller library.
You'll have to look through the documentation for Yoshimi to check if there are specific MIDI commands you can send to instruct it to change the instrument. Usually this is program change (see previous message) if there are less than 128 instruments, and a combination of MIDI bank select and program change if there are more instruments.
MIDI bank select is different from the banking features of the MIDI Controller library.
A MIDI Bank Select event selects one of 16,384 different banks. Each bank has 128 patches/programs/instruments that can be selected using a MIDI Program Change event.
The MIDI Controller banking feature changes the address or channel of the MIDI control elements. For example, if you have four volume potentiometers, they send on MIDI channels 1-4 if the first bank is selected, on channels 5-8 if the second bank is selected, channels 9-12 if the third bank is selected, and so on.
Hi Please can you send me the correct syntax to be able to select a bank and then a patches/programs/instruments- this is what Im looking for and not as a function but to be able to place this in the code I sent you .
On Tue, Jan 21, 2020 at 3:56 PM tttapa notifications@github.com wrote:
MIDI_Controller.MIDI()->send(PROGRAM_CHANGE, [1, 16], [0, 127]); .07.BankSelectors:58:1: error: 'MIDI_Controller' does not name a type
You have to use that code inside of a function. By [1, 16], I meant "any number from 1 to 16", it's not actual code.
Now Im trying to 1. change the "bank"? if that swhat it is from default to say chorus, and then to change the instrument to a human voice and be able to use a button to increment through different banks and instruments , so when i use my arduino keypad it will then play those sounds.
I don't think using a "MIDI Controller Bank" is what you're looking for. The voices and instruments are determined by the settings in Yoshimi, not by the notes sent by the MIDI Controller library.
You'll have to look through the documentation for Yoshimi to check if there are specific MIDI commands you can send to instruct it to change the instrument. Usually this is program change (see previous message) if there are less than 128 instruments, and a combination of MIDI bank select and program change if there are more instruments. MIDI bank select is different from the banking features of the MIDI Controller library.
A MIDI Bank Select event selects one of 16,384 different banks. Each bank has 128 patches/programs/instruments that can be selected using a MIDI Program Change event.
The MIDI Controller banking feature changes the address or channel of the MIDI control elements. For example, if you have four volume potentiometers, they send on MIDI channels 1-4 if the first bank is selected, on channels 5-8 if the second bank is selected, channels 9-12 if the third bank is selected, and so on.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tttapa/MIDI_controller/issues/102?email_source=notifications&email_token=AOD2EDL2D6X3D6FMUNMILYDQ635IJA5CNFSM4KJGJRVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJP2DWY#issuecomment-576692699, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOD2EDLGQFQBQCPJHY6WKFTQ635IJANCNFSM4KJGJRVA .
I have exams right now, I don't have time.
I already posted the code you need to change the program. Changing the banks is similar, but you'll have to do some research first, you can find a lot of information in the MIDI specs and probably in the Yoshimi documentation.
You'll then have to write code that decides when to change the instrument.
The Control Surface library has some of this built-in, like the Program Changer.
https://tttapa.github.io/Control-Surface-doc/Doxygen/d9/d7f/Program-Changer_8ino-example.html
please I have been looking really! ive got more than 100 forums/articles Ive looked everywhere and nothing helps Ive changed code tried you name it ! thats why I reached out to you. Im at the point where Ive just got no clue and all I need is that 1 or 2 lines of code that does the change - surely you have that - please
On Tue, Jan 21, 2020 at 6:16 PM tttapa notifications@github.com wrote:
I have exams right now, I don't have time.
I already posted the code you need to change the program. Changing the banks is similar, but you'll have to do some research first, you can find a lot of information in the MIDI specs and probably in the Yoshimi documentation.
You'll then have to write code that decides when to change the instrument.
The Control Surface library has some of this built-in, like the Program Changer.
https://tttapa.github.io/Control-Surface-doc/Doxygen/d9/d7f/Program-Changer_8ino-example.html
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tttapa/MIDI_controller/issues/102?email_source=notifications&email_token=AOD2EDIFHFS2UP3HM67UTWTQ64NUFA5CNFSM4KJGJRVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJQJ4WA#issuecomment-576757336, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOD2EDMNJFGYQSCP36BLIGDQ64NUFANCNFSM4KJGJRVA .
heads up the code you sent me now does work to a point! so excited! push button 3 works, it chooses the 3rd item in the 2nd row of the instruments, button 4 works some time on the 1st row but button 1 doesnt. but thats a huge start . How do I change the bank? yoshimi instruments are found under each bank: Root 5, bank N where N goes from 1 to 115
On Tue, Jan 21, 2020 at 6:40 PM wayne ross wayross@gmail.com wrote:
please I have been looking really! ive got more than 100 forums/articles Ive looked everywhere and nothing helps Ive changed code tried you name it ! thats why I reached out to you. Im at the point where Ive just got no clue and all I need is that 1 or 2 lines of code that does the change - surely you have that - please
On Tue, Jan 21, 2020 at 6:16 PM tttapa notifications@github.com wrote:
I have exams right now, I don't have time.
I already posted the code you need to change the program. Changing the banks is similar, but you'll have to do some research first, you can find a lot of information in the MIDI specs and probably in the Yoshimi documentation.
You'll then have to write code that decides when to change the instrument.
The Control Surface library has some of this built-in, like the Program Changer.
https://tttapa.github.io/Control-Surface-doc/Doxygen/d9/d7f/Program-Changer_8ino-example.html
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tttapa/MIDI_controller/issues/102?email_source=notifications&email_token=AOD2EDIFHFS2UP3HM67UTWTQ64NUFA5CNFSM4KJGJRVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJQJ4WA#issuecomment-576757336, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOD2EDMNJFGYQSCP36BLIGDQ64NUFANCNFSM4KJGJRVA .
my bad i figured out why it didnt play was because the instrument was missing. good luck with the exams
On Tue, Jan 21, 2020 at 7:34 PM wayne ross wayross@gmail.com wrote:
heads up the code you sent me now does work to a point! so excited! push button 3 works, it chooses the 3rd item in the 2nd row of the instruments, button 4 works some time on the 1st row but button 1 doesnt. but thats a huge start . How do I change the bank? yoshimi instruments are found under each bank: Root 5, bank N where N goes from 1 to 115
On Tue, Jan 21, 2020 at 6:40 PM wayne ross wayross@gmail.com wrote:
please I have been looking really! ive got more than 100 forums/articles Ive looked everywhere and nothing helps Ive changed code tried you name it ! thats why I reached out to you. Im at the point where Ive just got no clue and all I need is that 1 or 2 lines of code that does the change - surely you have that - please
On Tue, Jan 21, 2020 at 6:16 PM tttapa notifications@github.com wrote:
I have exams right now, I don't have time.
I already posted the code you need to change the program. Changing the banks is similar, but you'll have to do some research first, you can find a lot of information in the MIDI specs and probably in the Yoshimi documentation.
You'll then have to write code that decides when to change the instrument.
The Control Surface library has some of this built-in, like the Program Changer.
https://tttapa.github.io/Control-Surface-doc/Doxygen/d9/d7f/Program-Changer_8ino-example.html
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tttapa/MIDI_controller/issues/102?email_source=notifications&email_token=AOD2EDIFHFS2UP3HM67UTWTQ64NUFA5CNFSM4KJGJRVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJQJ4WA#issuecomment-576757336, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOD2EDMNJFGYQSCP36BLIGDQ64NUFANCNFSM4KJGJRVA .
Description of the problem or question
Using Arduino leonrado connected via usb to pi rasberry 4 to play the yoshimi synth. Im using your library and have successfully used the arduino to play on the yoshimi synth. However I cant seem to get the midi to change the instruments on yoshimi? Im using your code to test and nothing happens? Ex.07.BankSelectors
Steps to reproduce the problem
Hardware
Arduino board: ? , Arduino Leonardo, pi rasberry 4 Schematic: ? using your example
Software versions: pi rasbery rasbian latest , arduino 1.8.10
MIDI Controller library: ? 3.1.1 Arduino IDE: ?1.8.10 Operating System: ? Windows, , ?
Operating System version: ? 10, and rasbian, arduino
(Encoder library): ? 1.4.1 ?
(MIDIUSB library): ? 1.0.3 ?
Settings in the IDE
Full code
Steps taken to try to diagnose or solve the problem
? Tried the MIDI debug mode, used a MIDI monitor, ... ? Im new to this how would I test as he usb is connected to the pi now and not the pc?
The goal of your project and aditional information
To play the Yoshimi via the arduino buttons and sensors.