Subsystems
WavePainter consists of two subsystems: the Graphical User Interface and the synthesizer.
GUI
The user interface will be written in Java. It will accept input from the touchscreen and pass the new wavetable data to the synthesizer.
Synthesizer
The synthesizer will accept input from the GUI application and the MIDI interpreter and produce the corresponding sound. Sound is produced using wavetable synthesis.
Using Jack Audio
The Jack Audio Connection Kit is a C/C++ library for writing and connecting audio applications on Linux or Windows. It is designed to be low-latency, and as such is used by some electronic musicians in their live setups. Although the Raspberry Pi does not have very fast hardware, it should be possible for a Jack application to perform well enough to produce a decent sound. Jack also provides an API for interacting with MIDI.
The synthesizer application will be written in C or C++ using Jack, and will communicate with the GUI application using a Linux pipe.
Using an Arduino/Teensy
If the Raspberry Pi did not perform well enough to run the synth application, then the synth would have been implemented on an Arduino or Teensy. Wavetable data would delivered over the USB serial connection between the RPi and the microcontroller. MIDI would either be delivered through a MIDI in port hardwired to the microcontroller, or would be handled by the RPi and passed over USB serial as well. Both devices have advantages and disadvantages: the Arduino is easier to program and is a more stable platform but does not have a real analog out (requiring the use of filtered PWM), while the Teensy has an analog out for audio but is more difficult to use. Programming a performance-focused application for either of these platforms will require bypassing the Arduino libraries and using the AVR builtin methods for interrupts and setting values of GPIO pins.
Hardware
This project will be implemented on a Raspberry Pi, using the Adafruit PiTFT 2.8″ TFT Capacitive Touchscreen.
This work is licensed under a Creative Commons Attribution 4.0 International License.
I’m looking forward to seeing how your project turns out! If you have to switch from the Raspberry Pi, would you have do a lot recoding or would the transition be easy? If it would be difficult do you think it would be worth it to start with the “safer” option?
If the Raspberry Pi is not fast enough for synthesizing in real time, then I will have to write a completely new synthesizer application for the Arduino or Teensy. The code will will work quite similarly – where on the Pi with JACK audio I write a callback function which gets called periodically to fill the audio buffer with samples, on the Arduino this would be a Timer Interrupt handler with just about the same functionality. Although I’m writing in C for both platforms, they use completely different libraries.
That being said, I think it’s still worth starting on the Pi. I know people have had success in the past with real-time applications on the Pi. If it isn’t performing well the first thing I will do is to try to optimize the Pi by removing other programs that I don’t need running – for example since this is a self-contained device I don’t need the network.