Synthberry is a software synthesizer written for the Raspberry Pi in C++11. This is a personal project and currently work-in-progress, source may break at any time.
My main motivation for carrying out this project is to gain knowledge about (software) MIDI synthesizers in general.
After cloning the synthberry repository you need to retrieve the dependencies:
git submodule update --init --recursive
Having done that, you can build the source by issuing:
make
Now you can run synthberry as follows:
LD_LIBRARY_PATH=externals/libserial/src/.libs bin/synthberry
Cross-compiling the source on a PC is much faster than compiling it natively on the Raspberry Pi. I recommend you to use this if you expect to make changes or additions to the code as it will speed development up significantly.
Follow the above steps, but instead of simply running make
run the following:
make rpi
The raspberry pi toolchain consists of 32-bit executables, on Debian and derivatives you may need to do:
sudo apt-get install libc6-i386 lib32stdc++6 lib32z1
Documentation for the synthberry source can be generated by running:
make doc
This target depends on doxygen
and dot
(part of graphviz). By default only
the HTML documentation is generated. A number of other formats are available
and can be enabled by editing the Doxygen configuration file.
Up-to-date documentation can also be found at: http://derecho.github.io/synthberry
Detailed documentation for the current source is under way.
Milestones:
- Parse MIDI messages
- Implement a basic oscillator
- Implement an audio output
- Implement some typical synthesizer modules
In order to accomplish these steps, the appropriate design decisions may have to be made first. The goal is to have an easily extendable codebase which will allow a user to quickly create his own software synthesizer setup.
Currently if you compile synthberry in debug mode (see the help
target), you
will be able to see any parsed Note On and Note Off messages.
I'm using the Raspberry Pi's hardware UART to connect my MIDI keyboard (Yamaha PSR-280). The UART clockrate has been adjusted with boot parameters so that data can be received at 31250 baud (looks like 38400 to software).
This kind of setup seems to be quite common, for more information I'd like to refer you to an article on Silicon Stuff: http://www.siliconstuff.com/2012/08/serial-port-midi-on-raspberry-pi.html
Since the Raspberry Pi's analogue audio out port only offers 11-bit of sample resolution and because the sound is generated using PWM, I'm using a cheap chinese USB 1.1 audio card that I had lying around. The card appears to use a C-Media chip. Again, using a USB audio card seems to be common with the Raspberry Pi.
The Raspberry Pi can usually power the USB audio card just fine, but will lock up the filesystem or produce no sound once in a while. For this reason I'm using a powered USB hub.