A microcontroller-based digital synthesizer built with the PIC16F1718 that receives MIDI input and generates real-time audio output using wavetable synthesis. Watch on YouTube.
- MIDI 1.0 Compliance: Receives note-on and note-off messages via standard MIDI protocol
- Three Waveforms: Sine, sawtooth, and square wave synthesis
- Real-time Audio: 29.4 kHz sampling rate with 8-bit DAC output
- Monophonic Operation: Single-note melody playback
- Visual Feedback: LED indicators for system status and MIDI activity
- Educational Design: Breadboard-friendly for learning and experimentation
- PIC16F1718 microcontroller (28-pin DIP)
- 6N138 opto-isolator for MIDI input
- LM386 audio amplifier
- TL082 op-amp for low-pass filter
- Standard electronic components (resistors, capacitors, LEDs)
- DIN5 connector for MIDI input
- MIDI-compliant keyboard or controller
- MPLAB PICkit 5 In-Circuit Debugger
- MPLAB X IDE for development
| Parameter | Value |
|---|---|
| Microcontroller | PIC16F1718 |
| Clock Frequency | 16 MHz |
| Sampling Rate | 29.4 kHz |
| DAC Resolution | 8-bit |
| Wavetable Length | 4,096 samples |
| MIDI Baud Rate | 31.25 kBaud |
| Note Range | MIDI notes 48-72 (C3-C5) |
| Audio Output | Mono, amplified |
- Interrupt-driven MIDI processing using EUSART
- Timer0-based audio sampling at 29.4 kHz
- Wavetable synthesis with pre-calculated waveforms
- Integer-based phase accumulation for efficient real-time operation
- Sine Wave: Pure fundamental frequency using lookup table
- Sawtooth Wave: Rich harmonic content with anti-aliasing filter
- Square Wave: Odd harmonics only, calculated in real-time
- MPLAB X IDE (latest version)
- MPLAB XC8 Compiler
- PICkit 5 programmer/debugger
-
Clone this repository
git clone https://github.com/charlesmulder/microsynth.git cd microsynth -
Open the project in MPLAB X IDE
- File → Open Project
- Navigate to the cloned directory
- Select the project
-
Build the project
- Build → Build Project (
Ctrl+F11)
- Build → Build Project (
-
Program the PIC16F1718
- Connect PICkit 5 programmer
- Run → Program Device (
Ctrl+F5)
-
Assemble the circuit on a breadboard following the schematic
-
Connect the PICkit 5 programmer:
PICkit 5 → PIC16F1718 Pin 1 (MCLR) → Pin 1 Pin 2 (VDD) → Pin 20 Pin 3 (GND) → Pins 8,19 Pin 4 (PGD) → Pin 28 Pin 5 (PGC) → Pin 27 -
Connect peripherals:
- MIDI keyboard to DIN5 connector
- Speaker to audio output
| LED Color | Status | Description |
|---|---|---|
| Green | MIDI Activity | On when note is playing |
| Yellow | Framing Error | EUSART error (auto-reset) |
| Red | Buffer Overrun | Requires restart |
- Channel 1: Sine wave
- Channel 2: Square wave
- Channel 3+: Sawtooth wave
Note-on(0x90-0x9F)Note-off(0x80-0x8F)- Running status for efficient message handling
The complete circuit includes:
- MIDI input isolation circuit
- PIC16F1718 microcontroller
- Audio amplifier with gain control
- 2-pole Butterworth low-pass filter (14.7 kHz cutoff)
- LED status indicators
See the full project documentation for detailed schematics and component values.
- Monophonic: Only one note can play at a time
- Pitch Accuracy: Integer sampling increments cause slight pitch deviations
- Limited Range: 25-note range to avoid pitch collisions
- No Polyphony: Multiple notes will overwrite each other
This project prioritizes:
- Sustainability: Breadboard assembly for component reuse
- Hearing Safety: Users advised about volume exposure risks
- Educational Value: Open-source design for learning
Potential improvements include:
- Polyphonic capability
- ADSR envelope generation
- Real-time filter controls
- Additional waveforms
- Higher sampling rates
- MIDI CC parameter control
microsynth/
├── src/ # Source code
│ ├── main.c # Main application
│ ├── midi.c # MIDI processing
│ ├── wavetables.c # Waveform data
│ └── interrupts.c # Interrupt handlers
├── inc/ # Header files
├── docs/ # Documentation
└── README.md # This file
This project is open source. Please credit the original work when using or modifying.
Charles Mulder
Bachelor of Engineering in Electronic and Computer Engineering
Atlantic Technological University Sligo
- Website: charlesmulder.net
- LinkedIn: linkedin.com/in/charlesmulder
- GitHub: github.com/charlesmulder
Project Details:
- Completed: May 2025
- Supervisor: Fabian Connolly
- MIDI Manufacturers Association for MIDI specification
- Microchip Technology for PIC16F1718 documentation
- Academic supervisors and peers for guidance and feedback
- Open source community for inspiration and tools
This synthesizer demonstrates the intersection of embedded systems design, digital signal processing, and music technology - combining technical precision with creative expression.
Star this repo if you found it helpful!
