Intro
This Pi-Fest music technology Design Challenge project attempts to add interest to the blogs by including interactive elements for the audience. This involves challenging you to identify the mystery music in each blog, created of course by the project hardware itself.
My mission is to design and build a Raspberry Pi Pico MIDI synthesizer. This is part of a bigger plan to build up a capability to create rudimentary amateur music that I can embed in my blogs. One of the main reasons for this is the morbid focus in the music industry to extract fees from anyone who wants to play an excerpt of copywrite material. In sharp contrast to the electronics industry where there are any number of free circuits available. But enough with the soapbox, I want just do my own thing without worrying about draconian copywrite police bots and their vendettas.
Your mission, should you choose to accept it, is to identify the songs played by the synthesizer in the videos embedded at the end of each blog.
There is also a technical "Mission Impossible" in blog 3, should you choose to accept it.
Here is a simplified block diagram of the PICO MIDI Synthesizer System:
Conceptually the PICO Synthesizer simply translates MIDI data in real time into programmable sound generator (PSG) data and then the PSGs translate that data into audio that is played by speakers. In this project I will design a printed circuit card to implement this block diagram.
Programmable Sound Generators
The real magic happens in the programmable sound generator chips, so I will briefly describe some of their capabilities without bogging the blog down with register programming minutiae. The programmable sound generator (PSG) chips in this system each have three simultaneous digital-to-analog sound outputs. Each output has a mixer that can mix an optional tone generator with an optional noise generator and the result can be modulated by a programmable envelope shape. Add in the amplitude controls and you have a pretty flexible sound system capable of generating very complex waveforms, especially if all 3 outputs are added together. In this project I am only trying to generate musical notes, but the PSG chips are capable of a much wider range of sound effects. There are 16 memory-mapped registers that control all parameters, allowing sounds to be generated while the processor is busy doing other tasks. The registers only need to be updated when the sound parameters need to change.
As mentioned the system I am designing here takes standard MIDI (Musical Instrument Digital Interface) serial data and converts it to music coming from speakers. The Raspberry Pi Pico interprets serial MIDI data and generates appropriate PSG sound parameters, which it loads into the PSGs at the appropriate time. The basic components needed are listed below:
- Optically isolated MIDI receiver
- Raspberry Pi PICO
- Two AY-3-8910 Programmable Sound Generators
- PAM8403 stereo audio amplifier
- A custom enclosure
Schematic Diagram
The components are decided, now we need a schematic.
I have been messing around with AY-3-8910 programmable sound generator chips recently using arduinos, but the programs are right at the limit of their available memory and I actually needed to perform a code reduction exercise to get the program to fit. The Pico has far more memory and is a much faster MCU, so all of those issues go away. However there are some features of the Pico that prevent a direct import of my arduino code.
The serial ports are different, the counter timers are different and the pinout is different, so I needed to work through those differences.
My big thing is designing PCBs for projects like this, and also 3D printed cases.
The circuit connects 2 synthesizer chips to the Pico which allows 6 sounds to be played at the same time. All sounds are combined in an audio amplifier that can drive large speakers.
Here is the schematic:
The PSGs are 5 volt NMOS while the PICO is 3.3 volt CMOS, so we need to ensure we are driving and receiving signals at valid voltages. The AY-3-8910 data sheet indicates it sees a logical "0" when the voltage is below 0.6 volts and a logical "1" when the voltage is above 2.4 volts. The PICO drives these logic levels with excellent margin even when its own supply is 3.3 volts. Since I am only sending data to the PSGs, I don't need to worry about how high the PSG can drive its output pins, even though they would likely work with the PICO.
The MIDI signal is also often 5 volts, but the optical isolator allows any MIDI voltage to be translated to the PICO's internal 3.3 volt levels.
All six (1 volt each) analog outputs from the PSGs are summed together before the audio amplifier is used to increase the signal power so it can drive low impedance speakers.
There are 4 optional switches that allow more features to be controlled in future firmware expansions.
Mystery Music Medley 1
Now here is the first Mystery Music video - a medley of MIDI music snippets played by the PICO Synthesizer to see if they are recognizable enough for you to identify:
Conclusion & Discussion of this Blog
This project was started months ago, but suffered from many delays and issues, which I hate to dwell on. These have forced some adjustments but I am happy to finally have a system working and be working through the blogs for this design challenge. I am making an effort to keep the blog content simple. this is always a goal, but ironically sometimes it takes more effort to make things simple. This schematic works however I did add an external oscillator at R1. This will be discussed further in blog 3.
The project will have 5 blogs:
- Introduction and circuit schematic description
- PCB layout and manufacturing
- Firmware and issues
- Mechanical enclosure design and features
- Project summary and discussion
Each blog will include a Mystery Music Medley.
Relevant Links:
Blog 1 - Introduction and circuit schematic description
Blog 2 - PCB layout and manufacturing
Blog 3 - Firmware and issues
Blog 4 - Mechanical enclosure design and features
Blog 5 - Project summary and discussion
Pi-Fest Music Contest page
AY-3-8910 Datasheet
Dual Synth link