Arduino music
Posted 05-15-2015 at 08:20 PM by peonuser
Arduino has a predefined sketch for out putting music to a speaker.
If you are familiar with sheet music, you can create a text file that has the noted and timing. But to use data on the Arduino takes a bit of manipulation/
So if you created a file with the following data:
G3-3
F4-8
You could use a bit of freebasic to extract the data to cut and paste into the sketch. Freebasic is free and is available for most platforms.
compile file with
file
G3-3
F4-8
fbc -lang qb filerdr.bas
filerdr.bas
notes
NOTE_G3, NOTE_F4,
notes-cs
3 , 23,
If you are familiar with sheet music, you can create a text file that has the noted and timing. But to use data on the Arduino takes a bit of manipulation/
So if you created a file with the following data:
G3-3
F4-8
You could use a bit of freebasic to extract the data to cut and paste into the sketch. Freebasic is free and is available for most platforms.
compile file with
file
G3-3
F4-8
fbc -lang qb filerdr.bas
filerdr.bas
Code:
open "file" for input as #1 open "notes" for output as #2 open "notes-cs" for output as #3 do while not eof(1) input #1, a$ b$ = left$(a$,2) c$ = mid$(a$,4,2) print #2,"NOTE_";b$;", "; print #3, c$;", "; loop close #1 close #2 close #3
notes
NOTE_G3, NOTE_F4,
notes-cs
3 , 23,
Total Comments 0