-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create 4 midi banks controlled by 1 potentiometer #111
Comments
This is not something MIDI_controller supports. Using Control Surface, you could do something like this: #include <Control_Surface.h>
USBMIDI_Interface midi;
// Transpose settings [0, +1, +2, +3], with offsets of 16 semitones between them
Transposer<0, +3> transposer {16};
// Select the transposition using a potentiometer on pin A0
PotSelector<4> selector {transposer, A0};
Bankable::NoteButton buttons[] {
{transposer, 2, 45}, // transposer, pin, note number
{transposer, 3, 46}, // transposer, pin, note number
{transposer, 4, 47}, // transposer, pin, note number
// ...
};
void setup() {
Control_Surface.begin();
}
void loop() {
Control_Surface.loop();
} The #include <Control_Surface.h>
template <setting_t N>
class PotSelector : public GenericSelector<N> {
public:
PotSelector(Selectable<N> &selectable, pin_t analogPin)
: GenericSelector<N>(selectable, {}), analogInput(analogPin) {}
void begin() override {
analogInput.resetToCurrentValue();
this->set(getPosition());
}
void update() override {
if (analogInput.update()) {
setting_t pos = getPosition();
if (pos != this->get())
this->set(pos);
}
}
private:
setting_t getPosition() const {
return N * analogInput.getValue() / (1 << Precision);
}
private:
constexpr static const uint8_t Precision = 7;
FilteredAnalog<Precision> analogInput;
}; If the buttons are connected through multiplexers, you could do something like this: CD74HC4051 mux1 {6, {4, 3, 2}}; // input pin, {address pins}
CD74HC4051 mux2 {7, {4, 3, 2}}; // input pin, {address pins}
Bankable::NoteButton buttons[] {
{transposer, mux1.pin(0), 45}, // transposer, pin, note number
{transposer, mux1.pin(1), 46},
// ...
{transposer, mux1.pin(7), 52},
{transposer, mux2.pin(0), 53},
// ...
{transposer, mux2.pin(7), 61},
}; To use an encoder later, you can use the Use the The MIDI bank select function selects banks of patches and instrument voices for synthesizers etc., it's not related to banks in the context of MIDI controllers. |
does this look like correct control-surface code for having 16 buttons with my 4 octave semitone banks, and 4 CC potientiometers? im waiting on my 16x1 mux to test. but does this look like it will work? #include <Control_Surface.h> CD74HC4067 mux1 = { 6, {2, 3, 4, 5} }; Transposer<-12, +12> transposer; Bankable::NoteButton buttons[] { CCPotentiometer potentiometers[] = { void setup() { void loop() { |
I have a working code and midi device for 16 buttons and 5 potentiometers. I want to use one of these potentiometers to choose between 4 banks notes. The notes need to be programmed into each bank, probably an array. The first bank is the one i got working already obviously, the only one, and it holds note numbers 45-60(c3-c4). i want bank2 to be 61-76, 3 to be 77-92, and 4 to be 92-107. This first bank is in an array already. I have this accomplished on an arduino uno using 2 8x1 MUX and a 2x1 MUX to act as the 4th selection bit to cover all 16 buttons. MUX1 is arduino pin 6, MUX2 is arduino pin 7, and MUX1 select pins go to pins 2,3,4 on arduino. A goes to 4, B goes to 3, C goes to 2. 2x1 MUX select is pin 5 and output is pin 8.
Arduino Uno (0-13)(A0-A5)
Using ddiakopoulos/hiduino flashed firmware. arduino is now native usb. I can use arduino as ISP(seperate arduino as programmer) to still upload sketches.)
using Midi.h, controller.h, and <midi_controller.h> (can use control_surface if forced to.)
Arduino 1.8.13
Windows 10 20h2 64 bit
(The variables defined after the pots are defined are my attempts to try to make these banks work, they werent in the original working code. Its to give you guys an idea of what im trying to do. Take particular note of the getKey() function. that function is supposed to select the right note to play based on which button i have pressed(the variable pressed), and which bank im in which is determined by the position of A5. I want to use a click rotary encoder but dont have one so this pot is for testing purposes for now. The function is also supposed to map pot values 1-255 to 0, 256-512 to 1, 513-768 to bank 2, and 769-1023 to bank 3. This is supposed to simulate the encoder, although im not sure its needed. Next, note where i actually send the NoteOn command in the updateMuxButtons() function. (case 0) i Have added the "+ getKey(i)" there in an attempt to play the correct note based on which bank im in determined by all the above. Finally, you can take note of the bankSelect() function at the bottom, which may be a better solution overall. Right now i have the program variable set to 0 but im not sure this is correct. Ideally it needs to store all 64 notes in an array and know which one to pick based on which bank im in and which button i press. Can anyone help me?
MidiOx as monitor
This is my capstone project for college and i appreciate all the help i can get! I hope this issue is understandable and solvable, im not seeing anywhere else of people using a pot as a bank selector. Short Summary of goal: 16 buttons, 4 banks (covers 64 of 88 keys) and 4 regular FX pots. Thanks guys!
The text was updated successfully, but these errors were encountered: