During the past months we’ve sent several OpenPipe Breakout prototypes all over the world (Spain, USA, Russia, France, …), and we know there are some happy OpenPipers almost ready to show us their work. In the meanwhile, we would like to announce that we’ve no more white OpenPipes Breakouts for sale. The OpenPipe Breakout Black Edition is here!!!
We’ve improved the manufacturing process, and the look&feel. Now the capacitive sensors are also black, and we ship the OpenPipes with tinned wires in order to let people addapt to their designs easily. You can connect the wires directly to Arduino as well.
We’ve also been playing a bit with Wavetable Synthesis as you can see in the previous post, in order to demonstrate the high sound quality you can achieve with the OpenPipe Breakout, Arduino and audio shields. Some people sent us several european bagpipes samples, and we added them to the code examples as well.
In the previous post we talked about generating bagpipes sounds using WaveTable Synthesis with Arduino (44KHz @ 8bit) and PWM. The result is good but we can increase sound quality a bit more using an Arduino Shield for audio generation like the one from OpenMusicLabs.
The Audio Codec Shield is an Arduino shield that uses the Wolfson WM8731 codec, capable of sampling and reproducing audio up to 88kHz, 24bit stereo. The Audio Codec Shield has 1/8″ stereo input and headphone output jacks, a single pole analog input aliasing filter, and 2 potentiometers for varying parameters in your code. (http://www.openmusiclabs.com/)
So we created sound samples now at 44KHz and 16bits, using the same Python script, but now we added some new bagpipes sounds (apart from Galician Bagpipes) thanks to Tim Malcolm from eChanter project, who managed to bring us the recorded sound samples.
Säckpipa: based on sound samples recorded by Alexandre Aebi.
In this post we will explain how to generate high quality sound with Arduino using wavetable sysnthesis, with bagpipes in mind, of course!!!
The code used here is based in the eChanter, a DIY electronic bagpipes project built around Arduino. Thanks eChanter for the inspiration. We added some cool features in order to let people create custom fingering tables and sound samples.
Wavetable Synthesis in Arduino
The easiest way for sound generation in Arduino is using PCM and PWM. This means that we have the sound samples stored in the Arduino memory (PCM, Wavetable Synthesis) and we periodically loop this stored samples using PMW.
PCM streams have two basic properties that determine their fidelity to the original analog signal: the sampling rate, which is the number of times per second that samples are taken; and the bit depth, which determines the number of possible digital values that each sample can take (Wikipedia).
Due to the limitations of the Arduino PWM we can use only 8 bits bit depth, but regarding sample rate we are able to use up to 44100 Hz, as long as we don’t need to do a lot of processing in the Arduino loop().
How does it works? A periodic function called ISR interrupts the Arduino loop() every 1/44100 seconds, reads the next sample value stored in the FLASH memory, and updates the PWM register in order to generate an analog signal in the PMW pin. The PWM output is not a true anlog signal but a pulse train, so the generated sound will have some high frecuency noise.
So, we need to store in the Aduino memory the sound samples for every note we wanto to play, and we have basically two ways:
Storing a true sound sample loop. We need to record a good sample of every instrument note and edit this sound sample in order to make it a loop (learn more).
Storing a digitally generated sound sample based on additive synthesis. We can analyze a true sound, extract the partials and then use this information for generating the loop.
Our choice is the number 2. We used a small python script that generates the loops ready for storing in the Arduino memory based on additive synthesis.
The Arduino sketch provided has sound samples for Gaita Galega (Galician Bagpipe) and Great Highland Bagpipe. If you would like to generate a different instrument, and you can’t manage to analyze the sound partials, please drop us a line (and attach the sound samples).
Not every bagpipes have the same fingerings, so we need a way to relate fingers positions and notes. We wrote a python script in order to let people create new openpipe fingerings for any instrument. We’ve currently defined Gaita Galega (Galician Bagpipe) and Great Highland Bagpipe fingerings.
Here you can see the way we define a fingering.
# GREAT HIGHLAND BAGPIPE#http://www.bagpipejourney.com/articles/finger_positions.shtml
great_highland_bagpipe=(("GREAT HIGHLAND BAGPIPE"), #FINGERING NAME(67), #BASE MIDI NOTE (THE LOWEST IN THE TABLE) G4(69), #TONIC MIDI NOTE A4(57), #DRONE MIDI NOTE#FINGERINGS (SEMITONES FROM BASE NOTE, (FINGERINGS,))(0,("-C CCC CCCC",)), # LOW G (G4)(2,("-C CCC CCCO",)), # LOW A (A4)(4,("-C CCC CCOO",)), # B (B4)(5,("-C CCC COOC", "-C CCC CO--")), # C (C5)(7,("-C CCC OOOC", "-C CCC OO--")), # D (D5)(9,("-C CCO CCCO", "-C CCO ----")), # E (E5)(10,("-C COO CCCO", "-C COO ----")), # F (F5)(12,("-C OOO CCCO", "-C OOO ----")), # HIGH G (G5)(14,("-O OOO CCCO", "-O OOO ----")), # HIGH A (A5) )