From 45dfb5debd4a0d0bc79ad8b6691576e8462d1396 Mon Sep 17 00:00:00 2001 From: David Doukhan Date: Mon, 7 Feb 2011 13:09:27 +0000 Subject: cw_binaural~ code and examples! Makefile still missing svn path=/trunk/externals/ddoukhan/cw_binaural~/; revision=14855 --- examples/01-getting_started.pd | 35 +++++++++++++++++++++++ examples/02-supported_hrtf_database.pd | 23 +++++++++++++++ examples/03-advanded_support_of_hrtf_database.pd | 29 +++++++++++++++++++ examples/04-using_subset_of_hrtf_database.pd | 8 ++++++ examples/05-cw_binaural~_creation_arguments.pd | 24 ++++++++++++++++ examples/06-FFT_filtering.pd | 20 +++++++++++++ examples/azimuth.gif | Bin 0 -> 3199 bytes examples/coordinates.gif | Bin 0 -> 5464 bytes examples/elevation.gif | Bin 0 -> 2934 bytes examples/fft_binaural.pd | 25 ++++++++++++++++ 10 files changed, 164 insertions(+) create mode 100644 examples/01-getting_started.pd create mode 100644 examples/02-supported_hrtf_database.pd create mode 100644 examples/03-advanded_support_of_hrtf_database.pd create mode 100644 examples/04-using_subset_of_hrtf_database.pd create mode 100644 examples/05-cw_binaural~_creation_arguments.pd create mode 100644 examples/06-FFT_filtering.pd create mode 100644 examples/azimuth.gif create mode 100644 examples/coordinates.gif create mode 100644 examples/elevation.gif create mode 100644 examples/fft_binaural.pd (limited to 'examples') diff --git a/examples/01-getting_started.pd b/examples/01-getting_started.pd new file mode 100644 index 0000000..6154fd3 --- /dev/null +++ b/examples/01-getting_started.pd @@ -0,0 +1,35 @@ +#N canvas 277 247 461 596 10; +#X obj 122 299 cw_binaural~; +#X obj 144 353 dac~; +#X obj 141 245 *~ 360; +#X obj 37 235 noise~; +#X obj 133 221 phasor~ 0.1; +#X floatatom 290 227 5 0 0 0 - - -; +#X msg 32 430 listen_db /home/david/listen/1048/COMPENSATED/WAV/IRC_1048_C +; +#X text 19 212 audio input; +#X text 132 201 azimuth (degree); +#X text 271 201 elevation (degree); +#X text 67 387 A click on this message loads the HRTF that will be +used: it is required to perform any processing.; +#X text 44 459 Listen HRIRs can be downloaded on the website of IRCAM's +Room Acoustics Team: see http://recherche.ircam.fr/equipes/salles/listen +Once a given HRIR has been unzipped \, the path to the directory containing +wavs corresponding to conpensated hrir should be given in the message. +; +#X obj 178 119 image azimuth.gif; +#X obj 350 133 image elevation.gif; +#X text 53 27 azimuth and elevation are expressed in vertical polar +coordinates; +#X text 59 -61 This patch performs binaural synthesis using cw_binaural~ +; +#X text 58 -37 More details concerning the methods used for the synthesis +can be found in: cw_binaural~: A binaural synthesis external for pure +data \, David Doukhan and Anne Sedes \, PDCon09; +#X connect 0 0 1 0; +#X connect 0 1 1 1; +#X connect 2 0 0 1; +#X connect 3 0 0 0; +#X connect 4 0 2 0; +#X connect 5 0 0 2; +#X connect 6 0 0 0; diff --git a/examples/02-supported_hrtf_database.pd b/examples/02-supported_hrtf_database.pd new file mode 100644 index 0000000..412375e --- /dev/null +++ b/examples/02-supported_hrtf_database.pd @@ -0,0 +1,23 @@ +#N canvas 1108 244 438 547 10; +#X text 60 9 Support for HRTF Databases; +#X msg -18 278 listen_db /yourpath/1048/COMPENSATED/WAV/IRC_1048_C +; +#X text -15 125 Listen HRTF Database it can be downloaded on the website +of IRCAM's Room Acoustics Team: see http://recherche.ircam.fr/equipes/salles/listen +Once a given HRIR has been unzipped \, the path to the directory containing +wavs corresponding to conpensated hrir should be given.; +#X text -21 317 CIPIC HRTF Database the database is available in .mat +format at http://interface.idav.ucdavis.edu/data/CIPIC_hrtf_database.zip +it can be converted to wav files using the matlab script cipicdb2wav.m +provided in cw_binaural archive Otherwise \, you can download the converted +database at http://www.limsi.fr/Individu/doukhan/cipic.bz2; +#X msg -21 490 cipic_db /yourpath/subject_003; +#X text -3 43 cw_binaural~ provide suppport for any hrtf database \, +assuming each impulse response is stored in a wav file whose name contains +the azimuth and elevation of the impulse response in degree.; +#X text -14 223 the syntax of the message to send to the external to +load a listen hrtf database is: 'listen_db' followed by the path to +the compensated impulse response; +#X text -23 439 the syntax of the message to send to the external to +load a CIPIC hrtf database is: 'cipic_db' followed by the path to the +compensated impulse response; diff --git a/examples/03-advanded_support_of_hrtf_database.pd b/examples/03-advanded_support_of_hrtf_database.pd new file mode 100644 index 0000000..94d83aa --- /dev/null +++ b/examples/03-advanded_support_of_hrtf_database.pd @@ -0,0 +1,29 @@ +#N canvas 175 52 512 755 10; +#X text 100 16 Advanded Support for HRTF database; +#X obj 222 408 image coordinates.gif; +#X msg 19 549 listen_db /yourpath/1048/COMPENSATED/WAV/IRC_1048_C; +#X text 14 527 the two messages bellow are equivalent to load listen +HRTF; +#X text 24 637 the two messages bellow are equivalent to load CIPIC +HRTF; +#X msg 20 572 set_hrtf_db /yourpath/1048/COMPENSATED/WAV/IRC_1048_C +IRC_[0-9]+_C_R[0-9]+_T([-+]?[0-9]*//.?[0-9]+)_P([-+]?[0-9]*//.?[0-9]+)//.wav +true true; +#X msg 22 661 cipic_db /yourpath/subject_003; +#X msg 22 688 set_hrtf_db /yourpath/subject_003 subject_[0-9]+_azim_([-+]?[0-9]//*.?[0-9]+)_elev_([-+]?[0-9]*//.?[0-9]+)//.wav +true false; +#X text 20 46 cw_binaural~ provide support for any hrtf database that +can be used through the message set_hrtf_db \, which has 4 arguments +1st arg is the path to the directory containing the hrtf database to +use \, such than each impulse response is stored in a wave file whose +name contains the azimuth and elevation of the hrtf in degree 2nd arg +is a regexp telling how to decode the wav file name: the regexp MUST +have 2 groups corresponding to the azimuth and elevation 3rd arg should +have the values 'true' \, or 'false': it tells if the azimuth correspond +to the first group of the regexp. if set to false \, then the elevation +is the first group of the regexp 4th arg should have the values 'true' +or 'false'. If set to true \, then the database is sampled using vertical-polar +coordinates (like listen database) \, if set to false \, the database +is sampled using interaural-polar coordinates (like cipic database). +Those coordinate systems are represented in the figure bellow \, comming +from the CIPIC Interface lab.; diff --git a/examples/04-using_subset_of_hrtf_database.pd b/examples/04-using_subset_of_hrtf_database.pd new file mode 100644 index 0000000..1bb978c --- /dev/null +++ b/examples/04-using_subset_of_hrtf_database.pd @@ -0,0 +1,8 @@ +#N canvas 436 209 421 196 10; +#X text 103 14 Using subset of HRTF database; +#X text 42 60 When used for research aims \, it may be usefull to consider +only a subset of the available impulse responses. In that aim \, you +just need to make a directory containing the wav files corersponding +to the subset of the impulse responses you want to use \, and give +the path of that directory through the 'listen_db' \, 'cipic_dc' or +'set_hrtf_db_messages'; diff --git a/examples/05-cw_binaural~_creation_arguments.pd b/examples/05-cw_binaural~_creation_arguments.pd new file mode 100644 index 0000000..2ab4bba --- /dev/null +++ b/examples/05-cw_binaural~_creation_arguments.pd @@ -0,0 +1,24 @@ +#N canvas 855 359 391 423 10; +#X text 105 18 cw_binaural~ creation arguments; +#X text 21 50 each instance of the external has 3 creation arguments +with defaults values; +#X text 21 83 1st arg: is the length of the impulse response used for +filtering \, default value is 128; +#X text 22 115 2nd arg: is the filtering method: default value is 'RIFF' +\, which means that the filtering will be done in temporal domain: +this method has a huge computational cost \, but 0 ltency. The other +supported filtering method is 'FFT' \, it lowers the filtering cost +\, implies more latency \, and require to use the external in a block +\, examples will be given later.; +#X text 23 198 3rd arg: if set to 'nodelay' then interpolation is done +directly on the HRIR \, and results in less computations \, but results +in a not so good itd estimation in the interpolated filter. Otherwise +\, we proceed to a minimalphase and pure delay decomposition of the +HRIR. The user may chose the fractional delay algorithm used between +'Hermite4' \, '6points' \, 'linear' \, and 'nofractional'. Default +value for the 3rd arg is 'Hermite4' \, '6points' is also a good method +but more expensive. 'linear' and 'nofractional' should not be used +\, except for didactic purposes.; +#X obj 74 359 cw_binaural~ 128 RIFF Hermite4; +#X text 36 378 instantiation of the external with its defaults creation +arguments; diff --git a/examples/06-FFT_filtering.pd b/examples/06-FFT_filtering.pd new file mode 100644 index 0000000..0bbfde3 --- /dev/null +++ b/examples/06-FFT_filtering.pd @@ -0,0 +1,20 @@ +#N canvas 350 242 427 342 10; +#X text 73 13 doing the filtering in the spectral domain; +#X text 36 49 the filtering is the costliest step of the computations +and can be done in the spectral domain to lower the amound of ressources +neccessary. The patch below show how to use it.; +#X obj 134 238 dac~; +#X obj 154 136 *~ 360; +#X obj 63 116 noise~; +#X obj 148 103 phasor~ 0.1; +#X obj 97 194 fft_binaural 128; +#X obj 232 134 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-262144 -1 -1 21 256; +#X msg 24 286 listen_db /yourpath/listen/IRC_1048_C; +#X connect 3 0 6 2; +#X connect 4 0 6 1; +#X connect 5 0 3 0; +#X connect 6 0 2 0; +#X connect 6 1 2 1; +#X connect 7 0 6 3; +#X connect 8 0 6 0; diff --git a/examples/azimuth.gif b/examples/azimuth.gif new file mode 100644 index 0000000..2117182 Binary files /dev/null and b/examples/azimuth.gif differ diff --git a/examples/coordinates.gif b/examples/coordinates.gif new file mode 100644 index 0000000..7f46de7 Binary files /dev/null and b/examples/coordinates.gif differ diff --git a/examples/elevation.gif b/examples/elevation.gif new file mode 100644 index 0000000..dd07e0a Binary files /dev/null and b/examples/elevation.gif differ diff --git a/examples/fft_binaural.pd b/examples/fft_binaural.pd new file mode 100644 index 0000000..72e22ff --- /dev/null +++ b/examples/fft_binaural.pd @@ -0,0 +1,25 @@ +#N canvas 650 270 640 340 10; +#X obj 166 84 inlet~; +#X obj 221 85 inlet~; +#X obj 278 83 inlet~; +#X obj 153 250 outlet~; +#X obj 255 249 outlet~; +#X obj 416 209 block~; +#X obj 402 105 loadbang; +#X msg 413 170 set \$1 1; +#X obj 406 141 expr \$1 / 2; +#X obj 110 83 inlet; +#X obj 151 135 cw_binaural~ \$1 FFT; +#X text 106 22 FFT filtering should be used such than the block size +is equal to half of the considered impulse response length used. Consequently +\, using abstrations similar to this one allows to use spectral filtering +in cw_binaural~ .; +#X connect 0 0 10 0; +#X connect 1 0 10 1; +#X connect 2 0 10 2; +#X connect 6 0 8 0; +#X connect 7 0 5 0; +#X connect 8 0 7 0; +#X connect 9 0 10 0; +#X connect 10 0 3 0; +#X connect 10 1 4 0; -- cgit v1.2.1