Getting started with Spike Recorder for Android
Setting up a connection
Recording spikes on your Android phone is simple. The first thing you’ll have to do is to download Spike Recorder from the App Store. Search for “Spike Recorder”, check that it is from Backyard Brains, and click install. See below.
After you have successfully installed your Spike Recorder and allowed the application to access your Audio & Microphone input (needed to record from the Green Smartphone cable), as well as an access to read your Files (needed to save your precious data!), next is to properly connect your chosen Spikerbox and connect it with the Green Smartphone cable.
The Green Smartphonecable comes within every spikerbox kit or bundle. But be careful, there is a specific position of cable connection and it’s important to connect it according to labels.
There are 2 labels marked on the Green audio cable. One end is labeled with “SpikerBox” which goes into the SpikerBox and another one is labeled with “Smartphone” which goes into your Android phone, tablet or other mobile devices.
Important thing to mention is that the Green audio cable is only a mono audio input and it doesn't provide stereo or 2 channels.
If your Smartphone doesn’t have a 3.5 audio port in it, because newer ones don’t support it any longer, then you can easily connect your Spikerbox through the USB-C port on your phone. Only thing you’ll have to get is an adapter from 3.5 mm Audio to USB-C.
If your Android has an USB-C port available then with microUSB to USB-C adapter you could work with following devices:
*Muscle SpikerBox Pro
*Neuron SpikerBox Pro
*Heart & Brain SpikerBox
Example of the connection
Once you’ve attached your Muscle SpikerBox Pro with you Android phone through an adapter, wait for around 20s for the communication between the boards to become established. Then a notification will pop up about the successful connection with your board. Then in the Settings Tab select different types of colours for your second channel.
There is an option adding our extension devices to the connection, like Reaction Timer or Reflex hammer.
When adding a Reaction Timer to your Muscle SpikerBox Pro connection, the Spike Recorder for Android will immediately recognize it and each time you press a button on the Reaction Timer, Spike Recorder will put an event marker, shown below.
When connecting Reflex Hammer to your Muscle SpikerBox Pro, you’re adding a third channel into connection. So in the Config Tab, in Spike Recorder app, you’ll have to select a colour for that third channel, just like it’s shown below.
But before you jump into your experiments and start receiving spikes in Spike Recorder, there is a neat little feature in the Settings tab, which will help you a lot with your experiments.
When you click on the little “Gear” icon, in the upper-right corner Settings tab will open and in it you can choose which time of signals you want to get.
Clicking on each setting like EMG, Plant, ECG, etc. you’ll see that the band-pass filter cut-off frequency will automatically adjust, enabling you less noise and smoother experimenting.
Depending on your country’s “mains”frequency, you can choose to enable the notch filter (50 or 60 Hz)which will automatically attenuate signals in that frequency range (noise coming from “the mains”) and prevent it from interfering with your experiment.
And last but not least, you can choose which type of color your channel will be.
Real time view
When you open the Spike Recorder it will automatically be in the View/Record screen and will display the waveform of the signal captured in real time.Signal waveform will be displayed along with the horizontal time scale at the bottom of the screen.
You can examine the signal in greater detail by zooming in and out by using a two finger pinch gesture for amplitude or time scale. The time scale can be changed from 0.1 ms to 3 seconds. This flexibility enables you to examine the signal in full depth, from a single neuron/muscle spike to a series of spike bursts.
Note, if the time scale is set to 3 seconds, the application will display 6 seconds of signal on the screen since the time scale is exactly half of the screen wide. Also in the Real time view you’ll be able to see FFTand enable Thresholding mode.
FFT (Fast Fourier transform) is an algorithm that computes the discrete Fourier transform of a sequence. With the FFT button you can enable real time spectrogram calculated using FFT (Fast Fourier transform).
The spectrogram is a 2D representation of the magnitude of the spectrum of the signal in time. The horizontal axis represents the time of the signal and the vertical axis represents the frequency axis.
The value of magnitude of the particular frequency is represented by the color. Low magnitudes are represented with blue colors and high magnitude is represented with red color.
Therefore, for each time point, we see a distribution of frequency components. You can think of each column as the frequency decomposition of a chunk of the signal centered at this time point. Our FFT is made for low frequency signals EEG, EKG.
How to record spikes
So you’ve set up your experiment, turned on the SpikeBox, hooked it to your phone, enabled proper settings and received awesome spikes. But how do you actually save them?
It’s basically very easy and all you have to do is to click on the Red circle in the upper right corner, right next to the Settingstab. During the recording, the application will display a red bar on the top of the screen with the time elapsed since the beginning of the recording. When you tap on the red bar, the application will stop recording and save data into a raw audio file (.wav format).
All your recordings can be easily accessed by using the Recordings tab at the bottom right corner of the screen. There, all your recordings will be aligned according to early dates.After you have chosen one of the recordings, the application will offer you numerous options.
Now let's take a look at each option.
If you select the File Details option, the application will show you details of the recording.
Here you can change the name of the file, add a comment to the file, and see other details such as the sampling rate, the length of the file, the date it was created, bits per sample, etc.
Besides File Details, you can also replay your recording (Play), analyse it, share it with other mobile devices or your desktop computer or delete it individually or all together.
Play option will open a new screen similar to live data view and immediately start playing the recording. You can pause at any time by using the Pause button and examine the signal in greater detail by zooming in and out by using two-finger pinch gestures for amplitude and/or time scales.
Scroll bar at the bottom will help you scroll the signal through time and easily jump from one part of the signal to another. Also, you can do similar things if you put your finger on the signal and drag it left and right.
Use the Share option to send your recording to another mobile device or desktop computer. The Share option will open a standard system sharing window and in it you will find multiple options, depending on your system configuration and installed third party applications.
If you, for example, share the recording using email, the receiver can open the email in their native email client and tap and hold the attachment's icon to access the import option for our mobile application.
Analysis of recorded signals
Spike Recorder app has the ability to perform numerous analysis on the recorded signal:
● spike frequency
● root mean square (RMS)
● autocorrelation graph
● cross-correlation graph
● interspike interval graph (ISI)
● average spike waveform
And to access all those features click on the Analysis tab, from Recordings tab. In it there will be 5 main analysis options, you can choose from. And which each one will be discussed below.
The Find Spikesoption will enable you to access spike sorting screen. Once you're in, you will be presented with a signal waveform that is processed with a spike detection algorithm. You can scroll through the entire recording using the scroll bar.
The spikes of the neurons close to your recording electrode will normally have the highest voltage peaks. Sometimes you will be able to see additional spike trains of a smaller amplitude in the recorded signal. These spikes correspond to the activation of a more distant neuron. The algorithm used in our application is very sensitive and will typically detect and mark all those spikes from different neurons. In addition, it will sometimes detect noise glitches as valid spikes.
Initially, all these spikes in the signal will be marked with a white dot. In order to filter and extract only spikes that correspond to the activation of one neuron or muscle contraction, you will need to adjust a valid amplitude interval using the two handles on the left and right side of the screen.
After moving the two handles and adjusting your selection interval, you will see the selected spike marks become red. It is important to note that the selection interval is immediately applied to the whole signal and not only to the part of the signal that you can see on the screen.Therefore, always use the scrollbar at the bottom of the screen to check if the filtering interval is compliant with the rest of the signal.
After adjusting the filtering interval, a set of selected spikes will be treated as one spike train that corresponds to the activation of a single neuron. All the other spikes (with a white mark) will be discarded when you finish spike sorting.
If an additional spike train from a distant spike is visible in your recorded signal, you can create an additional valid voltage interval that will extract only spikes from that additional signal.
Note that the two intervals should not overlap since it will give incorrect results in the subsequent analysis.
To create an additional spike train, tap on the “+” button on the top of the screen. The application will save information about the first valid voltage interval, create a new one and position handles at the initial value of zero volts. Now you can adjust the new voltage interval in a similar way you did with the first spike train. This time, the selected spikes will be marked with yellow marks.
When you create the second spike train, two additional buttons will appear at the top of the screen (refer to the image above). By using the handle button you can switch between the created spike trains and with the second (trash can) button you can delete the current spike train.
When you are satisfied with the filtering results, you can tap on the back button and all spike trains will be saved automatically.
Is the correlation of a signal with a delayed copy of itself as a function of delay.The analysis of autocorrelation is a mathematical tool for finding repeating patterns and is very similar to the ISI graph and is also calculated on a single spike train.
The horizontal linear axis represents the time difference between any two different spikes (note that ISI is calculated only for consecutive spikes). Unit on the time scale is second (s).
Vertical axis represents the absolute number of spike pairs we measured in the spike train. Therefore the height of one histogram’s bin represents the number of occasions we encountered given time difference between two different spikes in signal.
If you have multiple spike trains in recording you can select which one you want to zoom in by tapping on the small graphs, in the bottom of the screen.
Interspike interval graph (ISI)
Is derived from a single spike train and it’s the time between subsequent action potentials (also known as spikes) of a neuron, or a group average there of.
The X axis represents the time difference between two adjacent spikes in a single spike train. For this graph we used a logarithmic time scale to be able to show small interspike intervals and greater interspike intervals on the same graph. So, for an example, 1E2 seconds represents 10 seconds which is equal to 0.01 seconds or 10ms.
TheY axis calculates interspike intervals for all adjacent spikes and sorts them in bins. Namely, the height of one bin represents the number of occasions we encountered given an interspike interval in signal.
If you have multiple spike trains in recording you can select which one you want to zoom in by tapping on the small graphs, in the bottom of the screen.
Is used to discover the hidden relation between two neurons or spikes and it is calculated using information from two spike trains. It will be available in Analysis options screen only if you made more than one spike train during spike sorting.
When you select the cross-correlation in Analysis options screen, the first thing you will be presented with is a matrix of cross-correlation graphs.
Here you can have a brief overview of the correlation between different spike trains in your signal. Note that graphs on the main diagonal represent cross-correlation between same spike trains which is analogous to autocorrelation of that spike train.
If you want to see one of the graphs in greater detail you can open the graph by tapping on the graph image.
Similarly to previous graphs, the horizontal axis represents the time difference between two spikes given in seconds. On the vertical axis, the height of one histogram’s bin represents the number of occasions we encountered given time difference between two spikes from different spike trains.
Average spike graph displays waveform of average spike calculated by averaging all spikes in spike train centered around positive peak.
Horizontal linear axis represents time in milliseconds centered around positive peak and vertical axis displays peak to peak amplitude of average spike waveform in voltage units.
Beside average waveform graph (black line in the middle of every graph), you will see a standard deviation of average waveform as a colored area around average waveform.
Note: If you want to export the graphs for your research articles or study, then the only way you can do that is by taking a screenshot of the chosen graph, then editing it and adding it into your paper.
Thresholding, RMS & measurement
Threshold view is used to average spikes or take a snapshot of a single spike.
By selecting on the Threshold tab, the application will enter the threshold mode that will catch the snapshot of the signal every time the waveform crosses the threshold level.
On the top of the screen you will find a slider that varies from 1x to 100x. With it you can adjust the number of consecutive spikes that will be used for the calculation of the average spike.
For example, if you select 25x, 25 consecutive spikes are averaged. Spike Recorder will always use the 25 most recently captured spikes for the calculation of the average spike, independently of the length of your recording. In extreme cases, when you set a slider to the value of one, the application will present only a raw signal of the most recent spike.
Threshold level can be adjusted at any time by moving the red threshold line up and down using a handle on the right hand side of the screen and during thresholding, similarly to playback screen, you can tap and hold a finger on the waveform for a second, a selection marker will appear.
By holding down and dragging your finger in a horizontal direction over the signal you can select an interval of the signal. Application will show you the time length of the interval in milliseconds and calculate RMS (Root mean square) of the selected portion of the signal.
Below the Threshold button, you will see a Trigger type feature.
Trigger type will give you different conditions for triggering. It works when a certain condition is met the Spike Recorder takes a snapshot of the signal. Depending on the number of the snapshots selected (N), it will average the last (N) snapshot and display the average on the screen.
When you play your recording after you have finished spike sorting, you will notice that all spikes, that belong to created spike trains, are marked with colored dots. Now you can find part of the recording that you are interested in and analyze it in greater details.
It’s done by tapping and holding two fingers on the waveform for a second a selection marker will appear on the screen. Now you can drag the selection marker over the screen and select the interval of the signal that you want to analyse. And Spike Recorder will display gray background for the selected interval of the recording.
In addition to Spike Recorder will calculate and display:
● RMS (root mean square) of the signal
● length of the selected interval in seconds
● spike counts and spike frequency for every spike train that you created