Wednesday, January 27, 2016

Music and Me Part 3

Around two years ago I wrote about building a pipe organ in a post called Music and me continued. At the end of that post I said that the number of solenoids that I would need would cost quite a bit of money and I wasn't sure when I would get back to it (i.e. I am too cheap to spend that kind of money on the project.)

Well, my friend Jim from across the street came over just before Christmas and I was showing him the pipes that I had made and he asked what the next step was in the project. I said that solenoids were too expensive to take it any further and by way of illustration I called up the Electronic Goldmine website ( and what to my wondering eyes did appear but solenoids on sale for $5 each. I quickly penned a letter to Santa and there, under the tree on Christmas morning were 42 solenoids. I was back in motion once again.

Jim and I spent hours working on designs for the configuration for the solenoids and eventually hit on something that we thought would work, and here it is in the flesh.
In the lower part of the picture is the "wind chest" that I mentioned in my last post on this topic. This is a design that I pretty much just stole from Matthias Wandel from his website. For springs I used hacksaw blades because they are made of spring steel. You can see that there are two rows of valves with the (mostly) white hacksaw blades pressing them down (closed). Above the wind chest you can see that there are two aluminum angles, the bottom one is populated with solenoids, the top one not yet.

Running down from the solenoids you might be able to spot thin wires attached to the valves. When the solenoid is powered it pulls on the wire and opens the valve.

So far so good. How do I play music? I mentioned in an earlier post that I planned to use MIDI (Musical Instrument Digital Interface). This is a standard that is more than 30 years old. It is used to control digital musical instruments like synthesizers, to manage stage lighting and pyrotechnics that are coordinated with music and so on. There are many thousands of songs in MIDI format available for free online. These are not sound files, though. They are instructions on what notes to play, when, for how long, and at what volume. Here is an example of some lines from a MIDI file converted to text.

   4: 1:  0  |On Note | chan= 3   | pitch=C#2 | vol=66
   |On Note | chan= 3   | pitch=C#1 | vol=64
24 |On Note | chan= 3   | pitch=F#2 | vol=52
43 |(Off) Note  | chan= 3   | pitch=f#2
48 |On Note | chan= 3   | pitch=G#2 | vol=56
61 |(Off) Note  | chan= 3   | pitch=g#2
72 |On Note | chan= 3   | pitch=E 3 | vol=88
   |On Note | chan= 3   | pitch=B 2 | vol=76
   |On Note | chan= 3   | pitch=F#2 | vol=76
   |On Note | chan= 3   | pitch=G#2 | vol=68
90 |(Off) Note  | chan= 3   | pitch=g#2
91 |(Off) Note  | chan= 3   | pitch=b 2
94 |(Off) Note  | chan= 3   | pitch=c#2
95 |(Off) Note  | chan= 3   | pitch=e 3
   |(Off) Note  | chan= 3   | pitch=f#2
      2:  8 |(Off) Note  | chan= 3   | pitch=c#1

The numbers on the left are timing. Then comes the instruction. The channel is the instrument, then the note, and finally the volume. This particular MIDI file breaks each beat into 96 increments. So, for instance, the first line says "at the beginning of the first beat of the fourth measure, for instrument number 3, start playing C# in the second octave at a volume of 66". The next line says "at the same time start playing C# in the first octave". Then after 24/96ths of a beat (or actually 25/96ths of a beat because the counting starts at 0 rather than 1) start playing F# in the second octave. Then 19/96ths (43-24=19) of a beat later turn of F# in the second octave. And so on, and so on.

I had an Arduino Due microcontroller and hooked up an SD card reader to it and put a MIDI file on the SD card.

Here is the Arduino. It has 53 output pins. Under program control it can turn each of these on or off. I wrote a program on the Arduino that assigns each note to a pin. Then it reads the file and turns the pins on and off with the correct timing. Since I only have 42 notes on the organ I only need 42 pins. These pins can only supply a tiny amount of electricity, however, not nearly enough to trigger a solenoid.

My sister Monica and her husband Jim happened to be visiting, and she and he and I built this board.
The main components are 42 transistors. These work like electronic switches. The tiny amount of electricity from the Arduino can turn on a transistor, and a transistor can switch enough electricity to trigger a solenoid.

I still have to wire all this stuff together but I'm pretty confident that it will work

And what about all those pipes, you might ask. Not tons of progress on that front, with one exception. Again, I have been using the information provided by Raphi Giangiulio's YouTube videos on how to make wooden organ pipes.

In looking at his specifications there was something that didn't make sense to me. As the pitch gets lower the pipes get bigger until we get below C below middle C. Then they are significantly smaller. I didn't understand that so I sent an email to Raphi and he generously responded and explained that Bourdan pipes are stoppered. That means there is an airtight stopper put into the pipe and that lowers the frequency. It's counter-intuitive but it works. Here are a series of five pipes in order of frequency with the lowest on the left.

And here is a shot of a couple of stoppers.

I have only 18 pipes of the 42 pipes made, and so I am not nearly finished with the project but I am re-invigorated. I'll keep you up-to-date.


  1. Hi I am very interested in your build as I am doing some reading before I start my own build. Would you be happy to share your code ? Well done and a great read . Thanks Iain

  2. Thanks Iain. I'd be happy to share my code. There are a couple of things that I would do differently, however, and I'd like to share those with you as well. Rather than do all that here why don't you contact me at and I'll give you all the info.

  3. What a great job and build up. I am interested in the code too. For a similar reason: my father is building a pipe organ with traditional paper. I want to build an add-on on his "block" reading the paper. This add-on will open/close the holes by solenoids driven by an Arduino. But I tried to understand and read midi-files but I seized up on that. How can we get in contact for this.

    1. Hello, Marco,
      Thanks for your comment. Let me describe how my pipe organ system works. I pre-process the midi files, using a raspberry pi, converting them from binary to text files. I do this for a couple of reasons. First, it lets me calculate the timing for the entire piece, accounting for tempo change, channel changes and so forth. Second, I have the organ play lots of different midi files, most of which have no pipe organ parts under the General Midi specification. The text files make it easy for me to change the instrument specified for a particular channel. The raspberry pi then sends the note-on, note-off commands to the arduino to execute. I used a python library posted on github by vishnubob to assist in the conversion from binary to text. I'm happy to give you my code but I'm not sure it would be directly applicable. Contact me at and I'll send you the code or if you don't think it will work for you maybe I can help you in some other way.

  4. Brilliant build- I have just acquired a full set of old church pipes - and am planning building a midi juke box for them - can you please let me know the spec of the solenoids you used ? voltage/current draw etc .

    Many thanks


    1. Stephen, thanks for your comment, and congratulations on the acquisition of the pipes. The solenoids that I used are Dormeyer PC-IL. They are 12V with resistance of about 20 ohms so they draw about 0.6 amps. I bought them from an electronics surplus place here in the States called Electronic Goldmine, but they no longer list them on their website. Having said that, at least in the US Dormeyer is a very common brand. The question is just how much you wind up paying for them. These are rated for continuous duty and when I have run the organ for 8 hours straight at the Orlando Maker Faire they barely get warm. On later blog posts I got the clacking under control using neoprene o-rings. I am happy to share any other details of my project that you might find helpful, and feel free to contact me on if that is more convenient. Also, I would love to hear about your project as it progresses.

    2. Many thanks for the reply - I have bought one of these to try and see if it works with air - and have them switched with a transistor similar to your setup .. Am trying to design a step-sequencer for my pipes in addition to a midi player ..... not sure those solenoid valves will be able to stay closed however ? Will let you know what happens !!

    3. Stephen, that would greatly simplify things if you could use those valves. I would offer-up a couple of thoughts. Given that you were smart enough to grab those pipes when they came available you have probably thought about this but you need to be thinking about what pressure to run the pipes at. The reason I say that is that in my experience some electro-mechanical valves require a forward pressure to actually open when they are triggered and you want to make certain that the pressure to open the valves is compatible with the pressure you will be using for the pipes. My organ runs at a pressure of about 5 inches of water but of course that depends on the size of the pipes, responsiveness you want, etc. Further, when you are testing your valves make sure that they will cycle quickly enough for the tempo of music you plan to play on your juke box. Finally, when you start to drive the valves electronically don't forget to add snubber (clamp) diodes to keep from frying the transistors.
      Yes, please keep me up-to-date.

  5. Thanks for the reply (again) - really appreciate this !!

    The valves I have need 3psi to close - not sure how responsive they might be - I have ordered one so will test it out - I am also not sure how best to supply the air - what pump are you using for your system ? Also wether I need to perhaps build an 'air box' to hold the air prior to the pipes - or wether I can simply run the directly from the pump ?? All a bit hazy at the moment - but fun project for sure !!!

    1. As far as a blower goes, I bought one on EBay that had been used to cool a data-center and enclosed it in a box to suppress the noise. That 'air box' you mentioned is what the organ guys call a wind chest. It is useful in, among other things, 'cushioning' the airflow from pulses from the pump and the opening and closing of the valves to different pipes.

      In general this can be a complicated topic. Besides the blower you need a pressure regulator that can spill the extra air when you don't have much demand from the pipes but supply it when needed. Many organs use a bellows type mechanism. This arrangement has the advantage that it can, for short periods of time, supply more air than the blower can directly. This is useful so you have enough air for a temporary crescendo without having a blower large enough to supply that amount of air continuously. The required volume of air is really determined by how many pipes will be playing at once, and how large the pipes are. The blower I used supplies so much air that in practical terms the organ is never starved for air and thus I could simplify my regulator. Part 4 of the Music & Me blog shows the inside of my blower box, but an earlier version. Then I was using a shop vacuum but that was a fail. The motor required air-flow over it to keep from overheating. The data center blower that I mentioned earlier fit in the same box but is cooled by the air flow itself and thus does not overheat even in the closed box.

      I know this is lots of scattered information. I can give you as much detail as I possess on any of these topics. Just let me know how I can help.

    2. Tanks again .. going to try and experiment with a refrigerator compressor and old propane gas bottle combination - and see if that might supply enough air and for a long enough period ?? This is all very new to me so simply experimenting and leaning along the way . -Received on e solenoid valve - so going to try a test this week and see how quick it opens/closes .. Will let you know how it goes ..

    3. Refrigerator compressor and propane tank! Are you thinking to pressurize the tank and make the device portable? If not I think the compressor and tank might be more appropriate for an artillery piece than a bottle organ. Yes, please let me know how the valve works. Have you thought yet about how many bottles you might have "speaking" at the same time?

  6. Hi ..

    Yes want a mobile solution - perhaps the tank/compressor combo might be way too much - am indeed rather confused as to the whole pressure thing. The solenoids require probably 5 PSI to operate - not sure if this is going to be to much for a pipe thinking it will at most be 4-5 notes polyphonic... still not rigged anything up to test as yet - but should manage it this week !!

  7. hmm - just seen the conversion calcs for water inches to psi - so I guess 5psi is way too much for the pipes - guess goingto have to rethink this somewhat ..!!!

  8. Have you actually checked the valves to make sure they require that much pressure to open? Also keep in mind the difference between pressure and volume of air. It may take significant pressure to open the valve but much less to keep it open. Therefore a restrictor placed near the valve might allow the pressure to build enough to open the valve but only allow a modest volume of air to actually flow. Also, how big are your pipes? That is, how much air do they actually need to speak? I wouldn't give up on the valve idea just yet. I would try some experiments. I assume that most if not all of your pipes are flue pipes, that is, they don't have reeds. Run some air through them and see how they sound. You'll know if you're over-driving them.

  9. I have bookmarked your website because this site contains valuable information in it. I am really happy with articles quality and presentation. Thanks a lot for keeping great stuff. I am very much thankful for this site. Music Production Courses

  10. Wow, happy to see this awesome post. I hope this think help any newbie for their awesome work. By the way thanks for share this awesomeness from DVJ Courses