Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/glynnbird/metrics-collector-midi-microservice

Turns incoming data into music
https://github.com/glynnbird/metrics-collector-midi-microservice

Last synced: 5 days ago
JSON representation

Turns incoming data into music

Awesome Lists containing this project

README

        

# Metrics Collector Midi Microservice

This is a microservice that subscribes to a queue or pubsub channel hosted on

* Redis
* RabbitMQ
* Apache Kafka

and writes the data to a Midi device to turn data into music.

This service is designed to be paired with the *Metrics Collector Microservice* which sends web traffic data to a Redis, RabbitMQ or Kafka queue or pubsub channel. Other Microservices can listen to the data arriving on those channels, services such as the *Metrics Collector Storage Microservice* which can store data in Cloudant, MongoDB or ElasticSearch. This microservice turns the arriving data into music by posting notes to a virtual MIDI device.

## Installation

Clone this repository and then run

```
npm install
```

## Usage

Set your environment variables and start up the app e.g.

```
export QUEUE_TYPE=redis_queue
node app.js
```

Run GarageBand on the same machine and create a new virtual instrument and as data arrives on your channel, music will start to play.

## What is it doing?

When this microservice runs it creates a virtual 'MIDI out' port and as data arrives on the selected queue or PubSub channel, the service writes a note to the MIDI channel where the note depends on

* a hash of the incoming data - determines the pitch and octave
* a randomly chosen chord (the chord changes every 12 seconds)
* a randomly selected note length

## Environment variables

### QUEUE_TYPE

One of

* redis_queue - A Redis list data structure
* redis_pubsub - A Redis PubSub channel
* rabbit_queue - A RabbitMQ PUSH/WORKER queue
* rabbit_pubsub - A RabbitMQ PUBLISH/SUBSCRIBE channel
* kafka - An Apache Kafka topic
* null - default (does nothing)

### QUEUE_NAME

The name of the queue/channel that is subscribed to. If omitted, it takes the following values for each of the queue types:

1. stdout - n/a
2. redis_queue - mcqueue
3. redis_pubsub - mcpubsub
4. rabbit_queue - mcqueue
5. rabbit_pubsub - mcpubsub
6. kafka - mcqueue

### VCAP_SERVICES

`VCAP_SERVICES` is created for you by the Bluemix Cloud Foundry service. It defines the credentials of the attached services that this app can connect to.