change tone sounds by altering the waveforms
Dependencies: mbed
Fork of 5_songs by
Diff: main.cpp
- Revision:
- 6:406f73a0eb49
- Parent:
- 5:7003c9f6d633
- Child:
- 7:4730853634bf
--- a/main.cpp Mon May 16 18:42:29 2016 +0000 +++ b/main.cpp Wed May 18 18:45:55 2016 +0000 @@ -19,7 +19,6 @@ static void play_song(int notes_left, int* melody, int* duration) { // YOUR CODE HERE - } @@ -27,20 +26,20 @@ int main() { // declare a melody - int melody[] = { - NOTE_G4, NOTE_G4, NOTE_G4, NOTE_DS3, NOTE_AS4, - NOTE_G4, NOTE_DS3, NOTE_AS4, NOTE_G4, - NOTE_D4, NOTE_D4, NOTE_D4, NOTE_DS4, NOTE_AS4, - NOTE_FS4, NOTE_DS4, NOTE_AS4, NOTE_G4 + int melody[] = { + NOTE_C4, NOTE_D4, NOTE_DS4, NOTE_C4, NOTE_FS4, NOTE_G4, NOTE_FS4, NOTE_G4, + NOTE_FS4, NOTE_G4, NOTE_FS4, NOTE_G4, NOTE_FS4, NOTE_G4, NOTE_FS4, NOTE_G4, + NOTE_FS4, NOTE_G4, NOTE_FS4, NOTE_G4 }; // note durations: 4 = quarter note, 8 = eighth note, etc.: + // the rapid succession of 16th notes produces a twill effect int duration[] = { - 2, 2, 2, 4, 4, - 2, 4, 4, 1, - 2, 2, 2, 4, 4, - 2, 4, 4, 1 + 2, 8, 4, 4, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16 }; + // melody & duration are on the heap, need to get them on the stack int *m = new int[sizeof(melody) / sizeof(int)];