Possibility of DIY to create midi for organ stop rail

Status
Not open for further replies.

TJBentley

Member
Hello! I am writing to inquire about the possibility of creating a system to wire 50 individual push buttons with simple on and off function to activate turning on an off individual organ stops on a Virtual Pipe Organ using a Teensy board. In essence it would be using small arcade push buttons or something similar, 1 for each organ stop, and one extra button to clear all.

From reading on the net I believe this to be possible, but don't know where to begin. I am especially concerned about being able to "write" the program code to tell the Teensy board what to do.

I have no experience with "writing code" and minimal soldering skills but I think I could manage the soldering with some practice.

Any advice on which Teensy product to use and how to "write code" would be most helpful.

I visualize the end result as a "strip" of push buttons just above the top keyboard. I know a commercially made product to accomplish this exists (similar to a Novation Launch Pad or Korg Nanokey) but I enjoy the learning experience of making one myself as well as the ability to custom fit it to the organ console as well as the DIY version could offer expansion of adding new additional buttons in the future.

One other desire would be that these "buttons" light up when active and of course go out when inactive.


Thanks in advance for your time and advice.

Tom
 
Am I perhaps posting this question in the incorrect area or perhaps even the wrong forum -- should I be on the Arduino forum rather than this one or is this topic simply not interesting?

If you have an idea where I might find the advice I seek please be kind enough to point me there.

Thanks,

Tom
 
What you want to do sounds possible. You'll need to learn a bit about writing code. Although some folks on this board would suggest you first learn C or C++ on a desktop PC, it's not the only way. You could also buy a Teensy and start messing with the examples. There are examples that blink lights and examples that respond to push buttons. You'll have some challenges when it comes to making sounds. You'll have some challenges when you scale up to 50 buttons. Nothing that hasn't been done before, but if you've never done it before, you'll have to work your way up the learning curve.

Without knowing you better, it's hard to advise you regarding which path you might find most satisfying. So, feel free to tell us more about how you learn, how important it is to get the application you have in mind running quickly, whether you'd be happy with a smaller number of push buttons to start, etc.

You can download and install the development tools for Teensy without buying anything. This will allow you to at least look at example programs. Maybe you'll read some of the examples and get the sense that writing code isn't so bad. Or maybe it won't make any sense and a beginning C++ programming book would help.
 
Maybe there's a bit of a language barrier here?

For example, while I know quite a lot about programming, I know almost nothing about organs. So I have no idea exactly what you mean by "activate turning on an off individual organ stops on a Virtual Pipe Organ".

I don't even know if a "Virtual Pipe Organ" is software running on a PC or Mac, or some specific product, or another microcontroller-based project someone else made. Can you see how that makes answering your question difficult?
 
Some of what you are trying to do is functionally the same as the pedal board you asked about in https://forum.pjrc.com/threads/23550. Did you midify that pedalboard? You should re-read that thread as there are some responses in there that also apply to a stop rail since they both involve switches.

Pete
 
I struggle with requests for advice when the requestor wants to build something even slightly complicated but has no experience writing code. I absolutely want to be encouraging and yet there are many annoyances to master before writing a trivial piece of code is actually a trivial exercise. If you've never coded before, the difference between a comma and a semicolon doesn't seem like it should matter, but in a formal language like C++, precise usage means the difference between working code and baffling nonsense.

On the bright side, learning to write code has never been easier. There are great books, online tutorials, people all over the planet willing to help, cheap or free systems to practice developing software on, software to help with debugging, etc., etc. It's hard to know what the best path might be, but don't let a few side-tracks slow you down. Keep reading and trying things and your understanding will keep growing.
 
Good morning and thank you all so much for your replies. I do remember inquiring about Teensy once before regarding that pedalboard, and yes, I did end up adding midi signal to it, but I ended up using a commercial midi encoder board from Roman Sowa who is located in Poland. I have been very satisfied with the result but have still been intrigued with Teensy because it can create much more personally tailored results. I remain somewhat confused as to Teensy versus Arduino the line between the two seems somewhat blurred -- competitors (?) or the same group (?) or complimentary partners (?). I have come to understand that Arduino and Teensy use different coding language and Arduino seems to suggest that their programming language is easiest.

To clarify VPO -- I am running on my PC the program called "Hauptwerk" by Milan Digital Audio (MDA). They "sample" individual organ pipes installed on large pipe organ worldwide. Each pipe is sampled note for note with natural room acoustics. The result is a near perfect digital reproduction of whatever instrument and venue the organ is installed in. On the user end, I purchase ($600.00) the license to use MDA software, and then purchase the "sample set" of the organ I wish to play via my physical keyboards, pedalboard, expression pedals, and stop (1 stop = 1 pipe) on the organ (each organ runs between say $400.00 to lots more depending on the particular organ size, etc.). Their program accepts midi from midi controller boards as well as USB midi signals, and the Hauptwerk program allows the user to attach my "physical" keyboards, stops, pedals, etc. to operate the organ itself.

Now what am I trying to accomplish with the Teensy -- My physical console has 48 stop tabs (switches) -- in the up position they are off, when pressed down they are on and remain on until I again move the switch up. Using commercial midi controller boards, I have successfully wired so far everything except the stop tabs. I could purchase a commercial board and wire my physical stops to it, but, thinking ahead I would rather abandon the physical stop tabs and replace them with a "strip of buttons" to perform this function. The button would need to be lighted when active and dark when not turned on. Once turned on the button would need to remain in the active state until physically tapped off by me (meaning 1 to many could be active simultaneously). You probably wonder why I am considering doing all the work to remove the current tabs and replace with buttons -- One reason would be to create more empty space on my organ console (it currently has 2 keyboards) to physically add 2 more keyboards. The other reason which logically makes no sense is that I like to know how things work and using a commercially based solution, while efficient, doesn't teach me anything about how this works.

A simple solution would be to buy a Novation Launchpad, for instance, and map the Hauptwerk software virtual stops to it, one on each button, but while efficient is not nearly as enjoyable as learning how to do it myself.

If it is felt that this is a "foolish" waste of time (I just recently retired) don't hesitate to say so. I don't mind wasting my own time but I don't want to waste someone else's time :).

Hope this clarifies my goal.

Again, thanks for your thoughts and recommendations above and let me know if you think its worthwhile to attempt.

Thanks,

Tom
 
Seems to me that a Teensy is a great way for you to further your goals. The programming language is the same as Arduino, with a few additions. That is because Paul, the creator of Teensy, has built an extension to the Arduino environment to allow it to be used to program Teensy. That extension is called Teensyduino. It is what makes Teensy so easy to use.

Like others have said, you will find some challenges but your goal of knowing how things work is a good one (In my view). Completing this project with Teensy will be rewarding. I started using Arduino for the same reasons and shifted to Teensy. Now I have a temperature controller for cooking in a water bath and for roasting coffee, a controller for the boiler and pumps in my house, a perimeter of LEDs backlighting my bathroom mirror that displays a timer for my kids to brush their teeth, and a system for my car that displays engine parameters and controls the water-injection spray for the supercharger. And there are some other projects floating around our house like an 8-channel mini fountain and a laser Spirograph. In other words, microcontrollers like Teensy or Arduino are fun and awesome. The sooner you start playing with them, the better.
 
I have implemented something vaguely similar but on a much smaller scale. I have four momentary push buttons connected to a Teensy 3.0. The T3 uses the Bounce library to debounce and read the buttons and it then converts them into MIDI Program Change messages which are sent out via USB-MIDI. These are read by the Hauptwerk VPO program to step from one registration frame to the next or reset to the first frame. I haven't decided what to do with the other two buttons yet but they are already implemented if inspiration or necessity ever strikes.

- For the switches, perhaps a latching LED switch like these would work (there may be cheaper sources but that's the first one I found). IIRC the LEDs come in four colours which would help with colour coding the stops. I estimate that 50 of them in one row would be about a metre wide. If that's too wide for your console, could you split them into two rows?
- But you won't be powering all those LEDs directly from a Teensy because each LED probably needs at least 10ma to give a decent light, that'll be at least 500ma.
- I think I would look at using two or more Teensy2 (instead of the Teensy++2). Each T2 has 25 digital inputs and the same code, with minor tweaks, would work on both of them. Each switch could then be wired directly to a digital input and you wouldn't need to figure out how to handle matrix wiring and polling.
- I can't figure out how you would wire up a switch to a separate 5V supply and a T2 digital input so that when you set the switch, it lights the LED *and* it generates a 5v/0V signal on the digital input without requiring additional components other than a resistor. I'm not a hardware guy :). Perhaps Paul or one of the others can figure that one out.
- The Teensys would be set up as USB-MIDI devices so that your VTPO software would see them as standard midi devices and the Teensy code can be set up to generate any MIDI message required for each stop.



Pete
 
I'd set up the switches in a let's say 6 x 8 matrix using for example a 74HC238 decoder for the row addressing. This would require writing out 3 digital pins cycling through the 8 rows and reading 6 digital pins from the switches in the selected row. So, it can easily be done with the teensy 3.x or even with the teensy lc.
 
I remain somewhat confused as to Teensy versus Arduino the line between the two seems somewhat blurred -- competitors (?) or the same group (?) or complimentary partners (?). I have come to understand that Arduino and Teensy use different coding language and Arduino seems to suggest that their programming language is easiest.

Arduino designs their software to allow use with non-Arduino boards. That's part of the reason it's become such a popular platform. Their main rule is you're not allowed to call your product "Arduino". The vast majority of non-Arduino boards are simple clones with little or no difference in design, just a different name printed, and usually a lower price to undercut's Arduino's name brand boards. Some even break the naming rule, or push the limits with confusingly similar names.

PJRC and Arduino LLC collaborate much more than we compete. Of course, we use their software and platform. I have personally contributed many features and fixes to their code, and assisted them on numerous technical matters. Massimo Banzi and I have met on a few occasions. We are on friendly terms. I believe we will be working more closely after they're resolved their terribly distracting legal issues with Arduino Srl.


Now what am I trying to accomplish with the Teensy -- My physical console has 48 stop tabs (switches) -- in the up position they are off, when pressed down they are on and remain on until I again move the switch up.

I'd recommend starting with File > Examples > Teensy > USB_MIDI > Buttons.

Start by using just ordinary pushbuttons, or just tap a wire or paperclip between GND and the nearby digital pins. The important point is to start from a working example and make progress in small, incremental steps as you learn.

Once you're comfortable with how that example works, maybe trying wiring up one of your organ's switches and see if that works. If it doesn't act the same way, maybe a multimeter in ohms mode could help you figure out how the mechanical movement translates to open-close of the contacts. If you need help figuring out how to make the code respond, you'll need that understanding of how your switches really work (and we'll need you to express it clearly, if we're going to give you useful help).


I don't mind wasting my own time but I don't want to waste someone else's time :).

I and many others here are happy to help. Even if it results in a long message, including a complete copy of whatever code isn't working, and as much technical details about things like those switches really does save everyone a lot of time.
 
Sorry for the delay in this response to your most kind encouragement. Sometimes life interferes with fun! I do think I can do this with some learning and work. I have gotten a copy of "Getting Started with Arduino" and will be getting the beginners kit in the next week and start working thru the learning examples and book. It seems that even a cursory glance at the book indicates that the "button" example could be a good place to start as was suggested above then figure out how to make the light button command also send midi usb signal to Hauptwerk software to actually "turn on" the organ stop. I realize I am already somewhat ahead of myself since I have actually learned nothing but it has given me a glimmer of hope that my goal could actually be reached over the winter months when some down-time here at home will be available. Thanks again for your advice and encouragement and I will re-appear here after some study and practice with Auduino book and beginner's kit!!!!!

Okay -- EDIT Here -- apparently I am confusing Teensy and Arduino again. Should I be purchasing an Arduino starter kit for practice or should I be buying a Teensy development board? I think I can get it if I can figure out if I am dealing with Teensy or Arduino or is it interchangeable?

Tom
 
Last edited:
If you're going to do USB MIDI, definitely get Teensy. Normal Arduino boards don't support USB MIDI. Some hacks exist, mostly involving reprogramming one of the chips on Arduino Uno... and others involve trying to use the Teensyduino code on non-Teensy boards. If you're doing MIDI over USB, you'll be glad you got the Teensy.

If you're doing only normal serial stuff, either should work. While Arduino Uno doesn't have nearly the performance, there is something to be said for so many of the internet's tutorials and examples all being written for that specific board.
 
Thanks so much Paul. So I will set about ordering a Teensy board and look for tutorials. I should think that the "Getting Started with Arduino" would still be useful study -- I'm a few chapters in at this point anyway so will continue?

Tom
 
Well here it is two years later and I'm finally just starting to put this project in motion. Got the Teensy ++ 2, managed to get it installed with Arduino and Teensyduino, and did a lot of reading regarding wiring and coding, but seem to be somewhat unsuccessful at this point.

I am starting small with just trying to get one switch to work. The overall goal is when the "Tab" i.e. a switch, is in up position with creates the wiper not being in contact with poz and grnd, no signal is sent. When Tab is in pressed position, i.e. switch is down and wiper is completing the circuit between poz and gnd, a usb midi message is sent to Hauptwerk software and a virtual stop is turned on. So in the end Tab up - stop off, Tab down - stop on.

It is my understanding that HW works off of note on and note off messages.

Initially I have tried this for wiring:

Jumper from grnd pin on Tennsy to - rail on bottom of board
Jumper from +5V pin on Teensy to + rail on bottom of board

Jumper from +5V bottom rail up to pin 2 space on on breadboard
Positive side of Tab in same column to pin 2
Ground wire from Tab wired to bottom gnd row on breadboard

End wiring!!

Now, when i test for voltage responses with multimeter, I get the desired result. Tab up, no signal, Tab down, +5V

Okay so ....

When it comes to coding I get pretty lost.

All I want to do is tell Teensy to send the appropriate note on (Tab down) and if Tab no down, send note off.

Teensy is recognized by HW was being a midi device so that must mean computer and HW software are happy about it.

So I have included the midi library, defined Pin 2 as input pull-up

looped:
digital read pin 2
if low usbmidi.sendnoteon;

else

usbmidi.sendnoteoff;

That roughly what it boils down to and i did get it to compile, but with no result. I should try and figure out how to get a screen shot of the actual code as i entered it with all the brackets and parenthesis to post which I will try and do later today or tomorrow as car has to go to repair today. Hate when life fiddles with my hobby.

Just thought I'd run this preliminaryly thru to see if my thinking is completely and utterly off or am I at least on the right track?

Thanks in advance for any opinions.

Tom
 
Tab up, no signal, Tab down, +5V
If I understand it correctly, this won't work. When the tab is up you need to have the wiper connected to ground. The way you describe it, it sounds like it is floating (i.e. not connected to anything) when the tab is up. When an input floats, you will get random readings from it.
You need to wire each tab so that with tab up the wiper is grounded, with tab down the wiper is +5V.

Pete
 
P.S.
I should try and figure out how to get a screen shot of the actual code
Just copy the code and paste it here (preferably in code tags - use the # icon). A screenshot makes it hard to read code.

Pete
 
Can't tell what you mean about pin 2... positive supply is not needed as the internal pullup on the Teensy is providing the source of positive charge/current.

But only if you've setup the pin as pullup.

When the switch is 'on' the Teensy pin is drawn to ground and reading the pin returns LOW.
 
Paul posted earlier "I'd recommend starting with File > Examples > Teensy > USB_MIDI > Buttons."

Have you tried the example Paul suggested...?????
I just have and it works.......I am just trying the Teensy on its own NOT connected to anything except via the USB lead to my PC.

So as not to fiddle with the original example code, copy the Buttons folder in examples to your sketch folder.
Open it in Arduino IDE, set "USB type" to"MIDI" in Tools.
Plug in your USB lead to PC USB port and plus Micro USB end into Teensy....You do not need any other power for Teensy.
Compile the example Sketch and upload to Teensy.
I used a brand new Teensy just out of the packet and stuck it to the desktop with a blob of bluetack....to keep it in one place...
Then I got a piece of wire and held one end in the GND pinhole and touched the other end of the wire in turn to pins 0, 1, 2, 3, 4, etc etc and it played notes on my PC like a $1000 piano.
I dont have an organ or keyboard to plug it into, but I used the free MuseScore music software set to midi input and the notes appeared in the onscreen music score sheet and I could play it back.
So that is a very simple exercise (10 minutes) to getting Teensy to behave a a MIDI device and Play and input (or send) midi commands to my PC.
In the example the PINS just need GRND to work....rising edge or falling edge triggered......you dont need 5 volt applied to any pins.
I can now read the sketch and see what each line of code does and comment some out and see what becomes missing or add in extra lines for more features.
I assume your Organ has volt free contacts on the key switches so should not need any 5 volts to work.
Hopefully this will get a few of your switches doing something......thend you can modify it with the proper notes or control commands that you want and add a matrix for 50 keys....etc...etc
 
Picture to show the basic connections for the Midi Button Test.

TeensyPicTest.JPG
 
Thank you ALL for the helpful replies. Unfortunately no success yet and I am certain my problem isn't in the wiring or the switch, but in the coding. All the examples I find seem to involve lighting up an LED or playing a specific musical note, etc. I am somehow not able to connect these things in my head -- Hauptwerk needs to detect the signal from the Teensy and link it to its virtual control. When I attempt to issue a midiNoteon command to HW the Teensy demands that the command contain a note number, velocity, and midichannel. Since in this application I don't want to send a note, but just a plain note on command I think maybe I should be looking more towards sending a midi program change and I would need to know what program change HW might be looking for to properly execute the link between the virtual stop tab and the physical stop tab (switch or button) that i am using. HW has an "autodetect" function but I don't know exactly what it is looking to detect so I think I should look further in that direction. I willl research a bit more from that end today hopefully but wanted to say thanks to all who are trying the darndest to help me!!!

Tom
 
I can play an Organ with one finger only at a time....so I don't know anything....

Basically I assume your Organ is a piece of software installed on your PC. It displays a virtual organ on screen, outputs sounds through speakers or as Midi out. Input from clicking on the virtual keyboards and probably the computer Querty Keyboard but also input from Midi controllers/keyboards through USB midi ports. Teensy is a USB midi device/controller when working as in the example above.

If you cannot find the examples etc this is where they are on my PC.....

USB MIDI library files here.....

C:\arduino-1.8.5\hardware\teensy\avr\cores\usb_midi

USB MIDI examples here.....

C:\arduino-1.8.5\examples\Teensy\USB_MIDI

The Buttons example just sends Noteon and Noteoff control to channel 1 ....edit it to suit.....can send program change this way if you want.

Regards Hauptwerk ...you will probably need to read the manual regarding MIDI setup and USB ports used. I assume you have a spare port for teensy to plug into. You could plug it in as it is with the example and Hauptwerk should detect it as a midi port. use the autodetect function and touch pin0 to GND then pin11 to GND, that should play the lowest and highest note and Hauptwerk should autodetect and set it up. I downloaded a copy on the manual for curiosity and only read bits briefly...???

OR if you unplug one of your existing keyboards and plug in teensy it should work the same as a keyboard playing notes. It will sound whatever your channel 1 is.

I would try and get teensy working as another playing keyboard before going on the sort out the stops control..??
 
Unfortunately no success yet
You haven't said what specifically didn't work. What code were you using (best to post it - in code tags using the # icon).

I am certain my problem isn't in the wiring
As I mentioned in message #17, your description of the wiring suggests to me that it isn't correct.

All the examples I find seem to involve lighting up an LED
That is a useful thing to try. All you need is a sketch which lights up the built-in LED when you push one of the stops and turns it off when the stop is off. That way you know that the Teensy++2 is seeing that TAB. Then try it with all the others to ensure that all of them work.

I should be looking more towards sending a midi program change and I would need to know what program change HW might be looking for
HW allows you to specify which MIDI message will activate each stop. I don't have any stop tabs but I have set up two buttons to activate HW's sequencer and I've written a small sketch for a Teensy 3. One button increments to the next frame and the other resets to the beginning. Both are Program Change but I think HW will allow Control Change or other types of message. It is easy to set this sort of thing up in HW, either manually or with the autodetect.

Pete
 
Here is a copy of the code i am attempting to execute. I got it from a HW user but for some reason I can't seem to make it do anything. I am thinking that perhaps my wiring is incorrect or the switch isn't working properly, but since i am totally ignorant as to code, perhaps my error is there. The attempted result is as described in my previous post. Hauptwerk with its auto detect function should automatically find this signal present from the Teensy ++ and when the tab is pressed the stop would turn on and when the tab is not pressed the stop should turn off.

The tab itself is currently wired as I described above -- Organ Tab no pressed stop is off, Organ Tab pressed the stop is on. The physical wiring of the stop is with a positive fin and a negative fin, each connected to a wire lead. There is a wiper fin is not connected to either the positive or common fin when in the Tab up positive, and in the Tab down positive connects to both the positive and negative fins, thus completing a circuit.

I am using a breadboard to prototype these function wired as follows. Teensy straddles the ditch in the center, +5v pin connected via jumper to bottom of bread board +, the Teensy ground pin connected to the bottom of the bread board rail -. a jumper wire from the - rail on the bread board up to the pin 3 column with the positive side of the Tab connected in the same row on pin 3 and the negative side of the Tab connected to the bottom of the breadboard ground rail.

Now with the HW program up and running and this Teensy++ code loaded, I get absolutely no response. But I am thinking perhaps I am so dumb that I am sending a program change message incorrectly since i don't really have a clue what a program change message looks like but according to the HW user that i got this code from, if you just run this code everything will work fine. I would of course really love to understand what is happening so i could perhaps branch out further with the Teensy and arduino and do some really fun stuff with this!

Any thoughts you have would be most appreciated and I DO apologize in advance for being some completely dumb about what I am doing. I have a tendency to always try and work at least one skill level above my intelligence!

Thanks, Tom


#include <MIDI.h>


const int midichannel=1;
boolean pressed[5];

void setup() {
for (int pin=0 ; pin < 5; pin++) {
pinMode(pin, INPUT_PULLUP);
}
}

void loop() {
for (int pin=0 ; pin < 5; pin++) {
if ((digitalRead(pin)==LOW) && (pressed[pin] == false)) {
usbMIDI.sendProgramChange(pin+1,midichannel);
pressed[pin]=true;
delay(25);
}
if ( (digitalRead(pin)==HIGH) && (pressed[pin]=true) ) {
pressed[pin]=false;
}
}
usbMIDI.send_now(); {
while (usbMIDI.read()); }
}
 
Status
Not open for further replies.
Back
Top