[Eeglablist] Aural ERP

Scott Makeig smakeig at gmail.com
Tue Sep 4 14:33:58 PDT 2012


Ben -

A belated 'Nice!' ... Would you like to make a pop_function
pop_EEGtosound() that calls EEGtosound() and a small plugin_function
plugin_EEGtosound() that creates a link to it in the EEG menu. Then anyone
who downloads the 'EEGtosound plug-in' can listen to / demo their ERP
brainwave of choice from the EEGLAB menu.

It's actually quite easy for you (or anyone) to do -- to learn how, read
this <http://sccn.ucsd.edu/wiki/A07:_Contributing_to_EEGLAB>.

Scott Makeig

On Fri, Apr 13, 2012 at 2:42 PM, <BBR2 at pitt.edu> wrote:

> For all interested, here is a way to listen to your voltage/time data in
> Matlab.
> *(not sure if this sent the first time, if this is repeated I apologize)!
> -Ben
>
> *************
>
> function [] = ERPtosound(ERP,nums,docomp, doloop)
>


> % Plays channels or components of an epoched EEG data ERP trial average

    %  as a summed FM sound.

    % Inputs:
    % EEG is an epoched EEG data structure

> % nums is a list of (at most a few!) channel or component numbers
>
    % docomp is an indicator:  0 = play channel ERP(s)
    %                                        1 = play component ERP(s)
    % doloop is an indicator:    0 = play once
    %                                        1 = loop until killed

   %Requires epochs structured in EEG.data
      if EEG.ntrials == 1
             printf('ERPtosound(): requires epoched data.\n');
             return
      end

% Alter N below to change duration of the sound
    N=500;

    if nargs<3
        docomp = 0;
    end
    if nargs<4
       doloop = 0;
   end
   if max(nums) > EEG.nbchan or min(nums) < 1
             printf('ERPtosound(): bad channel list (0 < nums <
%d)\n',EEG.nbchan);
             return
   end

   % Make the trial average for channel(s) nums
   if docomp  % make component average
        if isfield(EEG.icaact)
            gave=mean((EEG.icaact(nums,:,:)),3);
        else
            printf('ERPtosound(): No component activations found.\n');
            return
        end
    else % make channel average

>      gave=mean((EEG.data(nums,:,:)),3);
>
   end

num_cols = length(gave(1,:));
> newlo=min(gave(1,:));
> posnewlo=sqrt(min(gave(1,:)).^2);
> newhi=max(gave(1,:));
> spred=(newhi-newlo);
>
> % Make the sound waveform - If multiple chans/comps, their sounds are
summed

> t=0:N;
> Q=zeros(1,N+1);
> j=0; i=0;
> for i=1:1:num_cols;
>    j = sum(sin(3*pi*t*(1/(100*((gave(:,i)+posnewlo)/spred)))));
>    B=[double(j)];
>    Q=[Q B];
> end
>
> [w,c]=size(Q);   % here, w == 1
>
    do

>    for n=1:1:w;
>      sound(Q(n,:));
>    end
>
    while (doloop)

>
>
>


-- 
Scott Makeig, Research Scientist and Director, Swartz Center for
Computational Neuroscience, Institute for Neural Computation; Prof. of
Neurosciences (Adj.), University of California San Diego, La Jolla CA
92093-0559, http://sccn.ucsd.edu/~scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20120904/86c2ea3a/attachment.html>


More information about the eeglablist mailing list