Skip to content

Latest commit

 

History

History
113 lines (71 loc) · 5.53 KB

README.md

File metadata and controls

113 lines (71 loc) · 5.53 KB

heartbpm

Its 2020 and entirely possible to control synthesizers with your thoughts, so of course its entirely possible to sync your synthesizers with your heart pulse (and for only ~$50 of hardware). This repository contains the code and instructions to hook your blood to your music.

This system is really simple and will work with basically any modern electronic instrument (as long as it has MIDI). Here's a little schematic:

A basic schematic of the setup.

A finger is connected to a pulse sensor. The pulse sensor is connected to an Arduino. The Arduino can detect a pulse and send serial data to a computer. The computer runs a server that reads the serial data which updates a web page. The web page uses Web MIDI to send out the MIDI clock to all connected synths! Music ensues.

Here's a demo of me playing with three instruments sequenced to the tempo from my heart rate:

Demo of playing

The following instructions will give you a more detailed instruction.

Instructions

Stuff to buy.

You'll be able to get started with ~$50 of equipment, plus computer and MIDI instrument.

Get the code.

You can clone the code from Github or you can download it directly.

Setup the hardware.

Simply attach a pulse sensor to the Arduino, plugging the data channel into A0.

Connecting the pulse sensor to the Arduino

Now use the Arduino IDE to upload the heartbeat.ino. Once that is uploaded, you can keep the Arduino connected and move on to the software.

Setup the software.

First make sure you have Go installed on your computer You can download Go here. Now you can go into the heartbpm code and simply run in a terminal:

$ go build -v

Now you'll have an executable heartbpm in that directory. You can simply run it with

$ ./heartbpm --com COMPORT
[info]  2020/06/13 07:48:06 listening on :8054

Make sure you find your COMPORT. The easiest way to find your com port is to look at it from the Arduino IDE.

Finding the name of the COM port.

Now, connect the pulse sensor to your finger and open a Chrome web browser to http://localhost:8054. You should be able to see some data coming out. Note: this only works with Chrome and Opera web browsers since they have Web MIDI implementations.

Just add instruments.

Attach your electronic instrument via MIDI to your computer. Most modern synthesizers have USB which doubles as a MIDI connection, so just connect by USB!

Connect your finger to the pulse sensor and then reload the web page. The web page will automatically detect the synthesizers and you can see which ones are attached.

Screenshot of gathering data with NTS-1 attached.

Your average heart rate will be detected and sent to the electronic instruments as the clock. The website is getting the averaged pulse data calculated BPM from the server. This BPM is used to send MIDI clock signals every 1/24th of a quarter note, which is the standard for setting tempos on devices.

Useful notes.

  • If you are having trouble getting your pulse connected, try moving the pulse sensor just a little bit along your finger (1/8"). Sometimes if its not over your vein it will be harder to detect. Once its in the right spot it will stay there nicely, though!
  • If you are getting background noise its because the synthesizers are powered off your computer which (unless is battery operated) tends to have a noisy power supply. I highly recommend getting an audio isolator to remove this noise.

Enjoy!

Hope this is useful for you, and hope you can create something new! If you are interested in the music I've created, check out my Bandcamp or just search infinite digits on any streaming platform.

License

MIT