Backyard Brains Logo
+1 (855) GET-SPIKES

items ()

Data Analysis

Revision as of 23:09, 4 March 2015 by Timothy (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

We’re busy working on improving our software (we’re hiring by the way), and we plan to keep making it easier to record and analyze your spikes. But, for right now, how do you get your spikes out of the SpikerBox and into your computer for data analysis? There are multiple options.

1. If you have an iPhone/iPad/iPod Touch

With our smartphone cable, you can interface the output of the SpikerBox to your iPhone, using our "Backyard Brains" app free download.

Exp9 iPhoneApp sm.jpg

Then, when your spikes are displaying, hit the record button. Your signal will be recorded as an uncompressed .aif audio file. You can then e-mail it yourself using our file system menus ("share" button) or over a wireless TCP/IP connection. You can also download to your DropBox! Note that you do not necessarily need to use the iPhone cable, you can simple place your SpikerBox next to your iPhone to record through the iPhone's microphone. It will be noisy though.

2. If you have an Android phone

You can download the Android version of our software. This currently allows viewing in continuous mode and recording. The Smartphone Cable also works on Android Phones.

3. If you have a laptop, pt I

We have released the "Backyard Brains Spike Recorder," a native application that works on any PC (MacOs, Windows, Linux, etc). This software also has a built in measuring tool if you want to measure reaction time in your EMG recordings, and support "Spike Sorting" and RMS calculations to quantify your results.

3. If you have a laptop, pt II

While the BYB Neuron Recorder is preferred, you can also use Audacity. Audacity is an open-source audio recording program that works on any machine running any OS whatsoever, and you can use it to record your spikes via the line-in on a laptop.

Exp9 Audacity.jpg

But what cable should I use with my laptop?

It depends on your laptop. Most PC laptops have a separate headphone and line-in jack. You want to plug into the line-in (microphone) jack. You can use a normal audio patch cable (you can also buy it from us, we call it a "laptop" cable).


If you have a Mac Laptop with two audio ports (like newer MacBook Pro's and older iBooks and MacBooks), you want to plug into the line-in port (has a weird symbol).


If you have a MacBook Air or an older MacBook Pro, you need to use our Smartphone Cable. A regular audio cable will not work. These laptops only have one audio jack and it is a combined mic/headphone jack.


But how do I set up Audacity for record my Spikes?

  1. Fully charge your laptop battery and record from the SpikerBox with your laptop running on battery power. If you need a plugged-in laptop, use a Faraday Cage with your SpikerBox.
  2. Set the brightness of your screen to maximum. A dimly lit screen on some laptops "flickers" causing electrical noise you don't perceive but the SpikerBox does.
  3. Plug your SpikerBox into the Laptop with the appropriate cable discussed above.
  4. Open Audacity, and go to File → Preferences. Due to differences in Audacity between versions, there may be differences in how the Preferences window is organized. The primary settings you need to set up are the same, even if they look a little different on your screen.
  5. Select the Audio I/O tab in the Preferences window. Some versions place this window in the Devices tab.
  6. Select the "Built-in Input" as the Recording Device from the drop down menu.
  7. Select "1 (Mono)" from the Channels drop down menu (unless you are doing our Earthworm Conduction Velocity Experiments, then you should select "2 (Stereo)" Channels).
  8. Select "Built-in Output" as the Playback Device from the drop down menu.
  9. The following steps are found either in the Audio I/O or Recording tabs in the Preferences window. The following checkboxes are listed in order as they appear:
  10. Uncheck the box: Play other tracks while recording a new one.
  11. Check the Box: Hardware Playthrough
  12. Check the box: Software Playthrough
  13. Select the tab labeled Quality. Set the Default Sample Rate to 44100 Hz (or 44,100 times per second).
  14. Audacity should now be configured to record from your SpikerBox. Hit the "Record" Button in the upper left of the screen, Zoom into the the Y-Axis (by clicking on the Y-axis. You can zoom out by Shift-Clicking).

Below are examples of how your Preferences window should be configured. Keep in mind that your version of Audacity may look different, but the settings will be the same. Two examples are provided, with the important settings highlighted.


Audacity PC.jpg

4. If you have a laptop running Windows OS, pt I

You can use “SpikeHound”, a very nice piece of software, written by Gus Lott III, that was spun out of our friends at the Cornell CRAWDAD group,

Exp9 SpikeHound.JPG

This is meant for undergraduate students/professors, so it may be intimidating for the novice, but it has a good instruction manual on the website.

5. If you have labtop running Windows OS, pt II

SimpleNeuro was designed and coded by our friends Mohsen Omrani and Ethan Heming at Queen's University in Kingston, Ontario, Canada. This will allow you to display your spikes in real-time as well as do on-the-fly data analysis by plugging your SpikerBox through the line-in port on your laptop. 2013 Update: You no longer need Matlab for this program to run! It is now a fully enclosed executable file. See readme.txt in download file for instructions.

Exp9 SimpleNeuro.JPG

You can contact Ethan at heming.e [at] gmail [dot] com if you have questions about his software.

6. If you have a PC (desktop tower)

We do not support hooking the SpikerBox up to a desktop computer. 60 Hz (or 50 Hz in Europe) line noise will dominate your recordings. After acquiring your data on a battery powered laptop, analyzing your data on your PC is fine of course. UPDATE: We have discovered if you build a Faraday Cage, you can drastically reduce line noise and can record on a desktop computer fine.

7. If you have an Amazon Kindle Fire

This is highly unorthodox (a hack) and prone to crashing, but there is a way to load our Android app on your Kindle Fire. The Kindle Fire does not have an external microphone, but the headphone jack does support a line in that is compatible with our smartphone cable.

  1. Plug your Kindle into your computer, so that you can drag and drop files into it.
  2. Download our Backyard Brains Android APK, unzip it, and transfer it into the "documents" folder of your Kindle.
  3. Unplug your Kindle Fire from your computer.
  4. In the Amazon App store on your Kindle, download and install a free file browser, such as ES File Explorer
  5. Open ES File Explorer and navigate to the Backyard Brains APK you previously transferred to your Kindle. Touch the Backyard Brains icon, and it will install the app on your Kindle.
  6. Insert the smartphone cable (the "smartphone" end) into your Kindle.
  7. Restart the Kindle.
  8. Open up the Backyard Brains app, and plug in the other end of the smartphone cable into the SpikerBox.
  9. You've got Spikes! Note that if you remove the smartphone cable from the Kindle, the Kindle will get cranky and the app will no longer acquire data, even if you insert the smartphone back in. It will work again, though, if you insert the smartphone cable back in the Kindle AND restart the Kindle.

Complicated? Yes. A total hack? Absolutely. But here is proof:


8. If you are a professional neuroscientist (or an amateur who wants to dive down the rabbit hole), you can begin analyzing your data using Matlab:

Matlab likes .wav files, so save any recordings in that format. If you have recorded your spikes using our iPhone app, the iPhone app saves the data in an uncompressed .aif file. You can convert the .aif audio file to a .wav file using Audacity or iTunes.

Once you have your .wav files of your recording, open Matlab, and simply go to File-→import data. Your data will be displayed in the workspace with the variables: [data] [fs]

"Data" is your raw data. "fs" is the sampling frequency of your data.

We leave you with a simple function (plotSpikes.m) to get you started and plot your data.

If you are looking for a simple way to count the number of spikes in your experiment, Jennifer M. Groh from the Center for Cognitive Neuroscience at Duke University sent us some Matlab code that will help you. Import your SpikerBox data into matlab, then run count_spikerbox_spikes. Type in the start time and end time of your experiment, choose a voltage threshold, and the script will count (and show you) how many spikes have crossed that threshold.

Happy analysis! If you develop anything, or find something interesting, let us know!

P.S. Recordings still too noisy? This old video (made summer 2010) may help you identify noise sources.