Showing posts with label mind. Show all posts
Showing posts with label mind. Show all posts

Controlling music with your mind

Last year I bought an EEG headset (the Mindwave Mobile) to play with my Raspberry Pi and then ended up putting it down for a while. Luckily, this semester I started doing some more machine learning and decided to try it back out. I thought it might be possible to have it recognize when you dislike music and then switch the song on Pandora for you. This would be great for when you are working on something or moving around away from your computer.

So using the EEG headset, a Raspberry Pi, and a bluetooth module, I set to work on recording some data. I listened to a couple songs I liked and then a couple songs I didnt like with labeled data. The Mindwave gives you the delta, theta, high alpha, low alpha, high beta, low beta, high gamma, and mid gamma brainwaves. It also approximates your attention level and meditation level using the FFT (Fast Fourier Transform) and gives you a skin contact signal level (with 0 being the best and 200 being the worst).

Since I know very little about brainwaves, I cant make an educated decision on what changes to look at to detect this; thats where machine learning comes in. I can use Bayesian Estimation to construct two multivariate Gaussian models, one that represents good music and one that represents bad music.



----TECHNICAL DETAILS BELOW----
We construct the model using the parameters below (where ? is the mean of the data and ? is the standard deviation of the data):










Now that we have the model above for both good music and bad music, we can use a decision boundary to detect what kind of music you are listening to at each data point.





where:






The boundary will be some sort of quadratic (hyper ellipsoid, hyper parabola, etc) and it might look something like below (though ours is a 10 dimensional function):
 

----END TECHNICAL DETAILS----

The result is an algorithm that is accurate about 70% of the time, which isnt reliable enough. However, since we have temporal data, we can utilize that information, and we wait until we get 4 bad music estimations in a row, then we skip the song.

Ive created a short video (dont worry, I skip around so you dont have to watch me listen to music forever) as a proof of concept. Then end result is a way to control what song is playing with only your brainwaves.


This is an extremely experimental system and only works because there are only two classes to choose and it is not even close to good accuracy. I just thought it was cool. Im curious to see if training using my brainwaves will work for other people as well but I havent tested it yet. There is a lot still to refine but its cool to have a proof of concept. You cant buy one of these off the shelf and expect it to change your life. Its uncomfortable and not as accurate as an expensive EEG but it is fun to play with. Now I need to attach one to Google Glass.

NOTE: This was done as a toybox example as fun. You probably arent going to see EEG controlled headphones in the next couple years. Eventually maybe, but not due to work like this.

How to get it working


HERE IS THE SOURCE CODE

I use pianobar to stream Pandora and have a modified version of the control-pianobar.sh control scripts I have put in the github repository below.
I have put the code on Github here but first you need to make sure you have python >= 3.0, bluez, pybluez, and pianobar installed to use it. You will also need to change the home directory information, copy the control-pianobar.sh script to /usr/bin, change the MAC address (mindwaveMobileAddress) in  mindwavemobile/MindwaveMobileRawReader.py to the MAC address of your mindwave mobile device (which I got the python code from here), and run sudo python setup.py install.

I start pianobar with control-pianobar.sh p then I start the EEG program with python control_music.py, it will tell you what it thinks the song is in real time and then will skip it if it detects 4 bad signals in a row. It will also tell you whether the headset is on well enough with a low signal warning.

Thanks to Dr. Aaron Bobick (whose pictures and equations I used), robintibor (whose python code I used), and Daniel Castro (who showed me his code for Bayesian Estimation in python since my implementation was in Matlab).


Consider donating to further my tinkering.


Places you can find me
Read More..

Could you fly a fighter jet with your mind

Jan Sheuermann can and she is quadriplegic, owing to a neurodegenerative disease. As part of Darpas Revolutionizing Prosthetics research track Jan was first trained to control a robotic arm with her mind alone and has recently been flying a F-35 Joint Strike Fighter (the US militarys next-generation attack jet) using a flight simulator. You can read more about this in a Wired article theres also a video.

from The Universal Machine http://universal-machine.blogspot.com/

IFTTT

Put the internet to work for you.

Delete or edit this Recipe

Read More..

10 awesome internet hacks to make your life better

Well Im not  sure that they are "awesome" but they are potentially useful, interesting or just fun. The Guardian recently published "10 awesome internet hacks to make your life better" that range from: how to log out of Facebook remotely if you left it running on a friends or relatives computer, how to bring up an emoji keyboard on your Mac or PC, and how to watch YouTube in slow motion. 

from The Universal Machine http://universal-machine.blogspot.com/

IFTTT

Put the internet to work for you.

Turn off or edit this Recipe

Read More..

A beautiful mind has died

News is breaking that the Nobel prize winning mathematician John Nash and his wife were both killed in a taxi crash in New Jersey, USA. John Nash is famous for his "Nash Equilibrium" in Game Theory, which can be most easily be described by the game of paper, rock, scissors. If a player randomly plays each of the three options 1/3rd of the time they can guarantee they will never be beaten over a large enough number of games. As soon as a player deviates from the Nash Equilibrium, perhaps by slightly preferring to play scissors, then they can be exploited by an opponent preferring rock. Of course as soon as the opponent tries to play the exploit they themselves become exploitable. John Nashs life was famously documented in the movie "A Beautiful Mind," a clip of which is shown below.  


from The Universal Machine http://universal-machine.blogspot.com/

IFTTT

Put the internet to work for you.

Delete or edit this Recipe

Read More..