Converting to a WAV File: The first step in using an audio program for EEG analysis is to convert one's EEG data into an audio file. Since I usually work in Windows, I tend to convert all of my EEG data into WAV files. I choose WAV because it is uncompressed. I never choose MP3 because it is very unclear what its "perceptual coding" would do to my precious brainwave data. So, a WAV file is what I would recommend. But how do you get EEG data into a WAV format? If your EEG data is in text format (such as is logged by the OpenBCI GUI), you could use my Processing sketch "ConvertToWAV". This sketch will read in an OpenBCI log file and write each EEG channel out as its own WAV file. You can get the sketch on my GitHub.
Audacity: Once the data is in WAV format, you can open it in any audio program. A popular (and free!) audio editing program is Audacity. While it is not my favorite audio editing program, it is perfectly sufficient for working with EEG data. After opening your EEG data, the trick is to figure out how to switch the display from waveform to spectrogram. The screen shot below shows how to do it.
Changing to Spectrogram View in Audacity |
Once Audacity is in spectrogram mode, you need to zoom in on the vertical axis in order to see the interesting EEG features, which are usually focused in the lower frequencies. In Audacity, you zoom simply with a click-and-drag on the vertical axis. Then, after manipulating the spectrogram settings under the "Preferences" menu, you can get a spectrogram like the one shown below. While the color scheme hurts the eyes a bit, this spectrogram is good enough to see the same kind of EEG entrainment as seen in my original Matlab plot. Furthermore, the tools in Audacity let you further analyze the EEG data through zooming, filtering, amplifying, and (if you change the file's sample rate to increase the playback speed) you can use Audacity to listen to your own brain waves! Audacity is definitely a useful tool for working with EEG data.
In Audacity, a Spectrogram of my EEG Data |
The spectrogram settings that I used are shown in the screen shot below.
My Display Settings for Making EEG Spectrograms in Audacity. I changed the Window Size, the Gain, and the Range. |
Cool Edit Pro: I first started getting into spectrograms in the late 90's because this is when I started working with audio and music on the computer. What got me hooked on spectrograms was a piece of shareware called Cool Edit. It was a stupid name for an otherwise outstanding program. It was so useful that I spent the extra dollars and bought its upgrad -- Cool Edit Pro. Cool Edit Pro has a *great* spectrogram display, as shown below. Unlike Audacity, which requires lots of manipulation of the spectrogram settings to get a useful view, the Cool Edit Pro display always seems just right. Unfortunately, Cool Edit Pro isn't available anymore -- it was bought by Adobe in the early 2000s and became Adobe Audition. Audition is also fine for making spectrograms (I have only used up to Audition 3.0), but it is expensive.
An EEG Spectrogram in Cool Edit Pro V1.2a. It's an old school program that totally rocks. |
In Cool Edit Pro, the only display parameter that you need to change is the "Resolution" (ie, FFT size). You do that under the "Settings" menu.
My settings for viewing EEG spectrograms in Cool Edit Pro. I changed the Resolution value. |
Raven Lite: A third option for making spectrograms is a bit more obscure. A bunch of years ago, I came across a program called "Raven Lite", which is produced by the Ornithology Lab (ie, bird science) at Cornell University. The "Lite" version is free. You can download it and immediately use it for spectrograms, though it is crippled in other ways until you email them for a free (non-commercial) key. What I really like about Raven is that, as shown in the screen shot below, its spectrogram controls are right on the main window for easy manipulation. Also, I like its color map options way better than what is available in Audacity. Finally, Raven is one of the few programs that let you see both the spectrogram view and the waveform view at the same time (not shown). It is really nice to have that capability.
Raven Lite 1.0 from the Cornell Laboratory of Ornithology. It's a pretty good viewer. The settings for the display or right here in the main window. |
Other Options: Because I have Matlab and Cool Edit Pro (and Audacity and Raven) I haven't spent a lot of time looking at other options. Does Garage Band offer a spectrogram view? Is there a plug-in for iTunes or Windows Media Player that gives spectrograms? I'm curious to hear what you folks use. Drop a comment and let me know!
How do you normally make those spectrograms you post here?
ReplyDeleteHey, thanks for reading!
DeleteI usually use Matlab because I have access to that (expensive!) package through my workplace.
Chip, All of the VPL (visual programming language) style EEG apps give fairly decent spectrogram and spectrum displays. I use Bioexplorer and BioEra. Brainbay has this. On the high end, National Instruments LabVIEW, which I know you've used as well. (It does come in an inexpensive student version).
ReplyDeleteThese also allow you to see the displays while the data is being recorded live, and record to a file if you wish. Later you can play back from that file and see the same displays.
I don't know much about Bioexplorer and BioEra. It looks like they're a couple of hundred dollars each. Do you like them sufficiently to recommend them over BrainBay or other software that one might home-brew?
DeleteChip
Bioexplorer is in use by I would estimate hundreds of neurofeedback practitioners. Pete Van Deusen (the teacher and wizard at brain-trainer.com), uses it for all his protocols, designs, assessments. Although the support level by the Bioexplorer developer is minimal, (no new features are being added) and I think he only makes new releases for adding new hardware devices.
DeleteI havent used the free Brainbay yet, but from looking over the documentation, it seems capable of many of the Bioexplorer features. I could guess that with advent of the OpenBCI hardware, it's popularity will take off.
BioEra on the other hand is a different animal. Many commercial products (Cygnet, LENS) are using it as the foundation of their applications. So it has quite a toolbox of functionality. But the learning curve is substantially more steep than Bioexplorer. There are things you cannot do with Bioexplorer that are possible with BioEra, such as InfraLow Frequency protocols.
I wonder that if National had a version of LabVIEW that was reasonably priced, it might have been a major player in this field. But of course that is not the case. One vendor (Zengar) did go with a LabVIEW base. Can't think of any others.
Sorry I'm rambling here... One disadvantage of the VPL style tools is that once your design gets sufficiently complex and nested, it becomes challenging to track your incremental changes. Source code and diff tools, git etc. do have an advantage here. :-) If you had an language API framework geared toward biofeedback applications, say with the same sorts of tools available as BioEra, I think that would have a lot of appeal.
If you don't have MATLAB, and you're afraid of Python, the best alternative is... to stop being afraid of Python!! :)
ReplyDeletehttp://nipy.sourceforge.net/pbrain/
DeleteHey Rob, Thanks for the pointer to the EEG Viewer code. I'm checking it out now...
Delete...though, statements in its documentation like "Currently, there are several dependencies that need to be installed before installing the pbrain software"...well, that makes me a bit nervous.
Maybe it's time to put on my big-boy pants and wrestle with the Python. Maybe it's time to take my medicine and become stronger for it...
Here are install instructions for Windows... http://nipy.org/nipy/stable/users/installation.html If you use Python(x,y), it should be quite easy to install.
DeleteAnother free package that is used quite a bit by QEEG practitioners is EDFBrowser. EDF is a standardized way to interchange EEG data (EEG Data Format). So many amplifier software packages use EDF as an interchange format. The EDFBrowser has some cool features. And it is actively maintained by the author.
ReplyDeletehttp://www.teuniz.net/edfbrowser/
could you possibly shoot me a brain .wav file? I've been visualizing 'sound' waves made exported from ableton in a 3d program called Houdini. I've made an asset that can accurately visualize soundwaves in 3d. it would be cool to see what brain waves look like in 3 dimensions. you can contact me at ssimpson.sva@gmail.com
ReplyDeletethanks!
hey, it's a great thing you worked on. can we some how control the volume using the same set of data that we are getting from our brain ?
ReplyDelete