I like the idea of making a DIY midi saxophone. Just a very basic one to make some noise

I'm guessing the hard part is measuring the breath. You could measure pressure, but if you're simulating a real sax it would have air passing straight through. I'm not sure the pressure would change much?

I added a basic breath sensor to the pastry saxophone. It kinda works! The response of the breath sensor is quite slow - I think I need to use something stretchier than a nitrile glove. It doesn't feel sensitive enough to do staccato notes or anything yet.

I didn't get dynamics working with the USB MIDI yet, but on/off breath control works well

The breath sensor works like this guy's video: youtube.com/watch?v=es92GqYBge

The black tape all over it is to block out light - I found it was making a big difference to the readings.

Some quick sketches for a 3D-printed version of the mouthpiece. I can sandwich a membrane between two halves and make the whole thing a lot smaller.

The volume of air inside is smaller, and I'm hoping that means that the response to changes in pressure will be faster, enabling me to do quick staccato stuff.

Here's a first draft of the mouthpiece half - this should work ok. The other half with the sensor should be quite simple and can wait until tomorrow.

I've started printing the mouthpiece and designed the sensor half of the breath sensor. This uses a TCRT5000 IR reflectivity sensor, which shines at a diaphragm clamped between the two halves.

When you blow into the mouthpiece, the diaphragm expands towards the sensor, increasing the amount of IR that's reflected back into it.

Aaaand version 1 of the electro-sax mouthpiece is sort of assembled! It seems like it'll work but I won't be able to test it until the actual sensor arrives at the end of the week.

Electro-sax is just a way cooler name than midi sax

Dynamics now work! I'm using the breath velocity value from the cardboard breath sensor to set the MIDI breath controller value, and mapping that to volume in the synth. I'm sure there's a much more complex and nice-sounding config that can be done, but this is cool!

It needs to be a bit more linear, but that just means making some sort of calibration curve for the sensor. That can wait until I've got the 3D printed one working.

I've put the code up on gitlab.com/gbrnt/electro-sax

There's currently a latency problem - I need to check whether it's on the Arduino end or on the computer end. The breath sensor has some extra latency - I think that comes from the current prototype but I'm not entirely sure.

The end-to-end latency of the electro-sax is definitely too high right now. It's recommended to get it below 10ms (if you can) and here it is at 160ms.

That's enough that when you're doing something like a run of short notes you do one too many because the sound hasn't caught up yet.

Let's see how much I can improve this just by changing Jack settings. Not sure how Pipewire comes into this.

I got a MIDI app on my phone and connected the electro-sax with a USB OTG cable - the latency is much lower! It's definitely low enough to be fun to play now.

So that means I have to delve into linux audio again. I might just revert from Pipewire back to Pulseaudio just to see what effect it has.

So far in my attempts to improve the sensitivity of my breath sensor, I've managed to make it worse.

The first cardboard prototype had a range of 0.38V, or 77 counts in an Arduino's 10-bit ADC. Ideally it'd be more than 127 for a completely step-free MIDI reading.

The 3D printed prototype got me 18 with the nitrile glove membrane, or 31 with a white balloon. Not great. Hopefully the sensor I designed it for will arrive tomorrow and I'll be able to try it out.

I also got a BMP280 pressure sensor, which should be able to be polled fast enough to get useful readings. That might be an avenue worth pursuing as it can be in quite a small chamber!

Hmm, not doing great with the BMP280 pressure sensor. It works really nicely for detecting a change in pressure, but it doesn't seem to be very good at going back to its original zero point.

So in the screenshot you can see the lows are at different points each time I stop blowing. I assume it's doing something clever, but whatever it is it makes it less useful to me.

@gbrnt If you leave it for 8 hours, does it level out at a certain point?
Follow

@sj_zero Probably, even in a few minutes I can see it leveling out. The problem is I was hoping to use it to detect whether to play a note or not, and that's hard when the baseline keeps changing.

@gbrnt I'm just wondering if the issue has to do with it being a brand new sensor and if you cycled it a few hundred times it might mellow out.

@sj_zero Huh that might be worth a try! I'll leave it connected and test it again tonight

Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!