Created
March 18, 2011 18:49
-
-
Save agermanidis/876617 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import logging | |
import sys | |
import emotiv | |
import gobject; gobject.threads_init() | |
import gst | |
pipe = gst.parse_launch('audiotestsrc name=generator freq=0 ! autoaudiosink') | |
generator = pipe.get_by_name('generator') | |
pipe.set_state(gst.STATE_PLAYING) | |
headset = emotiv.Emotiv() | |
baseline = 0 | |
v = -1 | |
while True: | |
if v == -1: | |
baseline = headset.read().AF3[0] | |
v = abs(headset.read().AF3[0]-baseline) * 100 | |
generator.set_property('freq', v) | |
time.sleep(0.5) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment