Midi Shield - Sending Sysex

Hi,

As a short introduction I used arduino a couple of years ago completing some basic tutorials - blinking LEDs and stepper motor control, so as you can imagine I'm very much a beginner.

I recently purchased the Sparkfun Midi Shield for my Arduino Uno board with the aim to send a sysex message to my Roland Alpha Juno synthesizer to control a VCF cutoff value on the synth.

I did some research and found some posts but a lot of them are complex for a beginner like myself, they seem to be involving lots of other elements such as button presses and not helpful for a beginner.

The sysex message is F0 41 36 00 23 20 01 10 00 F7

I'm really stuck - the jump from simple analog read and writes and blinking LEDs seems to be to far but i guess you have to start somewhere so thought best to post here.

so far I have (dont laugh!)

(how do i implement the analogRead into sending the byte to midi)

#include <MIDI.h>
#define VCFCUTOFF 0

int analogPin = A0 // VCF pot set to A0 pin on midishield

byte sendSysex;

void setup() {

  Serial.begin(9600);

}

void loop() {

  vcfPot = analogRead(analogPin);
  filter = vcfPot/8;

   
}

thanks in advance,
dave

Sending MIDI is relatively straightforward, filtering the analog input and only sending MIDI messages when you're actually turning the knob could be a bit more involved.

You could use the Control Surface library I maintain, it supports many different MIDI interfaces and has functions for filtering analog inputs built-in, so you don't have to reinvent the wheel there.

You could do something like this, for example:

#include <Control_Surface.h> // https://github.com/tttapa/Control-Surface

// MIDI interface on “Serial” UART (TX/RX pins)
HardwareSerialMIDI_Interface midi { Serial };

// Reads, filters and detects changes of an analog input
// Produces a 7-bit output [0-127]
FilteredAnalog<7> potentiometer { A0 }; 

// MIDI System Exclusive data to send
uint8_t sysex_data[] {
  0xF0, 0x41, 0x36, 0x00, 0x23, 0x20, 0x01, 0x10, 0x00, 0xF7,
};
// Reference to easily update the parameter value of the SysEx message
uint8_t &vcf_value = sysex_data[8];

void setup() {
  // Initialize MIDI interface and analog input
  midi.begin();
  potentiometer.setupADC();
}

void loop() {
  midi.update(); // Handle and discard MIDI input

  // Check whether the potentiometer value changed
  if (potentiometer.update()) {
    vcf_value = potentiometer.getValue(); // if it did, update the message
    SysExMessage msg { sysex_data, sizeof(sysex_data) };
    midi.send(msg); // and send it out over MIDI
  }
}

Pieter

thanks pieterP i will check your library, this should help me a lot :slight_smile:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.