As a child (about 30 years ago) I started my music lessons on the flute (a recorder to be precise) and now I want a modern electronic version of this instrument (an Electronic Wind Instrument as it's called, abreviated EWI). They are available, but prices start from €350/$400. So I decided to make one myself to see if I could make it cheaper.
Ideally my electronic recorder would also be capable of making it's own sounds like a synthesizer, however although I'm not entirely new to electronics, I’m not an expert either. Also I wanted a design achievable/understandable for beginners with low cost and easily obtainable parts. So decided to start with the most simplest form: a midi controller looking and playing like a recorder using push buttons and air flowspeed detection. The midi recorder connects via a midi-to-usb adapter to a computer which produces sound using a software synthesizer (on a pc, freeware), and (optionally) send it back to the a speaker inside the midi recorder.
The cost of this simple midi recorder turned out to be less than $40!
Although not quite as advanced as a commercial EWI and the construction is my first try, it works fine and I think it is a good base to make all sorts of improvements:
I'll probably show you some of these improvements in a follow-up instructable.
Disclaimer: This instructable describes what I did to make this midi controller. Be aware I'm no electronics or wood expert and don't know much about safety of finishes/paints. (Most of the knowledge I used, I obtained from others and I judged this information to be safe/healthy for my own personal use). You should use your own judgement whether it's safe and healthy to do the same. By using this instructable in any way, you and only you bear the responsibility for all damages occurred by using this instructable.
How it works
As mentioned in the first step, the setup consists of three main components: a computer, a midi recorder controller and a converter which translates the serial midi received from the controller to usb signals the computer receives and sends to the software synthesizer. The first picture shows a schematic of the components above and the data flow between them.
What we need to make
The instructable can be divided in two parts
Step 8 explains how to test your setup and can be used from step 7 onward to constantly check if your modifications ‘broke’ something.
(Installing the speaker in the midi recorder and attached the audio cable/plug to the Midi2Usb converter are optional if you don't mind the sound coming from your computer.)
When using the terms recorder and controller alone or together, you should read midi recorder controller.
You'll need some supplies and basic tools. I got almost all my electrical supplies from ebay, and the rest from a local DIY-store.
Supplies
Part I - step 3 to 7
With these supplies you can test (step 8) if the setup works (plays sound, although without user input since buttons/breath sensor not yet installed)
Part II - step 9 and further (to finish the midi recorder)
Optional - Needed if you want to install a speaker inside the midi recorder:
Some remarks:
Tools needed:
First we need to make an enclosure. Since I found hard to find regular plastic electronics enclosure which are narrow and long enough, I had to look elsewhere and stumbled upon cable raceways/ducts.
To start obtain a plastic cable raceway/duct like the one in the picture. If you cannot obtain this type of duct no problem, but be sure your duct can house the electronics (I wouldn't buy a much smaller duct). If your duct dimensions differ, also be aware you have the modify the dimensions of the wooden strip and block.
My duct has a double bottom, this is not necessary and in fact only troublesome.
Cut two pieces of duct at a length of about 400 mm. These pieces should be mounted together back-to back. My duct had nice holes predrilled to mount it to the wall, which I used to screw (4mm nut and bolt) them together. However you can also use glue (probably the better choice).
Multiple components will need to be provided with 5V and GND and our Arduino only has 1x 5V pin and 2x GND pins. Because of this I added a power distribution board. This board is made by:
attaching a flexible wire to the GND rail to be later attached to the RJ11 jack in the bottom duct.
The circuit board should be placed at the beginning of the upper duct. The flexible wires need to end up in the lower duct. For this you can drill a hole through both ducts. (However I used the slots for the Arduino-pins in the next step.)
I had to divide components over lower and upper duct and choose to place the Arduino Nano and Microphone (Breath Flow) sensor into the lower duct. However the Arduino Nano needs to connect to the power distribution board and buttons in the upper duct. A passage way for the wires between upper and lower duct is needed.
Often the Arduino Nano will be shipped to you with male pin headers (first picture). However I found it easier to attach other components if I use female pin header on the Nano. So I soldered these on. (You don't need to solder on the ICSP (2x3) pinheader, but if you do, you should make an extra opening between lower and upper duct to provide room for these pins.)
The Nano should be put in lower duct (fourth picture) leaving enough room to install the microphone sensor board in a later step with an extra 1 cm margin.
To plug in wires from the upper duct into the pins of the Nano, I made two slots between the two ducts (fifth picture). I used a Dremel and small file for this, but a drill and small file should also work.
The Arduino Nano’s pinheaders are pushed into the slots, This will also keep the Arduino Nano from shifting in de lower duct, so I didn't need to glue/screw it in place.
This fifth picture also shows you that the female pin header can be stacked. By soldering female header to the wires of other components (e.g. the wire ends of the buttons as shown in the picture) you can easily plugin wires into the Arduino through the slots.
Next thing we need to do is connect the Arduino to the power distribution board. Take two flexible wires just long enough to span the distance between the power distribution board and Arduino pins in the upper duct, Solder one wire to the GND rail and the other to the 5V rail of the power distribution board. Then solder these wires to the outer pins of a female pin header of three pins. (So the middle pin has no wire attached.) This 3-pin-header should be plugged into the 5V-RST-GND pins. (See last picture/drawing which highlights the correct pins.)
We only need 3 wires for the midi recorder to work: 5V, GND, and midi out. For the connection to the Midi2Usb converter, a telephone cable seemed a good choice, also because of its flexibility. Because I wanted this cable to be detachable, I installed a telephone (RJ-11) socket.
Install and connect RJ11 socket
The socket is installed next to the Arduino Nano. Because it is slightly higher than the duct, I had to make a hole for the socket to poke through. Since I made the hole a little bit too small for the base of the socket it can't fall through and I didn't need to glue the socket in the duct. As the sockets can differ slightly in size and shape you may have to alter this for your specific socket and/or (hot)glue it.
The third picture with the schematic shows how to connect the socket:
Modify Midi2Usb device
The third picture also shows how to make the telephone cable to the Midi2Usb device. So I replaced the midi-in and midi-out cables of the Midi2Usb device with the telephone cable and attached the wires in the cable as follows:
See last three pictures for the results.
In this step we program the Arduino and install the software synthesizer.
Programming the Arduino Nano
If you are not familiair with the Arduino platform check out their website: https://www.arduino.cc/en/Guide/HomePage. For the windows platform you have to follow these steps:
Explanation of sketch
I tried to keep the sketch as simple as possible and decided not to use flute fingering (in which notes are combination of button presses), but piano fingering (in which each button press is different note):
For more info about how midi works, see this excellent instructable: https://www.instructables.com/id/What-is-MIDI/.
Software synthesizers (vst) often come as plugins with file extension dll. These plugins need a host to run. A nice free vst-host is savihost. I choose the VST2 version, including keyboard. You can download it from http://www.hermannseib.com/english/savihost.htm.
You can use almost all vst plugins you like, since we only send the most basic midi messages to the synthesizer (noteon/noteoff and volume change messages). Some suggestions on plugins (all free to use):
I like to use Lxox_Flute because of it's simplicity and nice flute simulation. Elek7ro is also not too hard to understand and lets you create other instruments. Synth1 has a nice set of predefined wind instruments and lets you remap your breath volume to another effect. TX16Wx lets you use your own sample sounds (wav-files). Kontakt 5 has a nice solid feeling to it.
To run a plugin you need to rename (or copy) savihost.exe to match the filename of the vst-plugin dll-file. After running the new exe, make sure to activate midi in menu 'Devices'>'Midi' and set the 'Input Port 1' to your midi2USB device (see first picture).
Note: I noticed the Lxox_Flute plugin does not make sound on low octaves. The Arduino 'Oct' variable is set to octave 5 which works on my setup. If this doesn't work on your setup (improbable) you can change the Arduino 'oct' variable or transform the octave via VSTHost menu 'PlugIn' > submenu 'Transformation' > set 'Channel' to '1' > set 'Transposition' to '+1 Octave' (see second picture).
At this point we can test if the communication from Arduino to software synthesizer (on computer) is working:
Because we don't have any buttons installed, the Arduino Nano will enter demo mode and send a melody through the midi2usb converter to your software synthesizer. The synthesizer converts this midi info to sound which you here coming out of your computer!
I installed 8 buttons in the upper duct and 1 (thumb) button in the lower duct.
The buttons are soldered to a piece of perforated circuit board just small enough to slide into the duct, but not too small to prevent it falling out. My perforated board is only wide enough for four buttons, so I needed two pieces for the upper duct and one small piece for the lower duct. I also found it more comfortable if the pink button has less distance to the previous button than the others.
We need to provide every button with ground, 5 volts and a data line. The circuit picture shows how to connect the buttons (dashed ground line is on the back side of the perf board, red and purple solid lines are on the front side of the perf board). In the overview picture you can see that I routed the (purple) data lines of the right board underneath the left board so the cables wouldn't prevent the lid to close.
I soldered the data lines of the buttons in the upper duct to a female 8-pin header for easy insertion into pin D3 to D10 of the Arduino Nano. The 5V and GND lines were connected to the 5V and GND rails of the power distribution board.
The data line of the thumb button was routed through the hole between lower and upper duct and inserted into D11 of the Arduino Nano. (In this case using a female 2-pin header.) You can also route the 5V and GND lines of the thumb button through the hole and solder them to rails on the power distribution board. However I soldered them directly to 5V and GND of the RJ11 socket to minimize on the amount of wires going through the enclosure.
After installing all buttons (upper duct and lower duct) we can drill the holes in de lid. I used a 10mm drill bit. This is a bit larger than needed but gives some room for shifting the button boards in the enclosure without the buttons catching the side of the holes and coming stuck after pressing them.
After this I placed the lids and install the button caps. The boards should sit high enough in de duct to give the buttons enough room to be pressed down. Two buttons didn’t sit high enough and couldn’t be pressed down, so I slid some paper underneath the board to lift the button up towards the lid.
Note: If you want to install the speaker, you need to keep extra room between the thumb button and the RJ-11 socket to place the audio socket in step 11.
The microphone sensor board will be used as a simple airflow sensor and listens
to the amount of sound your breath makes. The harder you blow, the higher the audio volume that will be detected.
I installed the sensor board it in the bottom duct. Since my board came with the microphone up-right (see first picture), I had to bend it to lie on its side (see second picture). There are also variations of this board with the microphone already on its side.
The microphone board has a potentiometer which makes it too high for the duct and this potentiometer has a screw to fine tune the microphone. So I needed to make a square hole in the lid to make room for the potentiometer and to keep the screw accessible. For this I drilled two (round) holes next to each other and used a small file to square the shape.
The board should be connected to ground and 5V. The analog pin on the board is connected to A0 of the Arduino. All wires are routed through the hole between bottom and upper duct.
This step is optional and only needed if you want the sound to come out of your midi recorder instead of your pc.
Also I first tried to send the audio signal over the remaining wire in the telephone cable. However I soon found out that due to interference the sound quality became very bad. Because of this I used a seperate audio cable to transport the audio signal, which gave much better sound.
The only common connection between the audio circuit and the arduino circuit is the 5V coming from the telephone cable (and besides powering the arduino/buttons/microphone via the power distribution board) which also powers the amplifier board. So there is no direct ground connection (adding this seemed to enhance the audio interference) and I rely on the ground circuitry inside the pc. Consider if you find this wise for your own build!
In this step the audio socket, the speaker and amplifier are placed in the lower duct. The socket is placed between the RJ-11 socket and the thumb button, the amplifier board is placed on the other side of the thumb button, the speaker at the end of the duct.
The speaker just fits if we trim the receding rims to make some room (first picture). I used a hobby knife to carve the inner rims away. Then I attached two wires to the speaker (green and white).
Next up is drilling the holes. Since we want to mark where they need to be, I applied masking tape to the lid. (This also makes removing the markings a lot easier.) First I marked the corner holes to fix the speaker to the lid using small bolts. I used the speaker as a template to mark the corner holes and drilled them with a matching drill bit (2mm, second picture - red circles). After this I drawed a grid on the lid to mark all the sound holes and used a slightly bigger drill bit (3mm).
The amp board was placed between the thumb button and speaker (see fifth picture, second one from the bottom). 5V of the amp board (bottom left) can be connected to the power distribution board, but since the thumb button also has 5V and to reduce the wires, I connected the amp board here. The audio wire (green) from the audio socket was connected to the audio-left-in of the amp board (upper left). The ground wire (white) from the audio socket was connected to audio-ground of the amp board (upper left).
Only thing left is connecting the speaker wires to the audio-out-left of the amp board (upper right). It is not really important if we attach the white speaker wire to + or -, (but would be if we would have connected two speakers.)
Bottom picture shows the closed duct with speaker and amp board inside.
Note: The second picture from the bottom shows a schematic instead of the photo of my resulting lower duct. This is because my RJ-11 cable broke and without a new one at hand I removed the RJ-11 and audio sockets and installed a perforated board instead. To this add-in board, I soldered the RJ-11 cable and audio cable. After this I connected the 5V/GND wires coming from the power distribution board, the midi wire from the Arduino TX pin and the audio/GND wires from the audio-cable.
Shaping the mouthpiece
For the mouthpiece use a block of wood equal or slightly larger than the dimensions of the ducts. For my ducts this was about 24 mm thick and 28 mm high. I choose a length of 70 mm. Next I made a nice shape for the mouth using first a coarse file, followed by finer files and finally fine sandpaper.
The schematic shows how I shaped the mouth piece and where I drilled the holes for the air channel. The diameter of the holes on the mouth side are 2mm-4mm and are filed down to a nice oval opening. On the back two holes are needed: A hole at the bottom which exits to the microphone (via an inserted straw) and a hole in the middle which connects the mouth opening to the opening for the straw. The end of middle hole is plugged so all air exist via the straw in the bottom hole. The diameter of the holes on the back end depends on the diameter of the straw you use, which in my case was 10mm. This diameter also depends on the air flow you feel comfortable with and of course what type of straw you can obtain/buy.
Preparing the straw
The mouthpiece and microphone sensor are connected with before mentioned straw. This air you blow in the straw will contain harmful moisture, so I put a piece of plastic foil (from a sandwich bag) at the end of the straw. (If the foil at this end is pressed against the microphone, the sound will still be detected.) However now the air cannot escape, so I cut a hole in the straw and a corresponding opening in the bottom duct at the corresponding position.
Securing mouthpiece to enclosure
The only simple solution I could think of to secure the mouthpiece to the enclosure was to connect them with wooden strips at either side.
I made the strips as long as the combined length of the enclosure and my mouthpiece (470 mm in my case). Using standard wood glue I first glued the sides to the mouthpiece. Next I placed the enclosure in between and drilled two holes through at the beginning and end of the enclosure, avoiding hitting any electronics. Using cabinet screws (see last picture) I screwed the plastic enclosure in between the strips.
Protect the wood from moisture
Especially the mouth piece needs protection from moisture in your mouth.
I applied a clear finish (multiple times) to the outside of the mouth piece and also (for aesthetic reasons) to the side strips. I used a toy safe "rust-oleum clear sealer satin - toy safe"
Also the inside of the mouthpiece (the air channel) needs protection. I treated this with a little bit of vegetable oil (olive should also work).
Alternative straws
I tried some variations on the straw design, see second picture. I expected the second double straw design to be more effective since it forces the air stream to pass closer by the microphone. I also expected the dogwhistle to be more effective since it produces sound (inaudible but sound nonethteless). By more effective I mean that the sensor values should be more stable and easier to (graduately) manipulate with your breath.
I was suprised to find the other designs made no significant difference, and it was even more difficult to reach a high sensor value with the dog whistle. Since the original design is easier to build than the double straw design and cheaper than the dog whistle, I decided to stick with it.
I recorded some audio samples to give you an idea how your result might sound. I maximized the volume for optimum sound resolution. You might want/need to turn your volume down!
1. Demo with gradually increased air flow / breath with the Synth1 plugin, with instrument '81:Square lead'
https://www.youtube.com/watch?v=7-Y3K0Y8nJQ
2. Flute synthesis with the Llox_Flute plugin
https://www.youtube.com/watch?v=HScyJ3kJcQY
3. Star wars theme with the Synth1 plugin using SynBrass and Sax intruments.
https://www.youtube.com/watch?v=o-IGGUbUlEQ
https://www.youtube.com/watch?v=m5bny5rwt2E
Note: It was 30+ years since I last handled a flute and never became very good at it. So especially the Star Wars theme is sort of a worst case demo!
I got advise on how to protect the mouthpiece from moisture from the following sellers of recorders:
I bought the sealer to treat the mouthpiece from:
For info on how to use midi on an Arduino see the following Instructables:
Audio was recorded with the integrated recorder of Savihost:
TunesToTube was used to convert the audio samples to youtube videos: