Skip to content

Commit

Permalink
first implementation with midi input, it is not yet passed on to redis
Browse files Browse the repository at this point in the history
  • Loading branch information
robertoostenveld committed Nov 18, 2015
1 parent 510e915 commit f10fe6d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@ sudo apt-get install redis-server

### install EEGsynth from gitub
git clone https://github.com/robertoostenveld/eegsynth.git

### install MIDO to get MIDI working with Python
sudo pip install --upgrade pip
sudo pip install mido
sudo port selfupdate
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/opt/local/lib
2 changes: 1 addition & 1 deletion module/keyboard/keyboard.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[general]
name="Eye blink"
name="Keyboard"

[redis]
hostname=10.9.25.37
Expand Down
18 changes: 18 additions & 0 deletions module/keyboard/keyboard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import mido
import time
import ConfigParser # this is version 2.x specific, on version 3.x it is called "configparser" and has a different API
import redis

config = ConfigParser.ConfigParser()
config.read('keyboard.ini')

r = redis.StrictRedis(host=config.get('redis','hostname'), port=config.getint('redis','port'), db=0)

mido.get_input_names()

port = mido.open_input(config.get('midi','device'))

while True:
for msg in port.iter_pending():
# FIXME here it should decide on a key-value pair and send that to redis
print(msg)
2 changes: 1 addition & 1 deletion module/launchcontrol/launchcontrol.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ hostname=10.9.25.37
port=6379

[midi]
device=FIXME
device=Launch Control XL
18 changes: 18 additions & 0 deletions module/launchcontrol/launchcontrol.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import mido
import time
import ConfigParser # this is version 2.x specific, on version 3.x it is called "configparser" and has a different API
import redis

config = ConfigParser.ConfigParser()
config.read('launchcontrol.ini')

r = redis.StrictRedis(host=config.get('redis','hostname'), port=config.getint('redis','port'), db=0)

mido.get_input_names()

port = mido.open_input(config.get('midi','device'))

while True:
for msg in port.iter_pending():
# FIXME here it should decide on a key-value pair and send that to redis
print(msg)

0 comments on commit f10fe6d

Please sign in to comment.