Permalink
Browse files

Binaural4 revised (path searching)

  • Loading branch information...
1 parent 0a2b514 commit b4ef1fdbddb8b8eaed5867b693e6069a2c1f6512 @hoch hoch committed Oct 24, 2012
Showing with 31 additions and 10 deletions.
  1. +9 −7 binaural/Binaural4.ck
  2. BIN binaural/ir/ccrma-ballroom.zip
  3. +1 −1 panning/DBAP4.ck
  4. +21 −2 panning/DBAP4e.ck
View
@@ -10,19 +10,19 @@
// to each ear using the nearfield quad setup in the CCRMA
// ballroom with help from Jonathan Abel.
// @version chuck-1.3.1.3
-// @revision 5
+// @revision 7
// name:: Binaural4
// desc:: 4-channel binaural mixer
public class Binaural4
{
- // MODIFY THIS: file path for IR files
- "___YOUR_PATH_HERE___" => string _path;
- <<< "[BinauralMixer4] IR path:", _path >>>;
+ // NOTE: your "ir" folder needs to be in the same directory of
+ // this source code
+ me.sourceDir() + "/ir/ccrma-ballroom/" => string _path;
// print startup message
- <<< "[BinauralMixer4] Starting..." >>>;
+ cherr <= "[Binaural4] Starting...\n";
// number of synthesized point sources which will be
// the number of speakers that produced impulse responses
@@ -39,6 +39,7 @@ public class Binaural4
_path + _channels[channel] + "_" + ear + ".wav" => string filename;
SndBuf irbuf;
filename => irbuf.read;
+ cherr <= filename <= IO.newline();
50.0 => irbuf.gain; // ???
FFT X;
@@ -82,7 +83,8 @@ public class Binaural4
// set FFT parameters
1024 => int FFT_SIZE;
if (FFT_SIZE < irbuf.samples()) {
- <<< "[BinauralMixer4] Need longer FFT size:", FFT_SIZE, irbuf.samples() >>>;
+ cherr <= "[Binaural4] Need longer FFT size:";
+ cherr <= FFT_SIZE <= irbuf.samples() <= IO.newline();
}
FFT_SIZE => X.size => Y.size;
FFT_SIZE / 4 => int HOP_SIZE;
@@ -123,7 +125,7 @@ public class Binaural4
}
// log message and start loop
- <<< "[BinauralMixer4] Launched successfully." >>>;
+ cherr <= "[Binaural4] Launched successfully.\n";
while(true) {
1::minute => now;
}
Binary file not shown.
View
@@ -3,7 +3,7 @@
// @desc General purpose panner for 4-channel configuration. Based
// on DBAP (distance based amplitude panning) method.
// @revision 5
-// @version chuck-1.3.1.3
+// @version chuck-1.3.1.3 / ma-0.2.2c
class DBAP4 extends Chubgraph
View
@@ -5,7 +5,7 @@
// Some experimental effects are added to enhance spatial cues.
// @note This class requires Binaural4.ck as a public class
// @revision 4
-// @version chuck-1.3.1.3
+// @version chuck-1.3.1.3 / ma-0.2.2c
class DBAP4e extends Chubgraph
@@ -87,12 +87,31 @@ class DBAP4e extends Chubgraph
// ex) d4e.setDelayTime([0.5, 10, 5, 17]);
fun void setDelayTime(float dt[]) {
if (dt.cap() < 4) {
- <<< "[DBAP4e] Invalid array." >>>;
+ cherr <= "[DBAP4e] Invalid array.\n";
return;
} else {
for(0 => int i; i < 4; ++i) {
dt[i]::ms => _d[i].delay;
}
}
}
+
+ // setMode(): set mode for plain 4 channels or binaural
+ fun void setMode(string mode) {
+ if (_BINAURAL == 1) {
+ cherr <= "[DBAP4e] Can't use plain mode. Insufficient ports.\n";
+ return;
+ }
+ if (mode == "plain") {
+ for (0 => int i; i < 4; ++i) {
+ _r[i] =< _b4.input[i];
+ _r[i] => dac.chan(i);
+ }
+ } else if (mode == "binaural") {
+ for (0 => int i; i < 4; ++i) {
+ _r[i] => _b4.input[i];
+ _r[i] =< dac.chan(i);
+ }
+ }
+ }
}

0 comments on commit b4ef1fd

Please sign in to comment.