// a 4 means a quarter note, 8 an eighteenth, 16 sixteenth, so on //!! negative numbers are used to represent dotted notes, // so -4 means a dotted quarter note, that is, a quarter plus an eighteenth!!
0% found this document useful (0 votes) 23 views 1 page Date uploaded Jul 26, 2013 Original Title Asa Branca Piano Copyright © Attribution Non-Commercial (BY-NC) Available Formats PDF, TXT or read online from Scribd Did you find this document useful? 0% found this document useful (0 votes) 23 views 1 page Original Title: Asa Branca Piano Jump to Page You are on page 1 of 1 Reward Your Curiosity Everything you want to read. Anytime. Anywhere. Any device. No Commitment. Cancel anytime. Unlock the full document with a free trial! Scribd members can read and download full documents. Your first days are free!
Your current browser isn't compatible with SoundCloud. Please download one of our supported browsers. Need help?
// Remember, the array is twice the number of notes (notes + durations) for ( int thisNote = 0; thisNote < notes * 2; thisNote = thisNote + 2) { // calculates the duration of each note divider = melody[thisNote + 1]; if (divider > 0) { // regular note, just proceed noteDuration = (wholenote) / divider;} else if (divider < 0) { // dotted notes are represented with negative durations!! noteDuration = (wholenote) / abs (divider); noteDuration *= 1. 5; // increases the duration in half for dotted notes} // we only play the note for 90% of the duration, leaving 10% as a pause tone (buzzer, melody[thisNote], noteDuration * 0. 9); // Wait for the specief duration before playing the next note. delay (noteDuration); // stop the waveform generation before the next note. noTone (buzzer);}} void loop () { // no need to repeat the melody. }