1 Music Player
David Schmenk edited this page 2018-02-02 16:50:21 -08:00

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.

seqplay.pla