Arduino music starter update.
In http://computoman.blogspot.com/2015/01/arduino-music.html I showed you how to do music on the arduino using a speaker. The code to extract the notes for a listing was done using bash, so I decided to do an update using basic instead.
Freebasic is free and is available for most platforms.
compile with
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
[/code]
file
G3-3
F4-8
notes
NOTE_G3, NOTE_F4,
notes-cs
3 , 8,
---------------------------------------
Freebasic is free and is available for most platforms.
compile with
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
[/code]
file
G3-3
F4-8
notes
NOTE_G3, NOTE_F4,
notes-cs
3 , 8,
---------------------------------------
Comments
Post a Comment