const;
int crotchet=100; //negra
int minim=2*crotchet; //blanca
int semibreve0 = 4*crotchet/2; //corchera
int semiQuaver = crotchet/4; //semicorchera
int quaver=cortchet/2; //corchera
int semiQuaver = crotchet/4; //semicorchera
int demiSemiQuaver = crotchet/8; //fusa
int crotchetWithPoint = crotchet+quaver; //suma
int minimWithPoint = minim+crotchet; //suma
int crotchetSilence = crotchet;
int minimSilence = minim;
const int semiBreveSilence = semiBreve;
const int quaverSilence = quaver;
const int semiQuaversSilence = semiQuaver;
const long DO = 523.25;
const long RE = 587.33;
const long MI = 659.26;
const long FA = 698.46;
const long SOL = 783.99;
const long LA = 440;
const long SI = 987.77;
const long PAU = 30000; //pausa
const int speakerOut = 8;
const int nextNote = 200; //siguiente nota
const int nextBesck = 00;
const int elements = 34;
void setup() {
pinMode(speakerOut,OUTPUT);}
void loop(){
int melody[] = {MI, PAU, MI, MI, MI, PAU, MI, PAU, MI, FA, PAU, SOL, FA, PAU, MI, PAU, MI, FA, MI, FA, PAU, SOL, PAU, SOL};
int duration[] = {crotchetWithPoint, nextNote, quaver, crotchet, nextNote, crotchet, nextBlock,...crotchet}
for(int note = 0; i < elements.length; note++){
tone(speakerOut, melody[note]);
delay(durations[note]);
noTone(speakerOut);} }
Do C Do# Re D Re# Mi E Fa F Fa# Sol G Sol# La A La# Si B Nota x(i = 0, i < 12) = freq*Do* 12√2 Nota Fa(5) = freq*Do*12√2 = 261,63*2^5/12 = √2^5/12*261,63 C4 = Do(Central) Oido humano 0 20Hz -20kHz A0 = 27,5000 Hz C8 = 4186,01 Hz