Greetings,
I'm working on a low level programming project and I want to play a music with the computer speaker.
I'm already capable of using the speaker (with timer2) and a song is represented in the following way:
note_t *music;
where note_t represents a note and it's compound by:
typedef struct {
int freq; /* note frequency */
int dur; /* note duration in miliseconds */
} note_t;
Now, what would be the best way to get the frequencies and durations of the notes from a music file?
Thanks in advance!
EDIT
To clarify some doubts, what I want to know is the best format to get the necessary information to create a song with the structure above indicated.
Depending on your exact purpose, you can use one of the ringtone formats or invent your own.
An example simple ringtone format is RTTTL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With