Most of us will be using some kind of MIDI device when making music. Some people use apps like Ableton to play backing tracks send signals back and forth. Wouldn’t it be great if there was a way of controlling OpenLP by sending MIDI signals? Actually, there is a way to do this via JavaScript. Unfortunately it isn’t supported by every browser yet. But it seems to be fully supported by Chrome, Edge and Opera. At least, I tried it with Chrome and it worked just fine.
I included the files I wrote in this post. Just download them and unpack them. Then, for testing purposes open the file “midi-monitor.html” in the Chrome browser. Right away, it should show you all connected MIDI Input Devices. If you connect or disconnect one, the list updates automatically. Now, if there is a MIDI device connected, just press some keys, and every MIDI Event will be recorded. Press a key twice and the corresponding row will light up (possibly changing the value in the rightmost column). The way I set it up is: Every event with the value 127 or 0 gets its own row. Everything in between is counted as the same event, just with changing values.
(Note: If you want to have a look at the inner workings of the scripts, go ahead and open the HTML files. But I have to warn you: I didn’t really clean up. It’s pretty messy, but it works. In the future, I will make a prettier version of those files, with comments and everything.)
Then, if that worked, go on and open the file “midi-openlp.html”. Everything looks very similar, only there is a column to the right called “OpenLP”. Now press some keys. If you want that key event to be sent to OpenLP, click on “send to OpenLP”. More lines appear. First it tells you if it will use the value to determine if it should trigger or not (you can’t change that behaviour). Then you can choose, which OpenLP action you want to have performed.
Here are the settings I chose. I connected a Korg nanoKontrol and designated four keys.
Given that you
activated the OpenLP remote and didn’t change the ports or gave a password or anything, it should work right away. Next time you press the key, the corresponding row will light up and OpenLP will get to work.
Now, to save your settings: Press the save button at the bottom. It will provide you with a link. Use this link to open the page the next time, and all your settings will be there. However, this link does not update itself automatically. If you make any changes, click “save” again, and then use the link.
Possible use cases:
- Connect a MIDI Controller to your presentation computer. You can have one volunteer work on the keyboard while another one controls the slides via MIDI.
- Use your left keyboard pedal or something like AirTurn Bluetooth Pedal or iRig BlueTurn to switch slides. Additionally, if you have a stage monitor with chords, you will always have the right lyrics showing.
- If you use something like Ableton to play backing tracks, you can automate slides by sending MIDI signals from Ableton to OpenLP.
Comments
Thus is amazing, awesome work, will try it out.
Great job!
What do you think about collaboration on Github? I would love to develop this further with a nice interface and some other features without stealing your work ;)
Yes, definitely! Unfortunately, although I’m downloading stuff from github all the time, I have never come around to opening an account and posting my own stuff there. I only code for myself and it’s never in a state, where I feel I can unleash it on the world. ;-) I’m just lazy and don’t ever do any kind of documenting, proper commenting, error testing or prettifying the code.
And I’m not sure, how all this versioning and committing really works. Is there a good Github 101 you can point me to?
Guide: https://guides.github.com/activities/hello-world/
Youtube tutorial (because nobody likes reading the guides ;) ): https://www.youtube.com/watch?v=8JJ101D3knE&ab_channel=freeCodeCamp.orgfreeCodeCamp.orgGeverifieerd
This sounds excellent! Excuse me for the noobishness, but does this have to be done through a server or can it be hardwired through USB, without the use of a network?
No, its all running on the same machine. The MIDI controller is plugged in via USB, and the „network connection“ is actually just the apps on the computer talking to each other.
"I included the files I wrote in this post. Just download them and unpack them."
Where is the best place to unpack these files/what is actually opening them?
You can place the files anywhere you want. Just open the .html files with any of the supported browsers (at least Chrome, possibly also Edge and Opera).
I know it’s been a while but I’m hoping others have tried this. I’ve been able to send midi over wifi to my presentation computer, but even after configuring the remote with the factory settings Open LP will not respond to the midi… all the while the program you’ve written seems to recognize and work flawlessly. Any suggestions or changes I should look into?
Is it possible to change the code so it toggles between different themes?
@fiveofsix
Improving this project can help a lot. We can use it through Ableton Live.
Is there any way to call parts of a song like Verse 3 or a Bridge with this midi interface? I just started to learn how to code and I'm lost.
Given the great amount of interest in this script, I reached out to @fiveofsix to ask if he'd document the script so those interested could more easily build out features. That way we could give him some peace and quiet :-)
In the meantime - get familiar with Javascript, HTML, and github so we can collaborate on this! @madriesen have you setup a github project for this?
Hi there, today I found some time to go over the code. I did rewrite almost all of it and added a lot of comments. I hope now the logic behind everything is clearer. And hopefully I didn’t introduce any bugs.
TODO: Implement the new version of the OpenLP API.
Amazing work. Thank you.
Really awesome, many many thanks @fiveofsix! This is great!
I'm implementing API V2 calls - post calls definitely require more developer effort to implement.
Also, I'm working on V2 service/show call to display a particular song. Unfortunately the song ID keeps changing every time OpenLP is restarted :-(