My final project, the J- Tune is a guitar tuner. It consists of 5 main individual parts:
- A Breadboard – A breadboard is a strip of plastic with some sort of metal inside that is organized in rows and columns of
tiny holes in a way that allows you connect different pieces of a circuit together. These rows and columns of holes allow you to build circuits by plugging your parts into them while only connecting the ends of each of these connections into slots that connect to the parts you want directly connected to each other. - A Teensy 3.5 – The Teensy 3.5 is a microcontroller. A microcontroller is a mini computer that is programmable with code and allows you to give it instructions to do things. The Teensy is more or less the brains of the project. It has several different pins that plug into the breadboard; Pins for power and ground that power it, and pins that I connect my different parts of the circuit to that receive instructions from the Teensy to do whatever I program the Teensy to tell them to do.
- Adafruit AGC Electret Microphone Amplifier – MAX9814 – The microphone is a transducer that converts audio or sound (an analog signal) into voltage and digital information. It comes with a preamp which means that it not only listens to and converts the sound but makes far away sounds a little louder and close loud sounds a little softer so that it is actually a signal that can be heard clearly.
https://learn.adafruit.com/adafruit-agc-electret-microphone-amplifier-max9814/overview - NeoPixel Stick – NeoPixels are programmable LED lights. my NeoPixel stick contains 8 RGBW LEDs that I used my code sent to my Teensy to turn them into any color I wanted to.
https://www.adafruit.com/product/2869 - Quad Alphanumeric Display – an alphanumeric display is just what it says it is. It is a digital display that allows you to program it to show numbers or letters, and some symbols. My alphanumeric display has 4 squares so I was allowed to send code from my teensy to display the letters and symbols I wanted to.
https://www.adafruit.com/product/1911
So how does the J – Tune work?
The Teensy 3.5 uses a coding language called C++. Code is basically a language you use to speak to digital devices. Computers and digital devices speak in binary, which means they only understand 1s and 0s. Coding is a set of instructions therefore, that you give to a digital device that says, in the simplest of terms, “turn this thing on or off.” Using the coding program called “Arduino” I create a lot of if statements, that in basic terms all sum up to, “do this thing if I do this other thing.” Using my code, and my teensy that I upload that code to, I was able to create the J- Tune.
The J- Tune uses specific code that takes the audio signal that it receives from the Electret microphone, then sends that information back to the the Teensy. Based on the programming, the signal that is received by the teensy is recognized as musical frequencies. Every musical key has its own musical frequency that is measured in Hz. In my code I input an instruction for every frequency from C2 (which is a low C) to C5, which is a higher key on the musical scale. I used this range of keys because this is a range between which a guitar’s strings are tuned. The first string is an E4 and the lowest string an E2.
I programmed the teensy to recognize specific ranges of frequencies so that when it recognizes all 6 notes on the guitar strings (E2, A2, D3, G3, B3, E4), the neopixel strip lights all LEDs in one color, a different color for each of the notes:
E2 – Red, A2 – Orange, D3 – Yellow, G3 – Green, B3 – Blue, E4 – Violet
Next I programmed the teensy to recognize the notes that fell around and between those 6 notes so that the closer to that note they are, the more LEDs would have that color. For example, B2 falls between A2 and D3 but is closer to A than D, so 6 out of the 8 LEDs are orange and the other 2 are yellow. This allows me to be able to see how close or far I am from the note I am trying to tune my guitar to.
I then programmed the Teensy to display the note based on the frequency received through the mic. So that, for example, if it heard 110Hz, which is an A2, it would show 4 “As” on the display. This makes the Tuner more interactive so that you can actually know what note you are playing and not just how close to the 6 notes you are. It shows you every note that it hears form C2 to C5, so it might even allow you to see any frequency it may hear from a person’s voice, to any musical instrument or sound.
How does it REALLY work? (A more technical explanation)
On the breadboard I have the teensy connected, powered by a USB cable. I connected the 3.3V pin of the teensy with a red wire to the red strip power side of the breadboard and the GND pin or ground pin to the blue strip or ground side using a black wire. I then connected the ground sides on either side of the breadboard together and the power sides on either side together using longer black and red wires.
The electret microphone is connected to the breadboard and has 5 pins. GND, which I connected to ground, Vdd and Gain which I connected to power (gain allows me to raise the amplitude of the audio signal), AR which I didn’t use and Out which I connected to Digital pin 16 or Analog pin A2 of my teensy using a simple circuit that allows it to work.
I also connected an audio jack to the out pin so that I would be able to hear straight from the mic if I wanted to.
My Neo Pixel Strip came with 4 pins that I had to solder wires to. There are 2 GND pins, only one of which I use to connect to Ground, a 5DC that I connected to a 1000 microfard capacitor that I conneected to ground, and a DOut pin that I connected to pin 33 of my Teensy.
My alphanumeric display has 5 pins that I had to solder pins to. CLK and DAT that I wired to Analog # 4 and 5 pins on the Teensy, GND that I connected to ground and VCC+ and Vi2c that I connected to power.
In Arduino
For detecting the frequency I used some code that was already available through Arduino for pitch detection
/* Detect the frequency of music notes, by Colin Duffy
/
/
C C# D Eb E F F# G G# A Bb B
0 16.35 17.32 18.35 19.45 20.60 21.83 23.12 24.50 25.96 27.50 29.14 30.87
1 32.70 34.65 36.71 38.89 41.20 43.65 46.25 49.00 51.91 55.00 58.27 61.74
2 65.41 69.30 73.42 77.78 82.41 87.31 92.50 98.00 103.8 110.0 116.5 123.5
3 130.8 138.6 146.8 155.6 164.8 174.6 185.0 196.0 207.7 220.0 233.1 246.9
4 261.6 277.2 293.7 311.1 329.6 349.2 370.0 392.0 415.3 440.0 466.2 493.9
5 523.3 554.4 587.3 622.3 659.3 698.5 740.0 784.0 830.6 880.0 932.3 987.8
6 1047 1109 1175 1245 1319 1397 1480 1568 1661 1760 1865 1976
7 2093 2217 2349 2489 2637 2794 2960 3136 3322 3520 3729 3951
8 4186 4435 4699 4978 5274 5588 5920 6272 6645 7040 7459 7902
Guitar strings are E2=82.41Hz, A2=110Hz, D3=146.8Hz, G3=196Hz, B3=246.9Hz, E4=329.6Hz
I used this table to create ranges between hertz so that my tuner could be accurate enough to pick up the right pitches but also leaving some room for error because it is extremely difficult to get a string instrument to play a specific frequency.
#include “Adafruit_LEDBackpack.h” #include “Adafruit_GFX.h” #includeI used the top half of the above code from the arduino database that helps the Neo pixels work and the bottom half is code that allows the teensy to do analog to digital signal conversion. It helps the teensy recognize the audio from the microphone and not only analyze the amplitude of that signal but analyze the frequencies heard by the mic.
I created 7 functions, one for each of the strings on the guitar and one for every other note from C2 to C5
Each of the functions more or less contain the same code, but modified for each note.
For C2 under the “key” function I created an if statement:
if ((note < 67.0) && (note > 63.0)) {
C2 is 65.41Hz so I used a range that was close enough so that the teensy would be able to recognize it as C.
Next I included code for each of the neopixels that tells the neopixel in RGB what the color should be, the values in the brackets being the Red, Green or Blue values
pixels.setPixelColor(0, pixels.Color(100, 100, 100)); // white colored light
pixels.setPixelColor(1, pixels.Color(100, 100, 100)); // white colored light
pixels.setPixelColor(2, pixels.Color(100, 100, 100)); // white colored light
pixels.setPixelColor(3, pixels.Color(100, 100, 100)); // white colored light
pixels.setPixelColor(4, pixels.Color(100, 100, 100)); // white colored light
pixels.setPixelColor(5, pixels.Color(100, 100, 100)); // white colored light
pixels.setPixelColor(6, pixels.Color(100, 100, 100)); // white colored light
pixels.setPixelColor(7, pixels.Color(100, 100, 100)); // white colored light
pixels.show(); // This sends the updated pixel color to the hardware.
next I included the code for the alphanumeric board
//code commands for text on alphanumeric board
alpha4.writeDigitAscii(0, txt[2]);
alpha4.writeDigitAscii(1, txt[2]);
alpha4.writeDigitAscii(2, txt[2]);
alpha4.writeDigitAscii(3, txt[2]);
alpha4.writeDisplay();
The values in the brackets stand for (which of the 4 boards will display the text, what letter or symbol stated in the function name it will display)
The colors and text is modified depending on what note is being played or what frequency is recognized by the teensy.
if (notefreq.available()) {
note = notefreq.read();
float prob = notefreq.probability();
Serial.printf(“Note: %3.2f | Probability: %.2f\n”, note, prob);
The above code contains the commands that state that if there is a frequency recognized, it will analyze that frequency, calculate the probability that it is the note and if it is, print what frequency it heard in the Serial.
The “key” function contains a lot more code than the 6 other functions but only because it contains the all the notes other than the notes that are taken care of by the other 6 functions.
Challenges
One of the biggest challenges one might come across is soldering the pins to the boards. It takes a lot of precision and care to make sure the solder does not spill over and connect 2 different pins together.
Another challenge I had was creating a close enough range that would allow the teensy to recognize the note being played. As I said earlier, it is difficult to hit exact frequencies on string instruments and so I had to use a range of frequencies instead. The range had to be wide enough to still be technically that note that it’s supposed to be but also narrow enough so that it’s accurate. It will probably take a lot more coding to get it to be completely accurate but it comes close enough to be useful
The Code
/* Detect the frequency of music notes, by Colin Duffy */ /* C C# D Eb E F F# G G# A Bb B 0 16.35 17.32 18.35 19.45 20.60 21.83 23.12 24.50 25.96 27.50 29.14 30.87 1 32.70 34.65 36.71 38.89 41.20 43.65 46.25 49.00 51.91 55.00 58.27 61.74 2 65.41 69.30 73.42 77.78 82.41 87.31 92.50 98.00 103.8 110.0 116.5 123.5 3 130.8 138.6 146.8 155.6 164.8 174.6 185.0 196.0 207.7 220.0 233.1 246.9 4 261.6 277.2 293.7 311.1 329.6 349.2 370.0 392.0 415.3 440.0 466.2 493.9 5 523.3 554.4 587.3 622.3 659.3 698.5 740.0 784.0 830.6 880.0 932.3 987.8 6 1047 1109 1175 1245 1319 1397 1480 1568 1661 1760 1865 1976 7 2093 2217 2349 2489 2637 2794 2960 3136 3322 3520 3729 3951 8 4186 4435 4699 4978 5274 5588 5920 6272 6645 7040 7459 7902 Guitar strings are E2=82.41Hz, A2=110Hz, D3=146.8Hz, G3=196Hz, B3=246.9Hz, E4=329.6Hz */ #include "Adafruit_LEDBackpack.h" #include "Adafruit_GFX.h" #include <Adafruit_NeoPixel.h> #ifdef __AVR__ #include <avr/power.h> #endif #include <SerialFlash.h> #include <Audio.h> #include <Wire.h> #include <SPI.h> #include <SD.h> //--------------------------------------------------------------------------------------- AudioInputAnalog adc; //xy=164,95 AudioAnalyzeNoteFrequency notefreq; //xy=493,805 AudioAnalyzePeak peak; //xy=317,123 AudioConnection patchCord1(adc, notefreq); AudioConnection patchCord2(adc, peak); float note = 0.0; float prb = 0.0; Adafruit_AlphaNum4 alpha4 = Adafruit_AlphaNum4(); #define PIN 33 #define NUMPIXELS 8 Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRBW + NEO_KHZ800); void setup() { AudioMemory(30); alpha4.begin(0x70); notefreq.begin(.15); pixels.begin(); } void loop() { e2("EX"); //code for recognizing 6th string (E2) on guitar a2("AX"); //code for recognizing 5th string (A2) on guitar d3("DX"); //code for recognizing 4th string (D3) on guitar g3("GX"); //code for recognizing 3rd string (G3) on guitar b3("BX"); //code for recognizing 2nd string (B3) on guitar e4("EX"); //code for recognizing 1sth string (E4) on guitar key("ABCDEFGX"); //code for recognizing various notes from C2-C5 on guitar } void key(char txt[8]) { //NOTE C2 if ((note < 67.0) && (note > 63.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(1, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(2, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(3, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(4, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(5, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(6, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(7, pixels.Color(100, 100, 100)); // white colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[2]); alpha4.writeDigitAscii(1, txt[2]); alpha4.writeDigitAscii(2, txt[2]); alpha4.writeDigitAscii(3, txt[2]); alpha4.writeDisplay(); } } // NOTE C#2 else if ((note < 71.0) && (note > 67.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(1, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(2, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(3, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(4, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(5, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(6, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(7, pixels.Color(100, 100, 100)); // white colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[2]); alpha4.writeDigitAscii(1, txt[7]); alpha4.writeDigitAscii(2, txt[2]); alpha4.writeDigitAscii(3, txt[7]); alpha4.writeDisplay(); } } //NOTE D2 else if ((note < 75.0) && (note > 71.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(1, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(2, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(3, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(4, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(5, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(6, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(7, pixels.Color(100, 100, 100)); // white colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[3]); alpha4.writeDigitAscii(1, txt[3]); alpha4.writeDigitAscii(2, txt[3]); alpha4.writeDigitAscii(3, txt[3]); alpha4.writeDisplay(); } } // NOTE D#2 else if ((note < 80.0) && (note > 75.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(1, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(2, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(3, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(4, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(5, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(6, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(7, pixels.Color(100, 100, 100)); // white colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[3]); alpha4.writeDigitAscii(1, txt[7]); alpha4.writeDigitAscii(2, txt[3]); alpha4.writeDigitAscii(3, txt[7]); alpha4.writeDisplay(); } } //NOTE F2 else if ((note < 90.0) && (note > 85.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(1, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(2, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(3, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(4, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(5, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(6, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(7, pixels.Color(100, 0, 0)); // red colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[5]); alpha4.writeDigitAscii(1, txt[5]); alpha4.writeDigitAscii(2, txt[5]); alpha4.writeDigitAscii(3, txt[5]); alpha4.writeDisplay(); } } // NOTE F#3 else if ((note < 95.0) && (note > 90.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(1, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(2, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(3, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(4, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(5, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(6, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(7, pixels.Color(100, 0, 0)); // red colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[5]); alpha4.writeDigitAscii(1, txt[7]); alpha4.writeDigitAscii(2, txt[5]); alpha4.writeDigitAscii(3, txt[7]); alpha4.writeDisplay(); } } //NOTE G2 else if ((note < 100.0) && (note > 95.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(1, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(2, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(3, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(4, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(5, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(6, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(7, pixels.Color(100, 0, 0)); // red colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[6]); alpha4.writeDigitAscii(1, txt[6]); alpha4.writeDigitAscii(2, txt[6]); alpha4.writeDigitAscii(3, txt[6]); alpha4.writeDisplay(); } } // NOTE G#2 else if ((note < 107.0) && (note > 100.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(1, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(2, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(3, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(4, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(5, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(6, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(7, pixels.Color(100, 0, 0)); // red colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[6]); alpha4.writeDigitAscii(1, txt[7]); alpha4.writeDigitAscii(2, txt[6]); alpha4.writeDigitAscii(3, txt[7]); alpha4.writeDisplay(); } } //NOTE A#2 if ((note < 120.0) && (note > 115.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(1, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(2, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(3, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(4, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(5, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(6, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(7, pixels.Color(150, 50, 0)); // orange colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[0]); alpha4.writeDigitAscii(1, txt[7]); alpha4.writeDigitAscii(2, txt[0]); alpha4.writeDigitAscii(3, txt[7]); alpha4.writeDisplay(); } } // NOTE B2 else if ((note < 125.0) && (note > 120.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(1, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(2, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(3, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(4, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(5, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(6, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(7, pixels.Color(150, 50, 0)); // orange colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[1]); alpha4.writeDigitAscii(1, txt[1]); alpha4.writeDigitAscii(2, txt[1]); alpha4.writeDigitAscii(3, txt[1]); alpha4.writeDisplay(); } } //NOTE C3 else if ((note < 133.0) && (note > 125.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(1, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(2, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(3, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(4, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(5, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(6, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(7, pixels.Color(150, 50, 0)); // orange colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[2]); alpha4.writeDigitAscii(1, txt[2]); alpha4.writeDigitAscii(2, txt[2]); alpha4.writeDigitAscii(3, txt[2]); alpha4.writeDisplay(); } } // NOTE C#3 else if ((note < 140.0) && (note > 133.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(1, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(2, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(3, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(4, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(5, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(6, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(7, pixels.Color(150, 50, 0)); // orange colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[2]); alpha4.writeDigitAscii(1, txt[7]); alpha4.writeDigitAscii(2, txt[2]); alpha4.writeDigitAscii(3, txt[7]); alpha4.writeDisplay(); } } //NOTE D#3 else if ((note < 160.0) && (note > 150.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(1, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(2, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(3, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(4, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(5, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(6, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(7, pixels.Color(100, 100, 0)); // yellow colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[3]); alpha4.writeDigitAscii(1, txt[7]); alpha4.writeDigitAscii(2, txt[3]); alpha4.writeDigitAscii(3, txt[7]); alpha4.writeDisplay(); } } // NOTE E3 else if ((note < 170.0) && (note > 160.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(1, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(2, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(3, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(4, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(5, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(6, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(7, pixels.Color(100, 100, 0)); // yellow colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[4]); alpha4.writeDigitAscii(1, txt[4]); alpha4.writeDigitAscii(2, txt[4]); alpha4.writeDigitAscii(3, txt[4]); alpha4.writeDisplay(); } } //NOTE F3 else if ((note < 180.0) && (note > 170.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(1, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(2, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(3, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(4, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(5, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(6, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(7, pixels.Color(100, 100, 0)); // yellow colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[5]); alpha4.writeDigitAscii(1, txt[5]); alpha4.writeDigitAscii(2, txt[5]); alpha4.writeDigitAscii(3, txt[5]); alpha4.writeDisplay(); } } // NOTE F#3 else if ((note < 190.0) && (note > 180.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(1, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(2, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(3, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(4, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(5, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(6, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(7, pixels.Color(100, 100, 0)); // yellow colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[5]); alpha4.writeDigitAscii(1, txt[7]); alpha4.writeDigitAscii(2, txt[5]); alpha4.writeDigitAscii(3, txt[7]); alpha4.writeDisplay(); } } //NOTE G#3 if ((note < 215.0) && (note > 200.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(1, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(2, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(3, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(4, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(5, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(6, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(7, pixels.Color(0, 100, 0)); // green colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[6]); alpha4.writeDigitAscii(1, txt[7]); alpha4.writeDigitAscii(2, txt[6]); alpha4.writeDigitAscii(3, txt[7]); alpha4.writeDisplay(); } } // NOTE A3 else if ((note < 230.0) && (note > 215.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(1, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(2, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(3, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(4, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(5, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(6, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(7, pixels.Color(0, 100, 0)); // green colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[0]); alpha4.writeDigitAscii(1, txt[0]); alpha4.writeDigitAscii(2, txt[0]); alpha4.writeDigitAscii(3, txt[0]); alpha4.writeDisplay(); } } //NOTE A#3 else if ((note < 240.0) && (note > 230.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(1, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(2, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(3, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(4, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(5, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(6, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(7, pixels.Color(0, 100, 0)); // green colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[0]); alpha4.writeDigitAscii(1, txt[7]); alpha4.writeDigitAscii(2, txt[0]); alpha4.writeDigitAscii(3, txt[7]); alpha4.writeDisplay(); } } // NOTE C4 else if ((note < 270.0) && (note > 255.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(1, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(2, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(3, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(4, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(5, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(6, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(7, pixels.Color(0, 0, 100)); // blue colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[2]); alpha4.writeDigitAscii(1, txt[2]); alpha4.writeDigitAscii(2, txt[2]); alpha4.writeDigitAscii(3, txt[2]); alpha4.writeDisplay(); } } //NOTE C#4 else if ((note < 285.0) && (note > 270.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(1, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(2, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(3, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(4, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(5, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(6, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(7, pixels.Color(0, 0, 100)); // blue colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[2]); alpha4.writeDigitAscii(1, txt[7]); alpha4.writeDigitAscii(2, txt[2]); alpha4.writeDigitAscii(3, txt[7]); alpha4.writeDisplay(); } } // NOTE D4 else if ((note < 300.0) && (note > 285.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(1, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(2, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(3, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(4, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(5, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(6, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(7, pixels.Color(0, 0, 100)); // blue colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[3]); alpha4.writeDigitAscii(1, txt[3]); alpha4.writeDigitAscii(2, txt[3]); alpha4.writeDigitAscii(3, txt[3]); alpha4.writeDisplay(); } } //NOTE D#4 else if ((note < 320.0) && (note > 300.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(1, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(2, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(3, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(4, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(5, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(6, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(7, pixels.Color(0, 0, 100)); // blue colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[3]); alpha4.writeDigitAscii(1, txt[7]); alpha4.writeDigitAscii(2, txt[3]); alpha4.writeDigitAscii(3, txt[7]); alpha4.writeDisplay(); } } // NOTE F4 else if ((note < 360.0) && (note > 340.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(1, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(2, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(3, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(4, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(5, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(6, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(7, pixels.Color(50, 0, 100)); // violet colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[5]); alpha4.writeDigitAscii(1, txt[5]); alpha4.writeDigitAscii(2, txt[5]); alpha4.writeDigitAscii(3, txt[5]); alpha4.writeDisplay(); } } //NOTE F#4 if ((note < 380.0) && (note > 360.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(1, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(2, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(3, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(4, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(5, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(6, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(7, pixels.Color(50, 0, 100)); // violet colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[5]); alpha4.writeDigitAscii(1, txt[7]); alpha4.writeDigitAscii(2, txt[5]); alpha4.writeDigitAscii(3, txt[7]); alpha4.writeDisplay(); } } // NOTE G4 else if ((note < 400.0) && (note > 380.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(1, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(2, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(3, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(4, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(5, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(6, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(7, pixels.Color(50, 0, 100)); // violet colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[6]); alpha4.writeDigitAscii(1, txt[6]); alpha4.writeDigitAscii(2, txt[6]); alpha4.writeDigitAscii(3, txt[6]); alpha4.writeDisplay(); } } //NOTE G#4 else if ((note < 425.0) && (note > 400.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(1, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(2, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(3, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(4, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(5, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(6, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(7, pixels.Color(50, 0, 100)); // violet colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[6]); alpha4.writeDigitAscii(1, txt[7]); alpha4.writeDigitAscii(2, txt[6]); alpha4.writeDigitAscii(3, txt[7]); alpha4.writeDisplay(); } } // NOTE A4 else if ((note < 450.0) && (note > 425.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(1, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(2, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(3, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(4, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(5, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(6, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(7, pixels.Color(50, 0, 100)); // violet colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[0]); alpha4.writeDigitAscii(1, txt[0]); alpha4.writeDigitAscii(2, txt[0]); alpha4.writeDigitAscii(3, txt[0]); alpha4.writeDisplay(); } } //NOTE A#4 else if ((note < 480.0) && (note > 450.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(1, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(2, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(3, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(4, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(5, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(6, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(7, pixels.Color(50, 0, 100)); // violet colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[0]); alpha4.writeDigitAscii(1, txt[7]); alpha4.writeDigitAscii(2, txt[0]); alpha4.writeDigitAscii(3, txt[7]); alpha4.writeDisplay(); } } // NOTE B4 else if ((note < 510.0) && (note > 480.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(1, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(2, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(3, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(4, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(5, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(6, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(7, pixels.Color(50, 0, 100)); // violet colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[1]); alpha4.writeDigitAscii(1, txt[1]); alpha4.writeDigitAscii(2, txt[1]); alpha4.writeDigitAscii(3, txt[1]); alpha4.writeDisplay(); } } //NOTE C5 else if ((note < 540.0) && (note > 510.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(1, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(2, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(3, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(4, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(5, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(6, pixels.Color(100, 100, 100)); // white colored light pixels.setPixelColor(7, pixels.Color(100, 100, 100)); // white colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[2]); alpha4.writeDigitAscii(1, txt[2]); alpha4.writeDigitAscii(2, txt[2]); alpha4.writeDigitAscii(3, txt[2]); alpha4.writeDisplay(); } } if (notefreq.available()) { note = notefreq.read(); float prob = notefreq.probability(); Serial.printf("Note: %3.2f | Probability: %.2f\n", note, prob); } } void e2(char txt[2]) { //NOTE E2 if ((note < 85.0) && (note > 80.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(1, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(2, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(3, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(4, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(5, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(6, pixels.Color(100, 0, 0)); // red colored light pixels.setPixelColor(7, pixels.Color(100, 0, 0)); // red colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[0]); alpha4.writeDigitAscii(1, txt[0]); alpha4.writeDigitAscii(2, txt[0]); alpha4.writeDigitAscii(3, txt[0]); alpha4.writeDisplay(); } } if (notefreq.available()) { note = notefreq.read(); float prob = notefreq.probability(); Serial.printf("Note: %3.2f | Probability: %.2f\n", note, prob); } } void a2(char txt[2]) { //NOTE A2 if ((note < 115.0) && (note > 107.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(1, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(2, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(3, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(4, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(5, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(6, pixels.Color(150, 50, 0)); // orange colored light pixels.setPixelColor(7, pixels.Color(150, 50, 0)); // orange colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[0]); alpha4.writeDigitAscii(1, txt[0]); alpha4.writeDigitAscii(2, txt[0]); alpha4.writeDigitAscii(3, txt[0]); alpha4.writeDisplay(); } } if (notefreq.available()) { note = notefreq.read(); float prob = notefreq.probability(); Serial.printf("Note: %3.2f | Probability: %.2f\n", note, prob); } } void d3(char txt[2]) { //NOTE D3 if ((note < 150.0) && (note > 140.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(1, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(2, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(3, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(4, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(5, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(6, pixels.Color(100, 100, 0)); // yellow colored light pixels.setPixelColor(7, pixels.Color(100, 100, 0)); // yellow colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[0]); alpha4.writeDigitAscii(1, txt[0]); alpha4.writeDigitAscii(2, txt[0]); alpha4.writeDigitAscii(3, txt[0]); alpha4.writeDisplay(); } } if (notefreq.available()) { note = notefreq.read(); float prob = notefreq.probability(); Serial.printf("Note: %3.2f | Probability: %.2f\n", note, prob); } } void g3(char txt[2]) { //NOTE G3 if ((note < 200.0) && (note > 190.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(1, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(2, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(3, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(4, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(5, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(6, pixels.Color(0, 100, 0)); // green colored light pixels.setPixelColor(7, pixels.Color(0, 100, 0)); // green colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[0]); alpha4.writeDigitAscii(1, txt[0]); alpha4.writeDigitAscii(2, txt[0]); alpha4.writeDigitAscii(3, txt[0]); alpha4.writeDisplay(); } } if (notefreq.available()) { note = notefreq.read(); float prob = notefreq.probability(); Serial.printf("Note: %3.2f | Probability: %.2f\n", note, prob); } } void b3(char txt[2]) { //NOTE B3 if ((note < 255.0) && (note > 240.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(1, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(2, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(3, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(4, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(5, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(6, pixels.Color(0, 0, 100)); // blue colored light pixels.setPixelColor(7, pixels.Color(0, 0, 100)); // blue colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[0]); alpha4.writeDigitAscii(1, txt[0]); alpha4.writeDigitAscii(2, txt[0]); alpha4.writeDigitAscii(3, txt[0]); alpha4.writeDisplay(); } } if (notefreq.available()) { note = notefreq.read(); float prob = notefreq.probability(); Serial.printf("Note: %3.2f | Probability: %.2f\n", note, prob); } } void e4(char txt[2]) { //NOTE E4 if ((note < 340.0) && (note > 320.0)) { for (int i = 0; i < NUMPIXELS; i++) { //code commands for neopixels pixels.setPixelColor(0, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(1, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(2, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(3, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(4, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(5, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(6, pixels.Color(50, 0, 100)); // violet colored light pixels.setPixelColor(7, pixels.Color(50, 0, 100)); // violet colored light pixels.show(); // This sends the updated pixel color to the hardware. //code commands for text on alphanumeric board alpha4.writeDigitAscii(0, txt[0]); alpha4.writeDigitAscii(1, txt[0]); alpha4.writeDigitAscii(2, txt[0]); alpha4.writeDigitAscii(3, txt[0]); alpha4.writeDisplay(); } } if (notefreq.available()) { note = notefreq.read(); float prob = notefreq.probability(); Serial.printf("Note: %3.2f | Probability: %.2f\n", note, prob); } }
Leave A Comment?