Virtual Neurophysiology Workbench

The DIY Brain Lab! Developed to improve the accessibility of neuroscience education.

Use the following code in MATLAB or Octave to play your NEURON simulations as audio files to stimulate your brain. You will need to save out each membrane potential as a .dat file. You should create a single folder with all of the currents you want to use (and only the currents you want to use) to create your audio version of the simulation.

The first function listed below, VNW_simtosound1, will play a single cell simulation. To use this function, save the script, then in the command window of MATLAB, call the function with the name of the directory where your current files are saved and the number of times you want it repeated as the inputs.

EXAMPLE:   VNW_simtosound1('my_directory', 50)
This will take all of the files saved in 'my_directory,' sum the membrane currents from the
simulation, and play it out as a continuous audio file for 50 repetitions.

The second function lets you play simulations from two different cells at the same time. The left headphone will play the simulation from one cell and the right headphone will play the simulation from a second cell. The inputs for this function are the same as the single cell model, however, two directory names are required.

Remember: The only files that should be in the directories you are using are the .dat files you have saved out from NEURON!

VNW_simtosound1

function [sound_out] = VNW_simtosound1(directory, sig_L)
currents = dir(directory); %directory with only transmembrane i files
i_num = length(currents(:)); %number of files in directory
i_vecs = [];
for k = 1:i_num %input vector files into i_vecs
if currents(k).bytes == 0
continue
end
vec = textscan(fopen(currents(k).name),'%n %n','Headerlines',2);
vec = vec{1,2};
i_vecs = [i_vecs, vec];
end
i_total = sum(i_vecs,2); %sums all currents for each time point
sound_out = [];
for k = 1:sig_L %time to repeat signal (sig_L ~seconds)
sound_out = [sound_out;i_total];
end
sound(sound_out, 48000*0.05)%play audiofile



VNW_simtosound2

function [sound_out] = VNW_simtosound2(directory1,directory2,sig_L)
currents(1,:) = dir(directory1); %directory for cell 1
currents(2,:) = dir(directory2); %directory for cell 2
i_num(1) = length(currents(1,:)); %number of files in cell 1 dir
i_num(2) = length(currents(2,:)); %number of files in cell 2 dir
i_vecs{1} = [];
i_vecs{2} = [];
for i = 1:2
for k = 1:i_num(i) %input vector files into i_vecs
if currents(i,k).bytes == 0
continue
end
vec = textscan(fopen(currents(i,k).name),'%n %n','Headerlines',2);
vec = vec{1,2};
i_vecs{i} = [i_vecs{i}, vec];
end
i_total{i} = sum(i_vecs{i},2); %sums all currents for each time point
end
i_total = cell2mat(i_total);
sound_out = [];
for k = 1:sig_L %time to repeat signal (sig_L ~seconds)
sound_out = [sound_out;i_total];
end
sound(sound_out, 48000*0.05)%play audiofile

Contact

For answers to questions regarding experiments and other information presented as part of the Virtual Neurophysiology Workbench, we encourage you to go to the Q&A forums and take part in discussions with your peers.  There are separate forums for general questions and for troubleshooting various issues.

For all other inquiries please email Christopher Butson, PhD at butson@sci.utah.edu or Shana Black at shana.black@sci.utah.edu 

Thank you for your interest!