Arnov Sharma
Published © LGPL

Arduino Synth V3

A simple Arduino-based synth that can generate all sorts of exciting sounds.

BeginnerFull instructions provided1 hour2,146

Things used in this project

Hardware components

PCBWay Custom PCB
PCBWay Custom PCB
×1
Arduino Nano R3
Arduino Nano R3
×1
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×12
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×2
PAM8403 Module
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

sch

Code

code

C/C++
int C  = 2;
int CS = 3;
int D  = 4;
int DS = 5;
int E  = 6;
int F  = 7;
int FS = 8;
int G  = 9;
int GS = 10;
int A  = 11;
int AS = 12;
int B  = 13;
int octabajo = 0;
int octarriba = 1;
int tiempo = analogRead(A4);
int pitch_bend = analogRead(A5);


int c  = 262;
int cs = 277;
int d  = 294;
int ds = 311;
int e  = 330;
int f  = 349;
int fs = 370;
int g  = 392;
int gs = 415;
int a  = 440;
int as = 466;
int b  = 494;

void setup() {
  // INPUT CONFIG
  pinMode(C, INPUT_PULLUP);
  pinMode(CS, INPUT_PULLUP);
  pinMode(D, INPUT_PULLUP);
  pinMode(DS, INPUT_PULLUP);
  pinMode(E, INPUT_PULLUP);
  pinMode(F, INPUT_PULLUP);
  pinMode(FS, INPUT_PULLUP);
  pinMode(G, INPUT_PULLUP);
  pinMode(GS, INPUT_PULLUP);
  pinMode(A, INPUT_PULLUP);
  pinMode(AS, INPUT_PULLUP);
  pinMode(B, INPUT_PULLUP);
  pinMode(octabajo, INPUT_PULLUP);
  pinMode(octarriba, INPUT_PULLUP);
  pinMode(A4, INPUT_PULLUP);
  // OUTPUT CONFIG
  pinMode(A2, OUTPUT);
  // start serial port
  Serial.begin(9600);
}



void loop() {
 
  // put your main code here, to run repeatedly:
  digitalRead(0);
  digitalRead(1);
 
  Serial.println(analogRead(A4));

  if (!digitalRead(C)) {
    tone(A2, c+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(C);
  }
  if (!digitalRead(C)&&!digitalRead(octabajo)) {
    tone(A2, c/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(C);
  }
  if (!digitalRead(C)&&!digitalRead(octarriba)) {
    tone(A2, c*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(C);
  }


  digitalRead(CS);
  if (!digitalRead(CS)) {
    tone(A2, cs+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(CS);
  }
  if (!digitalRead(CS)&&!digitalRead(octabajo)) {
    tone(A2, cs/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(CS);
  }
  if (!digitalRead(CS)&&!digitalRead(octarriba)) {
    tone(A2, cs*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(CS);
  }

  digitalRead(D);
  if (!digitalRead(D)) {
    tone(A2, d+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(D);
  }
  if (!digitalRead(D)&&!digitalRead(octabajo)) {
    tone(A2, d/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(D);
  }
  if (!digitalRead(D)&&!digitalRead(octarriba)) {
    tone(A2, d*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(D);
  }

  digitalRead(DS);
  if (!digitalRead(DS)) {
    tone(A2, ds+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(DS);
  }
  if (!digitalRead(DS)&&!digitalRead(octabajo)) {
    tone(A2, ds/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(DS);
  }
  if (!digitalRead(DS)&&!digitalRead(octarriba)) {
    tone(A2, ds*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(DS);
  }

  digitalRead(E);
  if (!digitalRead(E)) {
    tone(A2, e+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(E);
  }
  if (!digitalRead(E)&&!digitalRead(octabajo)) {
    tone(A2, e/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(E);
  }
  if (!digitalRead(E)&&!digitalRead(octarriba)) {
    tone(A2, e*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(E);
  }

  digitalRead(F);
  if (!digitalRead(F)) {
    tone(A2, f+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(F);
  }if (!digitalRead(F)&&!digitalRead(octabajo)) {
    tone(A2, f/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(F);
  }
  if (!digitalRead(F)&&!digitalRead(octarriba)) {
    tone(A2, f*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(F);
  }

  digitalRead(FS);
  if (!digitalRead(FS)) {
    tone(A2, fs+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(FS);
  }
  if (!digitalRead(FS)&&!digitalRead(octabajo)) {
    tone(A2, fs/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(FS);
  }
  if (!digitalRead(FS)&&!digitalRead(octarriba)) {
    tone(A2, fs*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(FS);
  }

  digitalRead(G);
  if (!digitalRead(G)) {
    tone(A2, g+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(G);
  }
  if (!digitalRead(G)&&!digitalRead(octabajo)) {
    tone(A2, g/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(G);
  }
  if (!digitalRead(G)&&!digitalRead(octarriba)) {
    tone(A2, g*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(G);
  }

  digitalRead(GS);
  if (!digitalRead(GS)) {
    tone(A2, gs+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(GS);
  }
  if (!digitalRead(GS)&&!digitalRead(octabajo)) {
    tone(A2, gs/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(GS);
  }
  if (!digitalRead(GS)&&!digitalRead(octarriba)) {
    tone(A2, gs*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(GS);
  }

  digitalRead(A);
  if (!digitalRead(A)) {
    tone(A2, a+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(A);
  }
  if (!digitalRead(A)&&!digitalRead(octabajo)) {
    tone(A2, a/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(A);
  }
  if (!digitalRead(A)&&!digitalRead(octarriba)) {
    tone(A2, a*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(A);
  }

  digitalRead(AS);
  if (!digitalRead(AS)) {
    tone(A2, as+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(AS);
  }
  if (!digitalRead(AS)&&!digitalRead(octabajo)) {
    tone(A2, as/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(AS);
  }
  if (!digitalRead(AS)&&!digitalRead(octarriba)) {
    tone(A2, as*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(AS);
  }

  digitalRead(B);
  if (!digitalRead(B)) {
    tone(A2, b+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(B);
  }
  if (!digitalRead(B)&&!digitalRead(octabajo)) {
    tone(A2, b/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(B);
  }
  if (!digitalRead(B)&&!digitalRead(octarriba)) {
    tone(A2, b*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(B);
  }
  
  noTone(A2);

  
  } 

Credits

Arnov Sharma

Arnov Sharma

309 projects • 306 followers
Just your average MAKER

Comments