SX48 mini MIDI music player.
Lord Steve
Posts: 206
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.· The trimpot is used to attentuate the DAC output to a level that the LM386 can amplify properly with its default minimum gain of 20.· As can be seen in the schematic, the LM386 is in a minimal configuration.· The output of the LM386 is connected to an 8 ohm speaker via a 220 uF polarized electrolytic capacitor.· This capacitor blocks the DC bias of the previous stages.· This is important to not damage the coil of your speaker.· (A constant current through the coil is bad.· It could melt the coil.)· It is worth noting that the output of the LM386 is DC-Biased to one half of the input supply voltage.· This project uses 5 volts.· I wrote the little doodad song and ran·the MIDI·file·through·my C++ hack job of a program that created the SX-friendly events file.
I put a small video on YouTube to demonstrate.· Also, I have attached a rough schematic and all SX code files.
http://www.youtube.com/watch?v=Gw6-UOhNJck
Comments and corrections are welcome.
Post Edited (Lord Steve) : 3/21/2008 3:45:16 AM GMT
I put a small video on YouTube to demonstrate.· Also, I have attached a rough schematic and all SX code files.
http://www.youtube.com/watch?v=Gw6-UOhNJck
Comments and corrections are welcome.
Post Edited (Lord Steve) : 3/21/2008 3:45:16 AM GMT
Comments
Very nice project! As a musician who plays keyboards I can appreciate anything with MIDI.
One note I wanted to make…It looks like you’re powering the PDB from the SX48 proto board…I’m not sure on whether that regulator on the PDB can handle that scenario.· The one on the SX48 proto board can (being powered from Vdd), but we never checked into the one on the PDB.· I would be powering the PDB and sending Vdd to the SX48 proto board since the PDB regulator can also handle more current.· Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Post Edited (Chris Savage (Parallax)) : 3/21/2008 2:10:03 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
I enjoyed looking at your project. Excellent job! I wonder what the propeller chip could do with that assignment
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Aka: CosmicBob
I think the propeller could do MIDI in and at least 16-note polyphony.
Is possible port this code to Propeller chip ?
Thanks help
Music Synthesizer object with General MIDI sound set
http://forums.parallax.com/showthread.php?111867-Music-Synthesizer-object-with-General-MIDI-sound-set&highlight=synth+Prop
Toughts about a Propeller based synthesizer
http://forums.parallax.com/showthread.php?126780-Toughts-about-a-Propeller-based-synthesizer&highlight=6581