SX48 mini MIDI music player

here is what the author of the project writes about it: This project uses an SX48 microcontroller at 75 MHz as an 8-channel frequency-synthesis music player with three instruments (selectable per channel): square wave, triangle wave, sinwave.  Each channel can play an different pitch.  The desired pitch is used to lookup how far to step along the sample waveform each 1/44100 second tick, thereby playing back the waveform at that pitch’s frequency.

The waveform is 1024 bytes long (only one-quarter is stored).  The music data comes from stripping a bare-bones set of events from a MIDI file:  NOTE ON, NOTE OFF, TEMPO, PROGRAM CHANGE.  Each active channel contributes a 13-bit, signed, 2’s complement sample to a 16-bit accumulator.  The accumulator is then DC-biased to an unsigned format and then the most-significant 12-bits are serially written to a 12-bit MCP4922 dual serial DAC.  (I only use one channel).

The output sample frequency is approximately 44.1 KHz.  The actual value is (75,000,000 / 8) / 212.  The output of the DAC is fed to one side of a 10K trimpot, the other end being tied to ground and the wiper being the input to the positive input of an LM386 audio amplifier…

SX48 mini MIDI music player: [Via][Link]