-
Notifications
You must be signed in to change notification settings - Fork 26
Music Player
David Schmenk edited this page Feb 3, 2018
·
1 revision
Playing music is always fun. Especially in games. This sample code will play sequenced notes generated from a MIDI file using this Python tool. The code will look for a MockingBoard sound card and use that to play the notes, or fall back to using the internal speaker. The sequencer can play more notes by quickly playing short bursts of simultaneous notes (called arpeggio in musicspeak) on both the MockingBoard and internal speaker. Interestingly, this code does not use interrupts to schedule the notes - it uses a polled timing loop instead. You can have it call back to a routine in a repeatable fashion for doing background processing while the music plays.