Personal tools
You are here: Home Science by Ear Workshop Drop box eeg session addons playing a buffer of the eeg files

playing a buffer of the eeg files

p = ProxySpace.push(s)
s.boot

q = q ? ();

q.localDir = Document.current.path.dirname;


// Task 1

q.filenames = ["/GrazEEG_aifs/alpha_aifs/GBalpha_O1.aif", "/GrazEEG_aifs/alpha_aifs/GBalpha_O2.aif"]

q.filenames

q.b = q.b ? BufEnvir(s);

q.filenames.do{|name, i|
q.b.read(name.asSymbol, q.localDir++name)
}

~source.clear
~source = {
q.filenames.collect{|name|
var bufnum;

bufnum = q.b[name.asSymbol].bufnum;
PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum) * 0.5, loop: 1)
}
}


~source.play
~source.stop



~freqMapper = {
var freq, amp, sum;

freq = ~source.ar.range(200, 400).lag(0.01);
amp = ~source.ar.max(0).min(1);
sum = SinOsc.ar(freq, 0, amp);
}

~freqMapper.play
~freqMapper.stop


(
s.boot;
p = p ? ProxySpace.push(s);
q = q ? ();

// create localDir
q.localDir = Document.current.path.dirname;
q.b = q.b ? BufEnvir(s);

// Task 2
q.filenames = [
"GBalpha_O1.aif",
"GBalpha_O2.aif",
"GBalpha_P3.aif",
"GBalpha_P4.aif",
"GBalpha_Pz.aif",
"GBalpha_all5.aif",
"MLTalpha_O1.aif",
"MLTalpha_O2.aif",
"MLTalpha_P3.aif",
"MLTalpha_P4.aif",
"MLTalpha_Pz.aif",
"MLTalpha_all5.aif"
].collect{|name| "/alpha_aifs" ++ name};

q.filenames.do{|name, i|
q.b.read(name.asSymbol, q.localDir++name)
};
)


~source.clear
~source = {
q.filenames.collect{|name|
var bufnum;

bufnum = q.b[name.asSymbol].bufnum;
PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum) * 0.5, loop: 1)
}
}


~source.play
~source.stop

 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: