terminalVoltage
Posts: 1
Joined: Mon Jul 01, 2019 10:36 pm

Raspberry PIpe Organ

Mon Jul 01, 2019 10:51 pm

I need to preface this by very briefly discribing how an organ works
Organs usually have at least 2 keyboards (manuals) 61 keys each and a 32 note pedal board a total of 154 keys and then however many stops to control different ranks of pipes for the pedals and manuals.
61 pipes per rank so an 8' principal would have 12 8' 4' 2' 1' and 13 1/2' pipes adding to 61

Would it be possible to get all of this information into a single Pi and then get it sent to a second pi in the pipe loft connected to relays to turn on and off the pipes? I assume that the manuals and pedals could be done through a matrix. Traditionally organs use a diode matrix system with a 64 pair cable to the chest matrix board but recent much more expensive iterations use digital controllers with a single cat5 linking console encoder to chest decode. I want to build the latter of the two options as the real systems are incredibly expensive.
The new systems being Peterson ICS-4000 or the Matters organ control system.

IanS
Posts: 253
Joined: Wed Jun 20, 2012 2:51 pm
Location: Southampton, England

Re: Raspberry PIpe Organ

Thu Jul 04, 2019 11:19 am

I have a similar project you might be able to borrow bits from. I am building an organ console (two manuals and stops up and running so far, pedalboard still under construction) where the note press/release and stop statuses are monitored by a Pi, and then the status changes communicated to a sound producer - the relay controller in your case, or synth software in my case. In order to spread the synthesizer CPU load I am using one Pi per manual, which would not be an issue for you, but you might still want to spread across multiple Pis just because of the high number of inputs (notes and stops) or outputs (relays). I use mqtt to link the status changes from the hardware monitors to the sound production side. This seemed the easiest way to allow coupling between manuals.
The problem with organs is that fingers times stops can reach quite a high number. e.g. An eight note chord played with 10 stops out means triggering 80 relays, preferably within a few milliseconds of each other. Your relay power supply will need to be handle high surges in the load.

It is still a work in progress on the woodworking side, but I think the code is more or less complete. You can find a build description and code at https://github.com/Squeack/rpi_organ. Once the pedals are complete and the whole thing tidied up into a self supporting console instead of sitting on a table I will tidy up the documentation and republish.

Eirikur
Posts: 68
Joined: Sun Sep 09, 2018 9:43 pm

Re: Raspberry PIpe Organ

Wed Jul 10, 2019 8:49 pm

I did a lot of work for my own music keyboard. I will share what worked for me and eliminated a lot of the tricky stuff.

I wound up using LinuxSamper, which I had to patch (tiny patch) and build for the Pi. It is NOT too big for a Pi, even a Pi 3B+.

Once you have LinuxSampler working, all you need is a MIDI keyboard and a MIDI to USB adapter or just a modern MIDI over USB controller keyboard.

LinuxSampler supports Soundfont2, the modern SFZ format, and legacy Gigastudio .gig format. It sounds great. I have some pipe organs for it.

This is not the solution for you if you want arbitrary registrations and blending, because it's sample based. You could, however, easily play and blend several layers of samples on a Pi 4.

I can share my Python code for managing LinuxSampler and configuring MIDI and audio devices.

Eirikur

User avatar
omegaman477
Posts: 148
Joined: Tue Feb 28, 2017 1:13 pm
Location: Sydney, Australia

Re: Raspberry PIpe Organ

Fri Jul 12, 2019 12:15 pm

My only advice is to base your design on a MIDI interface between the console controller and the loft controller (and maybe a controller in the air pump/bellow room). There are countless MIDI over fibre/cat5 extenders, splitters etc. You may need multiple loft controllers for ease of design or performance, using MIDI will allow you to scale the design effortlessly.

Using MIDI allows you to drive the organ with a standard MIDI keyboard or PC MIDI application to test the organ controller, and also use a MIDI analyser app on a PC to test the console. trying to debug both ends at the same time is hard.

I always recommend to base any design on available industry standards. MIDI is a purpose built comms standard for keyboard instruments. Dont re-invent the wheel. There are solid pre-tested libraries for the RPI.

Using MIDI you could drive the organ from a PC MIDI sequencer, how cool would that be.
..the only thing worse than a stupid question is a question not asked.

IanS
Posts: 253
Joined: Wed Jun 20, 2012 2:51 pm
Location: Southampton, England

Re: Raspberry PIpe Organ

Fri Jul 12, 2019 2:06 pm

MIDI is good for most instruments, but can struggle with 'real' organs. The problem is that it does not send 'keyboard note down', 'keyboard note up' messages, but sends 'note on', 'note off'. Since having multiple stops out means that each press of a keyboard note generates multiple sounds, the MIDI protocol can get overloaded, especially when using real MIDI serial cables which run at quite a low bandwidth. Watch out that the MIDI controller generates the correct messages when a note is held but stops or couplers are changed.
See http://www.pykett.org.uk/midi_for_organists.htm for more details.

User avatar
rin67630
Posts: 1055
Joined: Fri Mar 04, 2016 10:15 am

Re: Raspberry PIpe Organ

Tue Jul 23, 2019 9:11 pm

MIDI isn't a limitation.
A friend of mine has built an absolutely crazy Hauptwerk Organ (IMHO the biggest in the world, with a 64GB main memory and 10 core CPU -> 12 channel audio) operated through MIDI.
https://www.youtube.com/watch?v=5BI1eIcT-ws
I suppose the Raspi would be a bit weak to replace that...
;-)

omenie
Posts: 97
Joined: Fri Dec 09, 2011 5:09 pm
Contact: Website

Re: Raspberry PIpe Organ

Wed Jul 31, 2019 11:30 am

Just saw this thread, after I posted one of my own a couple of days back. If you are interested in a port of my St Just in Roseland Organ app (iPhone, iPad, iPod Touch, uses wavetables not samples, should run great on a Pi 2 or up, a breeze on 3 or 4) let me know on raspberrypisynthesizer at gmail dot com. If there is enough interest I will get it done.

Videos of the app being used with one manual here, software is designed for 2 manuals plus pedalboard plus swell pedal.

https://vimeo.com/299933180
https://vimeo.com/291454775
https://vimeo.com/291454681

omenie
Posts: 97
Joined: Fri Dec 09, 2011 5:09 pm
Contact: Website

Re: Raspberry PIpe Organ

Wed Jul 31, 2019 11:34 am

IanS wrote:
Fri Jul 12, 2019 2:06 pm
MIDI is good for most instruments, but can struggle with 'real' organs. The problem is that it does not send 'keyboard note down', 'keyboard note up' messages, but sends 'note on', 'note off'. Since having multiple stops out means that each press of a keyboard note generates multiple sounds, the MIDI protocol can get overloaded, especially when using real MIDI serial cables which run at quite a low bandwidth. Watch out that the MIDI controller generates the correct messages when a note is held but stops or couplers are changed.
See http://www.pykett.org.uk/midi_for_organists.htm for more details.
You’re barking up the wrong tree here. There is absolutely no issue having a single noteOn or noteOff command control dozens of stops, and similarly no issue when pulling out or pushing in a stop or a coupler when a chord is held.

IanS
Posts: 253
Joined: Wed Jun 20, 2012 2:51 pm
Location: Southampton, England

Re: Raspberry PIpe Organ

Fri Aug 02, 2019 5:23 pm

There is no problem ... if the midi controller is implemented properly.
Some low quality organ midi systems will not start a new sound if an additional stop is activated while a chord is held, or stop that sound if the stop is deactivated while the chord continues. They only generate note on/off when the pressed note changes.
Hauptwerk, from what I have seen, sends note changes and stop changes independently to the synthesizer computer, which is normally rather powerful. That is then responsible for working out how the total sound changes for each of these events. When implementing a mechanical system you have to track the overall status of the organ at one end or the other (console or pipe loft) and control the pipe valves accordingly.
If you consider an array of valves, 61 columns wide (assuming 5 octaves) with a row per stop, then a change in note on/off will impact up to an entire column, depending on the active stops; and a stop change will impact up to a row, depending on the played notes. Couplers are another complication.
My organ works the same way as Hauptwerk, with a small number of state change messages being generated at the console and the overall state being maintained by the sound synthesizer. If you maintain state at the console end and send messages to individual valve controllers then you end up sending a lot more messages. Using an IP network to send these messages is pretty quick, but using 'real' MIDI, at the roughly 37KHz bandwidth it uses can introduce a noticeable delay.

omenie
Posts: 97
Joined: Fri Dec 09, 2011 5:09 pm
Contact: Website

Re: Raspberry PIpe Organ

Tue Aug 20, 2019 7:57 pm

It’s pretty brainless to get this right to be honest, and is actually way harder to get wrong than to get right. Since the synthesis engine has to maintain the current set of depressed notes in order to synthesise at all, doing the right thing - in terms of the engine internally commanding ‘pipes’ to start or stop speaking when the registration changes - is trivial.

omenie
Posts: 97
Joined: Fri Dec 09, 2011 5:09 pm
Contact: Website

Re: Raspberry PIpe Organ

Tue Aug 20, 2019 8:02 pm

... I should say, this response is equally applicable to physical pipe organs as it is to virtual ones, even though it’s phrased in terms of virtual. The ‘synthesis engine’ on a real pipe organ just being the embedded computer that manages the big bitmap of what pipes are speaking or not at any given time.

Colin Pykett
Posts: 1
Joined: Wed Oct 16, 2019 9:33 am

Re: Raspberry PIpe Organ

Wed Oct 16, 2019 10:07 am

Guys, you need to be aware that you might be missing the point of my article about MIDI which you have referred to in this discussion. It was written in 2001, nearly 20 years ago - see the date block at the start of the article. That's a whole generation of engineers ago. So it was obviously only able to describe the world of MIDI as it then existed. Some of the shortcomings of MIDI-based pipe organ transmissions described in the article certainly did exist at that time, because (again obviously) they had been designed even earlier. So the systems around at the time the article was written were typically installed c. 1985-95, and these are the ones to which it referred. Remember that MIDI itself had only been around for 20 years when the article was written, having been mentioned at a conference in 1981 and its major features cobbled together during coffee breaks (the design shortcomings of which we are still having to live with today). Absolutely nothing like R-Pi's and Arduinos existed in 2001. The term 'microcontroller' meant 'Z80' to many engineers, which was not a computer on a chip - you had to add external RAM and heaven knows what else to it, and it would typically run at the princely speed of 4 MHz if you were lucky. If you wanted it to send/receive MIDI you needed a separate USART chip. A few clunky PIC-like devices were also around, and if you enjoyed erasing them with UV light then that was your pleasure and I wouldn't want to have taken it away from you. And as for VPOs, most people were still living in the Windows 98 era where 512 K of RAM and a 360 MHz CPU plus a 6 GB HDD was typical. (The first VPO I designed used just such a system). Because of these platform limitations, it was rare to find pipe organ transmission systems which maintained a bit map of active stops and pipes at the receiving end as any sane system would do today. Instead, they often just used the 'memory' inherent in the console itself, where the memory elements were the keys currently pressed and the stops currently drawn. This led directly to the problems I outlined in the article as night follows day. So the article does not describe today's world (I sincerely hope), although there's still no harm doing the basic checks I mentioned to make completely sure before you agree to give an organ recital on an older instrument ...

omenie
Posts: 97
Joined: Fri Dec 09, 2011 5:09 pm
Contact: Website

Re: Raspberry PIpe Organ

Sun Sep 27, 2020 9:50 pm

A rather belated update to this discussion - this codebase runs flawlessly on a Pi 3, with 2 keyboards and a Swell pedal connected over USB.

https://soundcloud.com/pisynth/church-o ... -synthesis

Return to “Other projects”