Hi there,
Let's say I have Attach, Decay, Sustain, Release which normally would use 4 pots. Is the a way to use 4 buttons but only 1 pot to change the value? Is there a way to pass the CC number of each button to the pot?
Hi there,
Let's say I have Attach, Decay, Sustain, Release which normally would use 4 pots. Is the a way to use 4 buttons but only 1 pot to change the value? Is there a way to pass the CC number of each button to the pot?
I'm not entirely sure what you're asking. Are you trying to send a CC (Control Change?) number to a potentiometer? Please share an annotated schematic showing how you plan to connect everything, along with links to technical information for the potentiometer that will receive these signals. Also, could you clarify what you mean by "CC number"? I assume we're not talking about a credit card here.
assuming the profile is controlled digitally, the parameters can be selected, some how, the pot adjusted and the digital setting captured using an analogRead().
presumably you don't what to sequence thru settings with each press of a button. after pressing some button after the last parameter, does the pot not represent the first parameter again, after being adjusted for the last parameter. So 2 buttons once to sequence thru the parameter and a 2nd button to capture the setting
My bad for not being clear in my post. I’m using the Control Surface library to build a MIDI controller to control the soft synth Synclavier V by Arturia, a replica of the Synclavier.
I know how to build a controller using upwards of 40 potentiometers to control the parameters but I’d like to design it to copy the original keyboard which has 128 red buttons but only 1 knob to change the value of the parameters.
Normaly, each pot would have a Control Change number (CC) to control a different function but in the original design, you use buttons to select the functions and 1 knob to change the value.
I can assign every button a CC number I I need a way to pass it along to the pot to change the value.
Here a picture of the original keyboard to give you an idea:
CCButton button[] = {
{6, {92, CHANNEL_1}}, // 0x5C
{7, {93, CHANNEL_1}}, // 0x5D
};
Where as the first number is pin as the second is the CC number. Is there a way to pass the CC number to a pot:
CCPotentiometer potentiometers;
{A1, 0x07}, // CC07 (Analog pin, Controller number)
The author would be the one to ask @PieterP. Outside of Control Surface i can think of ways to achieve this, i have examples for that. But using Control Surface i am not sure, although i suspect something for it already exists.
Either use banks or use the CCPotentiometer::setAddress
method.
This is my code so far:
#include <Control_Surface.h>
#include <AH/Hardware/ExtendedInputOutput/SPIShiftRegisterOut.hpp>
using namespace ExtIO; // Bring the ExtIO pin functions into your sketch
USBMIDI_Interface usbmidi;
//Instantiate 1 Shift Registers
SPIShiftRegisterOut<16> sreg {
SPI, // SPI interface to use
10, // Latch pin (ST_CP)
MSBFIRST, // Bit order
};
Bank<12> bank(1); // A bank with one channels, and 2 bank settings
//*** MUX 1 ***
//Instantiate 74HC4067 Digital multiplexer
CD74HC4067 mux1 ={4, {0,1,2,3} };
//*** PARTIAL SELECT***
Bankable::CCButton partial_Sel[] {
{bank, mux1.pin(15), {30, CHANNEL_1}},
{bank, mux1.pin(14), {31, CHANNEL_1}},
{bank, mux1.pin(13), {32, CHANNEL_1}},
{bank, mux1.pin(12), {33, CHANNEL_1}},
{bank, mux1.pin(11), {34, CHANNEL_1}},
{bank, mux1.pin(10), {35, CHANNEL_1}},
{bank, mux1.pin(9), {36, CHANNEL_1}},
{bank, mux1.pin(8), {37, CHANNEL_1}},
{bank, mux1.pin(7), {38, CHANNEL_1}},
{bank, mux1.pin(6), {39, CHANNEL_1}},
{bank, mux1.pin(5), {40, CHANNEL_1}},
{bank, mux1.pin(4), {41, CHANNEL_1}},
{bank, mux1.pin(3), {42, CHANNEL_1}},
{bank, mux1.pin(2), {43, CHANNEL_1}},
{bank, mux1.pin(1), {44, CHANNEL_1}},
{bank, mux1.pin(0), {45, CHANNEL_1}},
};
//*** MUX 2 ***
//Instantiate 74HC4067 Digital multiplexer
CD74HC4067 mux2 ={9, {5,6,7,8} };
//*** FUNCTION BUTTONS***
Bankable::CCButtonLatched<12> partial[] {
{bank, mux2.pin(15), {50, CHANNEL_1}},
{bank, mux2.pin(14), {51, CHANNEL_1}},
{bank, mux2.pin(13), {52, CHANNEL_1}},
{bank, mux2.pin(12), {53, CHANNEL_1}},
{bank, mux2.pin(11), {54, CHANNEL_1}},
{bank, mux2.pin(10), {55, CHANNEL_1}},
{bank, mux2.pin(9), {56, CHANNEL_1}},
{bank, mux2.pin(8), {57, CHANNEL_1}},
{bank, mux2.pin(7), {58, CHANNEL_1}},
{bank, mux2.pin(6), {59, CHANNEL_1}},
{bank, mux2.pin(5), {60, CHANNEL_1}},
{bank, mux2.pin(4), {61, CHANNEL_1}},
{bank, mux2.pin(3), {62, CHANNEL_1}},
{bank, mux2.pin(2), {63, CHANNEL_1}},
{bank, mux2.pin(1), {64, CHANNEL_1}},
{bank, mux2.pin(0), {65, CHANNEL_1}},
};
//*** MIDI DATA POT ***
Bankable::CCPotentiometer pots [] {
{{bank, BankType::CHANGE_CHANNEL}, A2, {20, CHANNEL_1}},
};
pin_t leds1 [] {
sreg.pin(11),
sreg.pin(10),
sreg.pin(9),
sreg.pin(8),
sreg.pin(7),
sreg.pin(6),
sreg.pin(5),
sreg.pin(4),
sreg.pin(3),
sreg.pin(2),
sreg.pin(1),
sreg.pin(0),
};
// Selector to select the active bank
ManyButtonsSelectorLEDs<12> selector = {
bank,
{mux1.pin(0), mux1.pin(1), mux1.pin(2), mux1.pin(3), mux1.pin(4), mux1.pin(5), mux1.pin(6), mux1.pin(7), mux1.pin(8), mux1.pin(9), mux1.pin(10), mux1.pin(11),}, // button pins
{sreg.pin(0), sreg.pin(1), sreg.pin(2), sreg.pin(3), sreg.pin(4), sreg.pin(5), sreg.pin(6), sreg.pin(7), sreg.pin(8), sreg.pin(9), sreg.pin(10), sreg.pin(11),}, // LED pins
};
void setup() {
Control_Surface.begin();
}
void loop() {
// Refresh all inputs
Control_Surface.loop();
}
I don't know how to implement the CCPotentiometer::setAddress
method. I will end up having 12 banks with 47 function buttons per bank and 1 pot to change the corresponding CC value. I need your help!
Hi Delta_G, my programming skills are very limited! I would an example.
So Peter, if I'm reading the info correctly, I could create 47 bank for every function and 1 pot to control them? If that's correct that would be for only 1 partial...I need 12. Can we do a bank of a bank?
Can you give an example of the CCPotentiometer::setAddress
method?
I used ChatGPT to help and this code working now but the banks are not changing. What am I doing wrong?
#include <Control_Surface.h> // Include the Control Surface library
// Initialize USB MIDI interface
USBMIDI_Interface midi;
// Define CC numbers for the parameters
const uint8_t ccNumbers[] = {22, 23, 24}; // CC numbers for Delay, Attack, Sustain
// Potentiometer on pin A4
CCPotentiometer potentiometer = {A0, {ccNumbers[0], CHANNEL_1}}; // Default to the first CC number
// Define two buttons for bank selection
Bank<2> bank(1);
//*** PARTIAL SELECT***
Bankable::CCButton partial_Sel[] {
{{bank, BankType::CHANGE_CHANNEL}, 4, {25,CHANNEL_1}}, // Button to select Bank 1
{{bank, BankType::CHANGE_CHANNEL}, 5, {26,CHANNEL_1}}, // Button to select Bank 2
};
// Define three buttons to select CC functions (latched)
Bankable::CCButtonLatched<2> function_Sel[] = {
{{bank, BankType::CHANGE_CHANNEL}, 3, {ccNumbers[0], CHANNEL_1}}, // Button on pin 1 for CC 22 (Delay)
{{bank, BankType::CHANGE_CHANNEL}, 2, {ccNumbers[1], CHANNEL_1}}, // Button on pin 2 for CC 23 (Attack)
{{bank, BankType::CHANGE_CHANNEL}, 1, {ccNumbers[2], CHANNEL_1}} // Button on pin 3 for CC 24 (Sustain)
};
// Function to update the potentiometer's CC number
void updatePotCC(uint8_t ccNumber) {
potentiometer.setAddress({ccNumber, CHANNEL_1}); // Update potentiometer CC using setAddress
}
void setup() {
// Initialize Control Surface
Control_Surface.begin();
}
void loop() {
// Check if any of the latched function buttons are pressed
for (int i = 0; i < 3; ++i) {
if (function_Sel[i].getButtonState() == Button::Falling) {
updatePotCC(ccNumbers[i]); // Update the potentiometer based on the selected button
}
}
// Process Control Surface (sends MIDI messages)
Control_Surface.loop();
}
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.