LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Blogs > peonuser
User Name
Password

Notices


Rate this Entry

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

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,
Posted in Uncategorized
Views 1087 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 11:53 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration