Git Product home page Git Product logo

heartbpm's Introduction

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

heartbpm's People

Contributors

schollz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

heartbpm's Issues

Multiple errors with Go

Hello,
I can't figure how to setup the software part. I get multiple errors with the Terminal and can't create the heartbpm executable.
Do you have more precise intruction for the software setup ? Maybe it's not working anymore with the new Go version ?
Thanks a lot !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.