Monday, July 8, 2013

Breath control revisited

I have been using my breath control and openpipe breakout for two months now and it makes for a really enjoyable instrument. There are some things to develop, first the hardware pipe and pressure sensor compartment should be redesigned, the current is a quick hack. So here comes some notes on designing a new mouthpiece. In some weeks time I hope to be able to add some sound examples and also describe some of the programming.

Designing a mouthpiece

The mouthpiece should allow some air to pass through while playing to make breathing more natural, but also stop the airflow enough for a clearly measurable pressure to build up. To avoid moisture on the sensor board i place the sensor in a compartment after the exhaust hole so that the air stream does not pass directly over the sensor board. Closing the exhaust hole and just using the pressure makes the end of notes sound bad since the pressure doesn't drop cleanly when you stop blowing. The best option is probably to make the size of the exhaust hole adjustable and to let the player decide.

The air pressure in a recorder mouthpiece varies between 200 and 1000Pa depending on the note played with high notes having more pressure. The difference in pressure between pp and ff (loud and quiet) is about 200Pa, these numbers can be found in Modeling of Gesture-Sound Relationships in Recorder Playing: A Study of Blowing Pressure, a master thesis by Leny Vinceslas.
An exhaust hole with 3-4mm diameter gives this kind of pressure on the sensor and feels quite nice to play. I will test more with different sized exhaust holes, how hard to blow and how the pressure varies on the sensor. 

Here is my design sketch for the next version of breath sensor mouthpiece.  I have found very cheap nylon tubing used for electrical installation work that fits snugly around the Open Pipe. I am fairly confident this can built at home with simple tools, the only remaining part is the silicone rubber film. It can be bought 0.3 mm thick 50x50 cm from Germany for 90 euros, a bit much money but its probably enough for more than 600 such mouthpieces  ( I might find some use for a lot of silicone rubber film :) ).

The sensors

Reading both temperature and pressure and calculating the calibrated values takes around 11ms, this time is mostly spent waiting for the chip to complete a conversion.  With careful programming other calculations and sampling of the touch sensors can be done during this wait time. A breakout board can be found for around $15

This sensor seems to have as good or better performance than the BMP085 with faster sampling rate. The calibration and temperature compensation is done in the sensor ASIC and the convoluted calculations needed for the BMP085 are not needed. I have ordered a breakout board for testing.

A further enhancement would be to use a very open mouthpiece and sense both pressure in the middle of  the airstream and total flow, this would more correspond to playing a flute. Not sure what sensors to use for this and how to mount them.

Relation between pressure, tone height and volume

Using the data in L Vinceslas work I set up a table of the normal pressure used to to play the different notes at medium volume.  This value is used as baseline for the note, corresponding to midi volume 64. This means that like in a real flute or recorder, in order to keep a constant volume, the pressure must increase as we play higher notes.

    int volume;
    int midpressure = note_pressure[note-60];

    volume = 64 + ((pressure - midpressure)*psensitivity)/128;
    if (volume < 0) volume = 0;
    if (volume > 127) volume = 127;

This code fragment shows the midi volume calculation, the psensitiviy gives the sensitivity to pressure variation around the standard note_pressure from the table. A value of around 15-20 seems to work quite well. In my test sketch I have assigned this value to a CC controller so it can be changed dynamically while playing.

This has been tested and its easy to dynamically control the expression of the sound.

Using the pressure to control the octave of the note played

If the pressure is more than 2/3 of the pressure difference to the note one octave higher than the one fingered then scale is shifted one octave up and later if it is below 2/3 of the difference down to the original note the scale is shifted back.  This code is still in planning.

Detecting the start of a note

The program recognises the start of a note when the pressure has been more than 50 Pa above ambient for three sample periods (30ms). This is the number of samples needed for the pressure to reach its peak value so that the midi note volume can be calculated. If aftertouch, channel pressure or the expression continuous controller is active then this may be decreased at the risk of losing the initial attack.

1 comment:

progmars said...

So, how did it went?

I've seen people using different pressure sensors with much lower range. For example, MP3V5004GP seems to be one of the lowest you can get with about 0.5 psi (3.5 kPa), which is still higher than 0.2 - 1 kPa, as you wrote in the article. But it should be more adequate than BMP050 and MPL3115A2.

There is also an I2C option ABPMAND001PG2A3 which is up to 1 psi (7 kPa), which is much higher but still might be hugely better option than those BMP050 and MPL3115A2, if I'm not mistaken.