talkMIDI problems

so im trying to transfer these "canvas notes" onto my system "finalfinal" and - talkMIDI not declared in thisscope- keeps popping up. they're identical as far as im concerned but the first compiles while the second doesnt. What am i missing?

//======Canvas_Notes
#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // RX, TX

byte note = 0; //The MIDI note value to be played
byte resetMIDI = 4; //Tied to VS1053 Reset line
byte ledPin = 13; //MIDI traffic inidicator
int instrument = 0;

int OUP(int note){
int result;
result = note + 12;
return result;
}
//Plays a note X (one) octives lower than selected note
int ODN(int note){
int result;
result = note - 12;
return result;
}

const int C = 60;
const int D = 62;
const int E = 64;
const int F = 65;
const int G = 67;
const int A = 69;
const int B = 71;
const int Cs = 61;
const int Df = 61;
const int Ds = 63;
const int Ef = 63;
const int Fs = 66;
const int Gf = 66;
const int Gs = 68;
const int Af = 68;
const int As = 70;
const int Bf = 70;
int attack_velocity = 120; //Attack velocity of notes-- AFFECTS VOLUME
int release_velocity = 60; //Release velocity of notes

void setup() {

// put your setup code here, to run once:
Serial.begin(57600);

//Setup soft serial for MIDI control
mySerial.begin(31250);

//Reset the VS1053
pinMode(resetMIDI, OUTPUT);
digitalWrite(resetMIDI, LOW);
delay(100);
digitalWrite(resetMIDI, HIGH);
delay(100);
talkMIDI(0xB0, 0x07, 120); //0xB0 is channel message, set channel volume to near max (127)

// INSTRUMENT SELECTION FUNCTIONS:::: (call this value before you play your notes)

//Oboe
talkMIDI(0xC0, 69, 0);
}

void loop() {
// put your main code here, to run repeatedly:
O1();
}

void O1(){
play(OUP(F),2);
play(OUP(D),.5);
play(OUP(E),.5);
//digitalWrite(solenoidPin,LOW); //Drops Ball
play(OUP(D),.5);
play(OUP(C),.5);
}
/void O2(){
play(OUP(B),1);
play(OUP(B),.5);
play(OUP(D),.5);
play(OUP(C),1);
digitalWrite(solenoidPin,LOW); //Drops Ball
play(OUP(C),.5);
play(OUP(D),.5);
}
void O3(){
play(OUP(E),1);
play(OUP(C),1);
play(A,.5);
play(B,.5);
digitalWrite(solenoidPin,LOW); //Drops Ball
play(OUP(C),1);
}
void O4(){
play(OUP(D),.5);
play(OUP(C),.5);
play(B,.5);
play(As,.5);
//Hand Programed as ball drops mid note
noteOn(0, F, attack_velocity);
delay(500);
digitalWrite(solenoidPin,LOW); //Drops Ball
delay(500);
noteOff(0, F, release_velocity);
}
void O5(){
play(F,1);
play(B,1);
play(B,1);
digitalWrite(solenoidPin,LOW); //Drops Ball
play(G,1);
}
void O6(){
play(A,1);
play(OUP(E),1);
play(A,.5);
play(B,.5);
digitalWrite(solenoidPin,LOW); //Drops Ball
play(C,1);
}
/
//This should play a bunch of different instruments depending on what order you’re in. So the first Oboe would upload O1, second would upload O2, etc. Then you can use this to drop the ball.
//ASSOCIATED FUNCTIONS______

//plays note of specified duration and value.
void play(int note, float pause){
noteOn(0, note, attack_velocity);
delay(pause*500);
noteOff(0, note, release_velocity);
}

//Send a MIDI note-on message. Like pressing a piano key
//channel ranges from 0-15
void noteOn(byte channel, byte note, byte attack_velocity) {
talkMIDI( (0x90 | channel), note, attack_velocity);
}

//Send a MIDI note-off message. Like releasing a piano key
void noteOff(byte channel, byte note, byte release_velocity) {
talkMIDI( (0x80 | channel), note, release_velocity);
}

//Plays a MIDI note. Doesn't check to see that cmd is greater than 127, or that data values are less than 127
void talkMIDI(byte cmd, byte data1, byte data2) {
digitalWrite(ledPin, HIGH);
mySerial.write(cmd);
mySerial.write(data1);

//Some commands only have one data byte. All cmds less than 0xBn have 2 data bytes
//(sort of: MIDI Communication Protocol)
if( (cmd & 0xF0) <= 0xB0)
mySerial.write(data2);

digitalWrite(ledPin, LOW);
}

canvas_notes.ino (3.69 KB)

finalfinal.ino (6.23 KB)

//=======finalfinal
// MDIDI Notes credit to Team 32 2019
////////////////////////////////////////////////////////////////////////IR Break Beam Variables
#define LEDPIN 13
#define SENSORPIN 5
int sensorState = 0, lastState=0;
int sensor = 0;

////////////////////////////////////////////////////////////////////////Light Variables
#include <FastLED.h>
#define LED_PIN 10
#define NUM_LEDS 60
#define BRIGHTNESS 64
#define LED_TYPE WS2811
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];

//////////////////////////////////////////////////////////////////////////MIDI Variables
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
byte note = 0; //The MIDI note value to be played
byte resetMIDI = 4; //Tied to VS1053 Reset line
byte ledPin = 12; //MIDI traffic inidicator
int instrument = 0;
int volume = 120;

//Plays Note one octive up
int OUP(int note){
int result;
result = note + 12;
return result;
}
//Plays a note X (one) octives lower than selected note
int ODN(int note){
int result;
result = note - 12;
return result;
}
const int C = 60;
const int D = 62;
const int E = 64;
const int F = 65;
const int G = 67;
const int A = 69;
const int B = 71;
const int Cs = 61;
const int Df = 61;
const int Ds = 63;
const int Ef = 63;
const int Fs = 66;
const int Gf = 66;
const int Gs = 68;
const int Af = 68;
const int As = 70;
const int Bf = 70;
int attack_velocity = 120; //Attack velocity of notes-- AFFECTS VOLUME
int release_velocity = 60; //Release velocity of notes
#include <MIDI.h>

//////////////////////////////////////////////////////////////////////////////servo
#include <Servo.h>
Servo myservo; // create servo object to control a servo

//==================================================================================================================================
////////////////////////////////////////////////////////////// to run once
void setup() {

///// IR beam led & sensor
pinMode(LEDPIN, OUTPUT);
pinMode(SENSORPIN, INPUT);
digitalWrite(SENSORPIN, HIGH);

//////////////////servo
myservo.attach(9);
myservo.write(40); // tell servo to go to position in variable 'pos'
delay(15);

///////////////lights
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);

/////////////////music
Serial.begin(9600);
//Setup soft serial for MIDI control
mySerial.begin(31250);
//Reset the VS1053
pinMode(resetMIDI, OUTPUT);
digitalWrite(resetMIDI, LOW);
delay(100);
digitalWrite(resetMIDI, HIGH);
delay(100);
//Oboe
talkMIDI(0xB0, 0x07, 120); //0xB0 is channel message, set channel volume to near max (127)

// INSTRUMENT SELECTION FUNCTIONS:::: (call this value before you play your notes)

//Oboe
talkMIDI(0xC0, 69, 0);
}

//////////////////////////////to run repeatedly
void loop() {

myservo.write(55); // tell servo to go to position in variable 'pos'
delay(15);

// read the state of the pushbutton value:
sensorState = digitalRead(SENSORPIN);
// check if the sensor beam is broken
// if it is, the sensorState is LOW:
if (sensorState == LOW) {
// turn LED on:
digitalWrite(LEDPIN, HIGH);
}
else {
// turn LED off:
digitalWrite(LEDPIN, LOW);
}

if (sensorState && !lastState) {
Serial.println("Unbroken");
}

if (!sensorState && lastState) {
Serial.println("Broken");
sensor = 1;
light(0,0,255,0);
myservo.write(70); // tell servo to go to position in variable 'pos'
delay(15);
}

while (sensor == 1) {

//talkMIDI(0xC0, instrument, volume); //Default bank GM1talkMIDI(0xC0, instrument, 60);
O1();
}

///Oboe
void O1(){
light(0,255,0,0);
play(OUP(F),2);
play(OUP(D),.5);
play(OUP(E),.5);
myservo.write(40); //Drops Ball
delay(15);
play(OUP(D),.5);
play(OUP(C),.5);
lastState = sensorState;
sensor = 0;
lightoff(0);
}
void O2(){
play(OUP(B),1);
play(OUP(B),.5);
play(OUP(D),.5);
play(OUP(C),1);
myservo.write(40); //Drops Ball
delay(15);
play(OUP(C),.5);
play(OUP(D),.5);
lastState = sensorState;
sensor = 0;
}
void O3(){
play(OUP(E),1);
play(OUP(C),1);
play(A,.5);
play(B,.5);
myservo.write(40); //Drops Ball
delay(15);
play(OUP(C),1);
lastState = sensorState;
sensor = 0;
}
void O4(){
play(OUP(D),.5);
play(OUP(C),.5);
play(B,.5);
play(As,.5);
//Hand Programed as ball drops mid note
noteOn(0, F, attack_velocity);
delay(500);
myservo.write(40); //Drops Ball
delay(15);
delay(500);
noteOff(0, F, release_velocity);
lastState = sensorState;
sensor = 0;
}
void O5(){
play(F,1);
play(B,1);
play(B,1);
myservo.write(40); //Drops Ball
delay(15);
play(G,1);
lastState = sensorState;
sensor = 0;
}
void O6(){
play(A,1);
play(OUP(E),1);
play(A,.5);
play(B,.5);
myservo.write(40); //Drops Ball
delay(15);
play(C,1);
lastState = sensorState;
sensor = 0;
}

void light(int led, int r, int g, int b){
leds[led] = CRGB(r, g, b);
FastLED.show();
delay(20);
}

void lightshow(int led, int r, int g, int b){
for (int i =0; i < 59; i++){
leds = CRGB(r, g, b);

  • FastLED.show();*
    _ r = r1 + 4;_
    _ g = g
    1 + 4;_
    _ b = b*1 + 4;_
  • delay(20);*
    }
    }
    void lightoff(int led, int r, int g, int b){
    for (int i =0; i < 59; i++){
    leds*=CRGB (r, g, b);*
    * FastLED.show();*
    * delay(20);*
    * }*
    * light(0,255,0,0);*
    }
    //plays note of specified duration and value.
    void play(int note, float pause){
    noteOn(0, note, volume);
    delay(pause*500);
    noteOff(0, note, volume);
    }
    void noteOn(byte channel, byte note, byte volume) {
    talkMIDI( (0x90 | channel), note, volume);
    }
    //Send a MIDI note-off message. Like releasing a piano key
    void noteOff(byte channel, byte note, byte volume) {
    talkMIDI( (0x80 | channel), note, volume);
    }
    //Plays a MIDI note. Doesn't check to see that cmd is greater than 127, or that data values are less than 127
    void talkMIDI(byte cmd, byte data1, byte data2) {
    mySerial.write(cmd);
    mySerial.write(data1);
    //Some commands only have one data byte. All cmds less than 0xBn have 2 data bytes
    //(sort of: MIDI Communication Protocol)
    if ( (cmd & 0xF0) <= 0xB0)
    * mySerial.write(data2);*
    }

You are missing your balancing brackets '{}' If you auto-format your code (CTRL-T), you will see all your function definitions are indented which tells you you are most likely missing a closing '}' somewhere above that line.

If you look at your entire error message, there is plenty to see.

Please stop posting your code as plain text. Read the topics at the beginning of this forum about how to properly post your code using code tags.

thanks a lot!