Using Node-RED to play notes on a midi piano

I recently got a midi keyboard (Yamaha PSR-EW400) and have been using a Raspberry Pi to send midi data to it.

Then I had this daft idea to get it to play different tunes depending on what the current cheerlight colour was! E.g. Play “99 Red Balloons” when cheerlight changes to red, play “Greensleeves” for green etc 🙂

I decided to try out using Node-RED to achieve this and I’m writing this blog to show how to setup your Pi to do it

Preparation

Make sure Node-RED isn’t running
sudo pkill -f node-red

should take care of that


sudo apt-get install libasound2-dev
(needed as pre-requiste for the node-red midi module later)


Run this Node-RED update script from https://nodered.org/docs/hardware/raspberrypi

bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)
(takes a while to finish – go have a cuppa 🙂


re-boot – just to be sure 🙂


Launch Node-RED from programming menu (if you haven’t set it to autostart)


Launch Chromium browser on the Pi and type in localhost:1880 for the url (or as I prefer – use browser on another machine and type in ipaddressofpi:1880)


Click on the menu bars at far top-right and select Manage Palette.

Then use install tab and search for midi and find the node-red-contrib-midi and install it


Give it a minute or so  then refresh your browser and you should see that you now have a midi node available on both your node input and output selections

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *