From 39d17173981d57463b801112a880cf2111b91a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Toftg=C3=A5rd?= Date: Fri, 2 Jun 2023 21:49:40 +0200 Subject: [PATCH 1/3] Review of stereo item generation for P800-1 and P800-2 1. Added file designators in with naming convention of input files for P800-1 and P800-2. 2. Updated source file names, including correction for cat2_2 (both P800-1 and P800-2). 3. Fix for audiofile.write by addition of .wav file ending. 4. Outputting to category specific folders (e.g. proc_input/cat1 as expected by processing scripts). 5. Added multiprocessing, by default turned on. 6. Updated impulse responses for P800-2 cat2 to use the available ones. --- item_gen_configs/P800-1.yml | 163 +++++++++-------- item_gen_configs/P800-2.yml | 167 ++++++++++-------- .../generation/process_stereo_items.py | 39 +++- 3 files changed, 214 insertions(+), 155 deletions(-) diff --git a/item_gen_configs/P800-1.yml b/item_gen_configs/P800-1.yml index a597eaef..edaf89f7 100644 --- a/item_gen_configs/P800-1.yml +++ b/item_gen_configs/P800-1.yml @@ -36,6 +36,25 @@ postamble: 1.0 ### Flag for adding low-level random background noise (amplitude +-4) instead of silence; default = false (silence) add_low_level_random_noise: true +### File designators +listening_lab: "a" +language: "JP" +exp: "p01" + +################################################ +### Input files +################################################ + +### s.wav +### +### With +### +### = a (Force Technology), b (HEAD acoustics), +### c (MQ University), d (Mesaqin.com) +### = JP, FR, GE, MA, DA, EN +### = p01, p02, p04, p05, p06, p07, p08, p09 +### = f1, f2, f3, m1, m2, m3 +### = 01, …, 14 ################################################ ### Scene description @@ -64,254 +83,254 @@ add_low_level_random_noise: true scenes: cat1_1: - name: "lp01a1s01" + name: "a1s01" description: "Small anechoic room with AB microphone pickup, partial overlap between the talkers." - source: ["f1_s1.wav", "m1_s1.wav"] + source: ["f1s01.wav", "m1s01.wav"] IR: ["SAABP01.wav", "SAABP07.wav"] overlap: 1.0 cat1_2: - name: "lp01a1s02" + name: "a1s02" description: "Small anechoic room with AB microphone pickup, partial overlap between the talkers." - source: ["m2_s1.wav", "f2_s1.wav"] + source: ["m2s01.wav", "f2s01.wav"] IR: ["SAABP05.wav", "SAABP03.wav"] overlap: 1.0 cat1_3: - name: "lp01a1s03" + name: "a1s03" description: "Small anechoic room with AB microphone pickup, partial overlap between the talkers." - source: ["f3_s1.wav", "m3_s1.wav"] + source: ["f3s01.wav", "m3s01.wav"] IR: ["SAABP02.wav", "SAABP06.wav"] overlap: 1.0 cat1_4: - name: "lp01a1s04" + name: "a1s04" description: "Small anechoic room with AB microphone pickup, partial overlap between the talkers." - source: ["m1_s2.wav", "f1_s2.wav"] + source: ["m1s02.wav", "f1s02.wav"] IR: ["SAABP04.wav", "SAABP01.wav"] overlap: 1.0 cat1_5: - name: "lp01a1s05" + name: "a1s05" description: "Small anechoic room with AB microphone pickup, partial overlap between the talkers." - source: ["f2_s2.wav", "m2_s2.wav"] + source: ["f2s02.wav", "m2s02.wav"] IR: ["SAABP03.wav", "SAABP04.wav"] overlap: 1.0 cat1_6: - name: "lp01a1s06" + name: "a1s06" description: "Small anechoic room with AB microphone pickup, partial overlap between the talkers." - source: ["m3_s2.wav", "f3_s2.wav"] + source: ["m3s02.wav", "f3s02.wav"] IR: ["SAABP07.wav", "SAABP02.wav"] overlap: 1.0 cat2_1: - name: "lp01a2s01" + name: "a2s01" description: "Large anechoic room with AB microphone pickup, no overlap between the talkers." - source: ["m3_s3.wav", "f3_s3.wav"] + source: ["m3s03.wav", "f3s03.wav"] IR: ["LAABP05.wav", "LAABP11.wav"] overlap: -1.0 cat2_2: - name: "lp01a2s02" + name: "a2s02" description: "Large anechoic room with AB microphone pickup, no overlap between the talkers." - source: ["f1_s3.wav", "m1.wav"] + source: ["f1s03.wav", "m1s03.wav"] IR: ["LAABP01.wav", "LAABP06.wav"] overlap: -1.0 cat2_3: - name: "lp01a2s03" + name: "a2s03" description: "Large anechoic room with AB microphone pickup, no overlap between the talkers." - source: ["m2_s3.wav", "f2_s3.wav"] + source: ["m2s03.wav", "f2s03.wav"] IR: ["LAABP03.wav", "LAABP07.wav"] overlap: -1.0 cat2_4: - name: "lp01a2s04" + name: "a2s04" description: "Large anechoic room with AB microphone pickup, no overlap between the talkers." - source: ["f3_s4.wav", "m3_s4.wav"] + source: ["f3s04.wav", "m3s04.wav"] IR: ["LAABP05.wav", "LAABP08.wav"] overlap: -1.0 cat2_5: - name: "lp01a2s05" + name: "a2s05" description: "Large anechoic room with AB microphone pickup, no overlap between the talkers." - source: ["m1_s4.wav", "f1_s4.wav"] + source: ["m1s04.wav", "f1s04.wav"] IR: ["LAABP09.wav", "LAABP07.wav"] overlap: -1.0 cat2_6: - name: "lp01a2s06" + name: "a2s06" description: "Large anechoic room with AB microphone pickup, no overlap between the talkers." - source: ["f2_s4.wav", "m2_s4.wav"] + source: ["f2s04.wav", "m2s04.wav"] IR: ["LAABP10.wav", "LAABP09.wav"] overlap: -1.0 cat3_1: - name: "lp01a3s01" + name: "a3s01" description: "Small anechoic room with MS microphone pickup, no overlap between the talkers." - source: ["f2_s5.wav", "m2_s5.wav"] + source: ["f2s05.wav", "m2s05.wav"] IR: ["SAMSP01.wav", "SAMSP07.wav"] overlap: -1.0 cat3_2: - name: "lp01a3s02" + name: "a3s02" description: "Small anechoic room with MS microphone pickup, no overlap between the talkers." - source: ["m3_s5.wav", "f3_s5.wav"] + source: ["m3s05.wav", "f3s05.wav"] IR: ["SAMSP05.wav", "SAMSP03.wav"] overlap: -1.0 cat3_3: - name: "lp01a3s03" + name: "a3s03" description: "Small anechoic room with MS microphone pickup, no overlap between the talkers." - source: ["f1_s5.wav", "m1_s5.wav"] + source: ["f1s05.wav", "m1s05.wav"] IR: ["SAMSP02.wav", "SAMSP06.wav"] overlap: -1.0 cat3_4: - name: "lp01a3s04" + name: "a3s04" description: "Small anechoic room with MS microphone pickup, no overlap between the talkers." - source: ["m2_s6.wav", "f2_s6.wav"] + source: ["m2s06.wav", "f2s06.wav"] IR: ["SAMSP04.wav", "SAMSP01.wav"] overlap: -1.0 cat3_5: - name: "lp01a3s05" + name: "a3s05" description: "Small anechoic room with MS microphone pickup, no overlap between the talkers." - source: ["f3_s6.wav", "m3_s6.wav"] + source: ["f3s06.wav", "m3s06.wav"] IR: ["SAMSP03.wav", "SAMSP04.wav"] overlap: -1.0 cat3_6: - name: "lp01a3s06" + name: "a3s06" description: "Small anechoic room with MS microphone pickup, no overlap between the talkers." - source: ["m1_s6.wav", "f1_s6.wav"] + source: ["m1s06.wav", "f1s06.wav"] IR: ["SAMSP07.wav", "SAMSP02.wav"] overlap: -1.0 cat4_1: - name: "lp01a4s01" + name: "a4s01" description: "Small echoic room with AB microphone pickup, partial overlap between the talkers." - source: ["m1_s7.wav", "f1_s7.wav"] + source: ["m1s07.wav", "f1s07.wav"] IR: ["SEABP01.wav", "SEABP07.wav"] overlap: 1.0 cat4_2: - name: "lp01a4s02" + name: "a4s02" description: "Small echoic room with AB microphone pickup, partial overlap between the talkers." - source: ["f2_s7.wav", "m2_s7.wav"] + source: ["f2s07.wav", "m2s07.wav"] IR: ["SEABP05.wav", "SEABP03.wav"] overlap: 1.0 cat4_3: - name: "lp01a4s03" + name: "a4s03" description: "Small echoic room with AB microphone pickup, partial overlap between the talkers." - source: ["m3_s7.wav", "f3_s7.wav"] + source: ["m3s07.wav", "f3s07.wav"] IR: ["SEABP02.wav", "SEABP06.wav"] overlap: 1.0 cat4_4: - name: "lp01a4s04" + name: "a4s04" description: "Small echoic room with AB microphone pickup, partial overlap between the talkers." - source: ["f1_s8.wav", "m1_s8.wav"] + source: ["f1s08.wav", "m1s08.wav"] IR: ["SEABP04.wav", "SEABP01.wav"] overlap: 1.0 cat4_5: - name: "lp01a4s05" + name: "a4s05" description: "Small echoic room with AB microphone pickup, partial overlap between the talkers." - source: ["m2_s8.wav", "f2_s8.wav"] + source: ["m2s08.wav", "f2s08.wav"] IR: ["SEABP03.wav", "SEABP04.wav"] overlap: 1.0 cat4_6: - name: "lp01a4s06" + name: "a4s06" description: "Small echoic room with AB microphone pickup, partial overlap between the talkers." - source: ["f3_s8.wav", "m3_s8.wav"] + source: ["f3s08.wav", "m3s08.wav"] IR: ["SEABP07.wav", "SEABP02.wav"] overlap: 1.0 cat5_1: - name: "lp01a5s01" + name: "a5s01" description: "Large echoic room with AB microphone pickup, partial overlap between the talkers." - source: ["f3_s9.wav", "m3_s9.wav"] + source: ["f3s09.wav", "m3s09.wav"] IR: ["LEABP02.wav", "LEABP08.wav"] overlap: 1.0 cat5_2: - name: "lp01a5s02" + name: "a5s02" description: "Large echoic room with AB microphone pickup, partial overlap between the talkers." - source: ["m1_s9.wav", "f1_s9.wav"] + source: ["m1s09.wav", "f1s09.wav"] IR: ["LEABP09.wav", "LEABP04.wav"] overlap: 1.0 cat5_3: - name: "lp01a5s03" + name: "a5s03" description: "Large echoic room with AB microphone pickup, partial overlap between the talkers." - source: ["f2_s9.wav", "m2_s9.wav"] + source: ["f2s09.wav", "m2s09.wav"] IR: ["LEABP06.wav", "LEABP10.wav"] overlap: 1.0 cat5_4: - name: "lp01a5s04" + name: "a5s04" description: "Large echoic room with AB microphone pickup, partial overlap between the talkers." - source: ["m3_s10.wav", "f3_s10.wav"] + source: ["m3s10.wav", "f3s10.wav"] IR: ["LEABP11.wav", "LEABP08.wav"] overlap: 1.0 cat5_5: - name: "lp01a5s05" + name: "a5s05" description: "Large echoic room with AB microphone pickup, partial overlap between the talkers." - source: ["f1_s10.wav", "m1_s10.wav"] + source: ["f1s10.wav", "m1s10.wav"] IR: ["LEABP10.wav", "LEABP12.wav"] overlap: 1.0 cat5_6: - name: "lp01a5s06" + name: "a5s06" description: "Large echoic room with AB microphone pickup, partial overlap between the talkers." - source: ["m2_s10.wav", "f2_s10.wav"] + source: ["m2s10.wav", "f2s10.wav"] IR: ["LEABP12.wav", "LEABP01.wav"] overlap: 1.0 cat6_1: - name: "lp01a6s01" + name: "a6s01" description: "Small echoic room with binaural microphone pickup, no overlap between the talkers." - source: ["m2_s11.wav", "f2_s11.wav"] + source: ["m2s11.wav", "f2s11.wav"] IR: ["SEABP01.wav", "SEABP07.wav"] overlap: -1.0 cat6_2: - name: "lp01a6s02" + name: "a6s02" description: "Small echoic room with binaural microphone pickup, no overlap between the talkers." - source: ["f3_s11.wav", "m3_s11.wav"] + source: ["f3s11.wav", "m3s11.wav"] IR: ["SEABP05.wav", "SEABP03.wav"] overlap: -1.0 cat6_3: - name: "lp01a6s03" + name: "a6s03" description: "Small echoic room with binaural microphone pickup, no overlap between the talkers." - source: ["m1_s11.wav", "f1_s11.wav"] + source: ["m1s11.wav", "f1s11.wav"] IR: ["SEABP02.wav", "SEABP06.wav"] overlap: -1.0 cat6_4: - name: "lp01a6s04" + name: "a6s04" description: "Small echoic room with binaural microphone pickup, no overlap between the talkers." - source: ["f2_s12.wav", "m2_s12.wav"] + source: ["f2s12.wav", "m2s12.wav"] IR: ["SEABP04.wav", "SEABP01.wav"] overlap: -1.0 cat6_5: - name: "lp01a6s05" + name: "a6s05" description: "Small echoic room with binaural microphone pickup, no overlap between the talkers." - source: ["m3_s12.wav", "f3_s12.wav"] + source: ["m3s12.wav", "f3s12.wav"] IR: ["SEABP03.wav", "SEABP04.wav"] overlap: -1.0 cat6_6: - name: "lp01a6s06" + name: "a6s06" description: "Small echoic room with binaural microphone pickup, no overlap between the talkers." - source: ["f1_s12.wav", "m1_s12.wav"] + source: ["f1s12.wav", "m1s12.wav"] IR: ["SEABP07.wav", "SEABP02.wav"] overlap: -1.0 diff --git a/item_gen_configs/P800-2.yml b/item_gen_configs/P800-2.yml index 0df89d95..4add88e9 100644 --- a/item_gen_configs/P800-2.yml +++ b/item_gen_configs/P800-2.yml @@ -36,6 +36,25 @@ postamble: 1.0 ### Flag for adding low-level random background noise (amplitude +-4) instead of silence; default = false (silence) add_low_level_random_noise: true +### File designators +listening_lab: "b" +language: "GE" +exp: "p02" + +################################################ +### Input files +################################################ + +### s.wav +### +### With +### +### = a (Force Technology), b (HEAD acoustics), +### c (MQ University), d (Mesaqin.com) +### = JP, FR, GE, MA, DA, EN +### = p01, p02, p04, p05, p06, p07, p08, p09 +### = f1, f2, f3, m1, m2, m3 +### = 01, …, 14 ################################################ ### Scene description @@ -63,254 +82,254 @@ add_low_level_random_noise: true scenes: cat1_1: - name: "lp02a1s01" + name: "a1s01" description: "Car with AB microphone pickup, no overlap between the talkers, car noise." - source: ["f1_s1.wav", "m1_s1.wav"] + source: ["f1s01.wav", "m1s01.wav"] IR: ["Car_TalkPos5_Stereo_M5_SinSweep_2chn.wav", "Car_TalkPos1_Stereo_M5_SinSweep_2chn.wav"] overlap: -1.0 cat1_2: - name: "lp02a1s02" + name: "a1s02" description: "Car with AB microphone pickup, no overlap between the talkers, car noise." - source: ["m2_s1.wav", "f2_s1.wav"] + source: ["m2s01.wav", "f2s01.wav"] IR: ["Car_TalkPos2_Stereo_M5_SinSweep_2chn.wav", "Car_TalkPos5_Stereo_M5_SinSweep_2chn.wav"] overlap: -1.0 cat1_3: - name: "lp02a1s03" + name: "a1s03" description: "Car with AB microphone pickup, no overlap between the talkers, car noise." - source: ["f3_s1.wav", "m3_s1.wav"] + source: ["f3s01.wav", "m3s01.wav"] IR: ["Car_TalkPos5_Stereo_M5_SinSweep_2chn.wav", "Car_TalkPos3_Stereo_M5_SinSweep_2chn.wav"] overlap: -1.0 cat1_4: - name: "lp02a1s04" + name: "a1s04" description: "Car with AB microphone pickup, no overlap between the talkers, car noise." - source: ["m1_s2.wav", "f1_s2.wav"] + source: ["m1s02.wav", "f1s02.wav"] IR: ["Car_TalkPos4_Stereo_M5_SinSweep_2chn.wav", "Car_TalkPos5_Stereo_M5_SinSweep_2chn.wav"] overlap: -1.0 cat1_5: - name: "lp02a1s05" + name: "a1s05" description: "Car with AB microphone pickup, no overlap between the talkers, car noise." - source: ["f2_s2.wav", "m2_s2.wav"] + source: ["f2s02.wav", "m2s02.wav"] IR: ["Car_TalkPos2_Stereo_M5_SinSweep_2chn.wav", "Car_TalkPos4_Stereo_M5_SinSweep_2chn.wav"] overlap: -1.0 cat1_6: - name: "lp02a1s06" + name: "a1s06" description: "Car with AB microphone pickup, no overlap between the talkers, car noise." - source: ["m3_s2.wav", "f3_s2.wav"] + source: ["m3s02.wav", "f3s02.wav"] IR: ["Car_TalkPos3_Stereo_M5_SinSweep_2chn.wav", "Car_TalkPos2_Stereo_M5_SinSweep_2chn.wav"] overlap: -1.0 cat2_1: - name: "lp02a2s01" + name: "a2s01" description: "Car with AB microphone pickup, no overlap between the talkers, street noise." - source: ["m3_s3.wav", "f3_s3.wav"] - IR: ["", ""] + source: ["m3s03.wav", "f3s03.wav"] + IR: ["FreeField_IR_Python_AB_20cm_Pos1.wav", "FreeField_IR_Python_AB_20cm_Pos4.wav"] overlap: -1.0 cat2_2: - name: "lp02a2s02" + name: "a2s02" description: "Car with AB microphone pickup, no overlap between the talkers, street noise." - source: ["f1_s3.wav", "m1.wav"] + source: ["f1s03.wav", "m1s03.wav"] IR: ["FreeField_IR_Python_AB_20cm_Pos0.wav", "FreeField_IR_Python_AB_20cm_Pos1.wav"] overlap: -1.0 cat2_3: - name: "lp02a2s03" + name: "a2s03" description: "Car with AB microphone pickup, no overlap between the talkers, street noise." - source: ["m2_s3.wav", "f2_s3.wav"] + source: ["m2s03.wav", "f2s03.wav"] IR: ["FreeField_IR_Python_AB_20cm_Pos2.wav", "FreeField_IR_Python_AB_20cm_Pos0.wav"] overlap: -1.0 cat2_4: - name: "lp02a2s04" + name: "a2s04" description: "Car with AB microphone pickup, no overlap between the talkers, street noise." - source: ["f3_s4.wav", "m3_s4.wav"] + source: ["f3s04.wav", "m3s04.wav"] IR: ["FreeField_IR_Python_AB_20cm_Pos1.wav", "FreeField_IR_Python_AB_20cm_Pos3.wav"] overlap: -1.0 cat2_5: - name: "lp02a2s05" + name: "a2s05" description: "Car with AB microphone pickup, no overlap between the talkers, street noise." - source: ["m1_s4.wav", "f1_s4.wav"] + source: ["m1s04.wav", "f1s04.wav"] IR: ["FreeField_IR_Python_AB_20cm_Pos4.wav", "FreeField_IR_Python_AB_20cm_Pos2.wav"] overlap: -1.0 cat2_6: - name: "lp02a2s06" + name: "a2s06" description: "Car with AB microphone pickup, no overlap between the talkers, street noise." - source: ["f2_s4.wav", "m2_s4.wav"] - IR: ["FreeField_IR_Python_AB_20cm_Pos3.wav", "FreeField_IR_Python_AB_20cm_Pos5.wav"] + source: ["f2s04.wav", "m2s04.wav"] + IR: ["FreeField_IR_Python_AB_20cm_Pos3.wav", "FreeField_IR_Python_AB_20cm_Pos0.wav"] overlap: -1.0 cat3_1: - name: "lp02a3s01" + name: "a3s01" description: "Small echoic room with MS microphone pickup, no overlap between the talkers, office noise." - source: ["f2_s5.wav", "m2_s5.wav"] + source: ["f2s05.wav", "m2s05.wav"] IR: ["SEMSP01.wav", "SEMSP07.wav"] overlap: -1.0 cat3_2: - name: "lp02a3s02" + name: "a3s02" description: "Small echoic room with MS microphone pickup, no overlap between the talkers, office noise." - source: ["m3_s5.wav", "f3_s5.wav"] + source: ["m3s05.wav", "f3s05.wav"] IR: ["SEMSP05.wav", "SEMSP03.wav"] overlap: -1.0 cat3_3: - name: "lp02a3s03" + name: "a3s03" description: "Small echoic room with MS microphone pickup, no overlap between the talkers, office noise." - source: ["f1_s5.wav", "m1_s5.wav"] + source: ["f1s05.wav", "m1s05.wav"] IR: ["SEMSP02.wav", "SEMSP06.wav"] overlap: -1.0 cat3_4: - name: "lp02a3s04" + name: "a3s04" description: "Small echoic room with MS microphone pickup, no overlap between the talkers, office noise." - source: ["m2_s6.wav", "f2_s6.wav"] + source: ["m2s06.wav", "f2s06.wav"] IR: ["SEMSP04.wav", "SEMSP01.wav"] overlap: -1.0 cat3_5: - name: "lp02a3s05" + name: "a3s05" description: "Small echoic room with MS microphone pickup, no overlap between the talkers, office noise." - source: ["f3_s6.wav", "m3_s6.wav"] + source: ["f3s06.wav", "m3s06.wav"] IR: ["SEMSP03.wav", "SEMSP04.wav"] overlap: -1.0 cat3_6: - name: "lp02a3s06" + name: "a3s06" description: "Small echoic room with MS microphone pickup, no overlap between the talkers, office noise." - source: ["m1_s6.wav", "f1_s6.wav"] + source: ["m1s06.wav", "f1s06.wav"] IR: ["SEMSP07.wav", "SEMSP02.wav"] overlap: -1.0 cat4_1: - name: "lp02a4s01" + name: "a4s01" description: "Small echoic room with AB microphone pickup, partial overlap between the talkers, office noise." - source: ["m1_s7.wav", "f1_s7.wav"] + source: ["m1s07.wav", "f1s07.wav"] IR: ["SEABP01.wav", "SEABP07.wav"] overlap: -1.0 cat4_2: - name: "lp02a4s02" + name: "a4s02" description: "Small echoic room with AB microphone pickup, partial overlap between the talkers, office noise." - source: ["f2_s7.wav", "m2_s7.wav"] + source: ["f2s07.wav", "m2s07.wav"] IR: ["SEABP05.wav", "SEABP03.wav"] overlap: -1.0 cat4_3: - name: "lp02a4s03" + name: "a4s03" description: "Small echoic room with AB microphone pickup, partial overlap between the talkers, office noise." - source: ["m3_s7.wav", "f3_s7.wav"] + source: ["m3s07.wav", "f3s07.wav"] IR: ["SEABP02.wav", "SEABP06.wav"] overlap: -1.0 cat4_4: - name: "lp02a4s04" + name: "a4s04" description: "Small echoic room with AB microphone pickup, partial overlap between the talkers, office noise." - source: ["f1_s8.wav", "m1_s8.wav"] + source: ["f1s08.wav", "m1s08.wav"] IR: ["SEABP04.wav", "SEABP01.wav"] overlap: -1.0 cat4_5: - name: "lp02a4s05" + name: "a4s05" description: "Small echoic room with AB microphone pickup, partial overlap between the talkers, office noise." - source: ["m2_s8.wav", "f2_s8.wav"] + source: ["m2s08.wav", "f2s08.wav"] IR: ["SEABP03.wav", "SEABP04.wav"] overlap: -1.0 cat4_6: - name: "lp02a4s06" + name: "a4s06" description: "Small echoic room with AB microphone pickup, partial overlap between the talkers, office noise." - source: ["f3_s8.wav", "m3_s8.wav"] + source: ["f3s08.wav", "m3s08.wav"] IR: ["SEABP07.wav", "SEABP02.wav"] overlap: -1.0 cat5_1: - name: "lp02a5s01" + name: "a5s01" description: "Large echoic room with AB microphone pickup, partial overlap between the talkers, office noise." - source: ["f3_s9.wav", "m3_s9.wav"] + source: ["f3s09.wav", "m3s09.wav"] IR: ["LEABP02.wav", "LEABP08.wav"] overlap: -1.0 cat5_2: - name: "lp02a5s02" + name: "a5s02" description: "Large echoic room with AB microphone pickup, partial overlap between the talkers, office noise." - source: ["m1_s9.wav", "f1_s9.wav"] + source: ["m1s09.wav", "f1s09.wav"] IR: ["LEABP09.wav", "LEABP04.wav"] overlap: -1.0 cat5_3: - name: "lp02a5s03" + name: "a5s03" description: "Large echoic room with AB microphone pickup, partial overlap between the talkers, office noise." - source: ["f2_s9.wav", "m2_s9.wav"] + source: ["f2s09.wav", "m2s09.wav"] IR: ["LEABP06.wav", "LEABP10.wav"] overlap: -1.0 cat5_4: - name: "lp02a5s04" + name: "a5s04" description: "Large echoic room with AB microphone pickup, partial overlap between the talkers, office noise." - source: ["m3_s10.wav", "f3_s10.wav"] + source: ["m3s10.wav", "f3s10.wav"] IR: ["LEABP11.wav", "LEABP08.wav"] overlap: -1.0 cat5_5: - name: "lp02a5s05" + name: "a5s05" description: "Large echoic room with AB microphone pickup, partial overlap between the talkers, office noise." - source: ["f1_s10.wav", "m1_s10.wav"] + source: ["f1s10.wav", "m1s10.wav"] IR: ["LEABP10.wav", "LEABP12.wav"] overlap: -1.0 cat5_6: - name: "lp02a5s06" + name: "a5s06" description: "Large echoic room with AB microphone pickup, partial overlap between the talkers, office noise." - source: ["m2_s10.wav", "f2_s10.wav"] + source: ["m2s10.wav", "f2s10.wav"] IR: ["LEABP12.wav", "LEABP01.wav"] overlap: -1.0 cat6_1: - name: "lp02a6s01" + name: "a6s01" description: "Small echoic room with binaural microphone pickup, no overlap between the talkers, office noise." - source: ["m2_s11.wav", "f2_s11.wav"] + source: ["m2s11.wav", "f2s11.wav"] IR: ["SEBIP01.wav", "SEBIP07.wav"] overlap: -1.0 cat6_2: - name: "lp02a6s02" + name: "a6s02" description: "Small echoic room with binaural microphone pickup, no overlap between the talkers, office noise." - source: ["f3_s11.wav", "m3_s11.wav"] + source: ["f3s11.wav", "m3s11.wav"] IR: ["SEBIP05.wav", "SEBIP03.wav"] overlap: -1.0 cat6_3: - name: "lp02a6s03" + name: "a6s03" description: "Small echoic room with binaural microphone pickup, no overlap between the talkers, office noise." - source: ["m1_s11.wav", "f1_s11.wav"] + source: ["m1s11.wav", "f1s11.wav"] IR: ["SEBIP02.wav", "SEBIP06.wav"] overlap: -1.0 cat6_4: - name: "lp02a6s04" + name: "a6s04" description: "Small echoic room with binaural microphone pickup, no overlap between the talkers, office noise." - source: ["f2_s12.wav", "m2_s12.wav"] + source: ["f2s12.wav", "m2s12.wav"] IR: ["SEBIP04.wav", "SEBIP01.wav"] overlap: -1.0 cat6_5: - name: "lp02a6s05" + name: "a6s05" description: "Small echoic room with binaural microphone pickup, no overlap between the talkers, office noise." - source: ["m3_s12.wav", "f3_s12.wav"] + source: ["m3s12.wav", "f3s12.wav"] IR: ["SEBIP03.wav", "SEBIP04.wav"] overlap: -1.0 cat6_6: - name: "lp02a6s06" + name: "a6s06" description: "Small echoic room with binaural microphone pickup, no overlap between the talkers, office noise." - source: ["f1_s12.wav", "m1_s12.wav"] + source: ["f1s12.wav", "m1s12.wav"] IR: ["SEBIP07.wav", "SEBIP02.wav"] overlap: -1.0 \ No newline at end of file diff --git a/ivas_processing_scripts/generation/process_stereo_items.py b/ivas_processing_scripts/generation/process_stereo_items.py index a6a6ddaa..39cb3c7e 100644 --- a/ivas_processing_scripts/generation/process_stereo_items.py +++ b/ivas_processing_scripts/generation/process_stereo_items.py @@ -33,13 +33,14 @@ import logging import os from math import floor - +from itertools import repeat import numpy as np from ivas_processing_scripts.audiotools import audio, audiofile from ivas_processing_scripts.audiotools.wrappers.bs1770 import get_loudness from ivas_processing_scripts.audiotools.wrappers.reverb import reverb_stereo from ivas_processing_scripts.generation import config +from ivas_processing_scripts.utils import apply_func_parallel, list_audio, pairwise SEED_RANDOM_NOISE = 0 @@ -86,10 +87,31 @@ def generate_stereo_items( if "add_low_level_random_noise" not in cfg.__dict__: cfg.add_low_level_random_noise = False - # repeat for all source files - for scene_name, scene in cfg.scenes.items(): + # set multiprocessing + if "multiprocessing" not in cfg.__dict__: + cfg.multiprocessing = True + + apply_func_parallel( + generate_stereo_scene, + zip( + cfg.scenes.keys(), + cfg.scenes.values(), + repeat(cfg), + repeat(logger) + ), + None, + "mp" if cfg.multiprocessing else None, + ) + return + +def generate_stereo_scene( + scene_name: str, + scene: dict, + cfg: config.TestConfig, + logger: logging.Logger +): logger.info( - f"Processing scene: {scene_name} out of {N_scenes} scenes, name: {scene['name']}" + f"Processing scene: {scene_name} out of {len(cfg.scenes)} scenes, name: {scene['name']}" ) # extract the number of audio sources @@ -106,8 +128,9 @@ def generate_stereo_items( y = audio.ChannelBasedAudio("STEREO") for i in range(N_sources): + source_prefix = cfg.listening_lab + cfg.language + cfg.exp # parse parameters from the scene description - source_file = np.atleast_1d(scene["source"])[i] + source_file = source_prefix + np.atleast_1d(scene["source"])[i] IR_file = np.atleast_1d(scene["IR"])[i] logger.info(f"Convolving {source_file} with {source_IR}") @@ -213,9 +236,7 @@ def generate_stereo_items( y.audio += noise # write the reverberated audio into output file - output_filename = scene["name"] + output_filename = cfg.listening_lab + cfg.exp + scene["name"] + ".wav" audiofile.write( - os.path.join(cfg.output_path, output_filename), y.audio, y.fs + os.path.join(cfg.output_path, scene_name.split('_')[0], output_filename), y.audio, y.fs ) # !!!! TBD: replace all os.path.xxx operations with the Path object - - return -- GitLab From ce1d51a87eda5d3b1000013ef67cbe532142b513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Toftg=C3=A5rd?= Date: Mon, 5 Jun 2023 12:49:15 +0200 Subject: [PATCH 2/3] Clean-up and formatting. --- .../generation/process_stereo_items.py | 257 +++++++++--------- 1 file changed, 122 insertions(+), 135 deletions(-) diff --git a/ivas_processing_scripts/generation/process_stereo_items.py b/ivas_processing_scripts/generation/process_stereo_items.py index 39cb3c7e..35ef6bc5 100644 --- a/ivas_processing_scripts/generation/process_stereo_items.py +++ b/ivas_processing_scripts/generation/process_stereo_items.py @@ -32,15 +32,16 @@ import logging import os -from math import floor from itertools import repeat +from math import floor + import numpy as np from ivas_processing_scripts.audiotools import audio, audiofile from ivas_processing_scripts.audiotools.wrappers.bs1770 import get_loudness from ivas_processing_scripts.audiotools.wrappers.reverb import reverb_stereo from ivas_processing_scripts.generation import config -from ivas_processing_scripts.utils import apply_func_parallel, list_audio, pairwise +from ivas_processing_scripts.utils import apply_func_parallel SEED_RANDOM_NOISE = 0 @@ -57,9 +58,6 @@ def generate_stereo_items( ): """Generate STEREO items from mono items based on scene description""" - # get the number of scenes - N_scenes = len(cfg.scenes) - # set the target level if "loudness" not in cfg.__dict__: cfg.loudness = -26 @@ -90,153 +88,142 @@ def generate_stereo_items( # set multiprocessing if "multiprocessing" not in cfg.__dict__: cfg.multiprocessing = True - + apply_func_parallel( generate_stereo_scene, - zip( - cfg.scenes.keys(), - cfg.scenes.values(), - repeat(cfg), - repeat(logger) - ), + zip(cfg.scenes.keys(), cfg.scenes.values(), repeat(cfg), repeat(logger)), None, "mp" if cfg.multiprocessing else None, ) return + def generate_stereo_scene( - scene_name: str, - scene: dict, - cfg: config.TestConfig, - logger: logging.Logger + scene_name: str, scene: dict, cfg: config.TestConfig, logger: logging.Logger ): - logger.info( - f"Processing scene: {scene_name} out of {len(cfg.scenes)} scenes, name: {scene['name']}" - ) + logger.info( + f"Processing scene: {scene_name} out of {len(cfg.scenes)} scenes, name: {scene['name']}" + ) - # extract the number of audio sources - N_sources = len(np.atleast_1d(scene["source"])) + # extract the number of audio sources + N_sources = len(np.atleast_1d(scene["source"])) - # read the IR (check if stereo or two mono files were provided) - source_IR = np.atleast_1d(scene["IR"]) + # read the IR (check if stereo or two mono files were provided) + source_IR = np.atleast_1d(scene["IR"]) - # read the overlap length - if "overlap" in scene.keys(): - source_overlap = float(scene["overlap"]) - else: - source_overlap = 0.0 - - y = audio.ChannelBasedAudio("STEREO") - for i in range(N_sources): - source_prefix = cfg.listening_lab + cfg.language + cfg.exp - # parse parameters from the scene description - source_file = source_prefix + np.atleast_1d(scene["source"])[i] - IR_file = np.atleast_1d(scene["IR"])[i] - - logger.info(f"Convolving {source_file} with {source_IR}") - - # read source file - x = audio.fromfile( - "MONO", os.path.join(cfg.input_path, source_file), fs=cfg.fs - ) - - # read the IR file - IR = audio.fromfile( - "STEREO", os.path.join(cfg.IR_path, IR_file), fs=cfg.IR_fs - ) - - # convolve with stereo IR - x = reverb_stereo(x, IR) - - # adjust the level of the stereo signal - _, scale_factor, _ = get_loudness(x, cfg.loudness, "STEREO") - x.audio *= scale_factor - - # shift the second (and all other) source files (positive shift creates overlap, negative shift creates a gap) - if i > 0 and source_overlap != 0.0: - # get the length of the first source file - N_delay = len(y.audio[:, 0]) - - # add the shift - N_delay += int(-source_overlap * x.fs) - - # insert all-zero preamble - pre = np.zeros((N_delay, x.audio.shape[1])) - x.audio = np.concatenate([pre, x.audio]) - - # pad with zeros to ensure that the signal length is a multiple of 20ms - N_frame = x.fs / 50 - if len(x.audio) % N_frame != 0: - N_pad = int(N_frame - len(x.audio) % N_frame) - - # insert all-zero preamble - pre = np.zeros((N_pad, x.audio.shape[1])) - x.audio = np.concatenate([pre, x.audio]) - - # add source signal to the array of source signals - y.fs = x.fs - if y.audio is None: - y.audio = x.audio - else: - # pad with zeros to have equal length of all source signals - if x.audio.shape[0] > y.audio.shape[0]: - y.audio = np.vstack( - ( - y.audio, - np.zeros( - ( - x.audio.shape[0] - y.audio.shape[0], - y.audio.shape[1], - ) - ), - ) - ) - elif y.audio.shape[0] > x.audio.shape[0]: - x.audio = np.vstack( - ( - x.audio, - np.zeros( - ( - y.audio.shape[0] - x.audio.shape[0], - x.audio.shape[1], - ) - ), - ) - ) + # read the overlap length + if "overlap" in scene.keys(): + source_overlap = float(scene["overlap"]) + else: + source_overlap = 0.0 - # superimpose - y.audio += x.audio + y = audio.ChannelBasedAudio("STEREO") + for i in range(N_sources): + source_prefix = cfg.listening_lab + cfg.language + cfg.exp + # parse parameters from the scene description + source_file = source_prefix + np.atleast_1d(scene["source"])[i] + IR_file = np.atleast_1d(scene["IR"])[i] - # append pre-amble and post-amble to all sources - if cfg.preamble != 0.0: - # ensure that pre-amble is a multiple of 20ms - N_pre = int(floor(cfg.preamble * 50) / 50 * y.fs) + logger.info(f"Convolving {source_file} with {source_IR}") - # insert all-zero preamble to all sources - pre = np.zeros((N_pre, y.audio.shape[1])) - y.audio = np.concatenate([pre, y.audio]) + # read source file + x = audio.fromfile("MONO", os.path.join(cfg.input_path, source_file), fs=cfg.fs) - if cfg.postamble != 0.0: - # ensure that post-mable is a multiple of 20ms - N_post = int(floor(cfg.postamble * 50) / 50 * y.fs) + # read the IR file + IR = audio.fromfile("STEREO", os.path.join(cfg.IR_path, IR_file), fs=cfg.IR_fs) - # append all-zero postamble to all sources - post = np.zeros((N_post, y.audio.shape[1])) - y.audio = np.concatenate([y.audio, post]) + # convolve with stereo IR + x = reverb_stereo(x, IR) - # add random noise - if cfg.add_low_level_random_noise: - # create uniformly distributed noise between -4 and 4 - np.random.seed(SEED_RANDOM_NOISE) - noise = np.random.randint(low=-4, high=5, size=y.audio.shape).astype( - "float" - ) + # adjust the level of the stereo signal + _, scale_factor, _ = get_loudness(x, cfg.loudness, "STEREO") + x.audio *= scale_factor - # superimpose - y.audio += noise + # shift the second (and all other) source files (positive shift creates overlap, negative shift creates a gap) + if i > 0 and source_overlap != 0.0: + # get the length of the first source file + N_delay = len(y.audio[:, 0]) + + # add the shift + N_delay += int(-source_overlap * x.fs) + + # insert all-zero preamble + pre = np.zeros((N_delay, x.audio.shape[1])) + x.audio = np.concatenate([pre, x.audio]) + + # pad with zeros to ensure that the signal length is a multiple of 20ms + N_frame = x.fs / 50 + if len(x.audio) % N_frame != 0: + N_pad = int(N_frame - len(x.audio) % N_frame) + + # insert all-zero preamble + pre = np.zeros((N_pad, x.audio.shape[1])) + x.audio = np.concatenate([pre, x.audio]) - # write the reverberated audio into output file - output_filename = cfg.listening_lab + cfg.exp + scene["name"] + ".wav" - audiofile.write( - os.path.join(cfg.output_path, scene_name.split('_')[0], output_filename), y.audio, y.fs - ) # !!!! TBD: replace all os.path.xxx operations with the Path object + # add source signal to the array of source signals + y.fs = x.fs + if y.audio is None: + y.audio = x.audio + else: + # pad with zeros to have equal length of all source signals + if x.audio.shape[0] > y.audio.shape[0]: + y.audio = np.vstack( + ( + y.audio, + np.zeros( + ( + x.audio.shape[0] - y.audio.shape[0], + y.audio.shape[1], + ) + ), + ) + ) + elif y.audio.shape[0] > x.audio.shape[0]: + x.audio = np.vstack( + ( + x.audio, + np.zeros( + ( + y.audio.shape[0] - x.audio.shape[0], + x.audio.shape[1], + ) + ), + ) + ) + + # superimpose + y.audio += x.audio + + # append pre-amble and post-amble to all sources + if cfg.preamble != 0.0: + # ensure that pre-amble is a multiple of 20ms + N_pre = int(floor(cfg.preamble * 50) / 50 * y.fs) + + # insert all-zero preamble to all sources + pre = np.zeros((N_pre, y.audio.shape[1])) + y.audio = np.concatenate([pre, y.audio]) + + if cfg.postamble != 0.0: + # ensure that post-mable is a multiple of 20ms + N_post = int(floor(cfg.postamble * 50) / 50 * y.fs) + + # append all-zero postamble to all sources + post = np.zeros((N_post, y.audio.shape[1])) + y.audio = np.concatenate([y.audio, post]) + + # add random noise + if cfg.add_low_level_random_noise: + # create uniformly distributed noise between -4 and 4 + np.random.seed(SEED_RANDOM_NOISE) + noise = np.random.randint(low=-4, high=5, size=y.audio.shape).astype("float") + + # superimpose + y.audio += noise + + # write the reverberated audio into output file + output_filename = cfg.listening_lab + cfg.exp + scene["name"] + ".wav" + audiofile.write( + os.path.join(cfg.output_path, scene_name.split("_")[0], output_filename), + y.audio, + y.fs, + ) # !!!! TBD: replace all os.path.xxx operations with the Path object -- GitLab From 8cfdaa57cd7abbbb8905d69a06339519e8783561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Toftg=C3=A5rd?= Date: Mon, 5 Jun 2023 14:57:54 +0200 Subject: [PATCH 3/3] Correction of preamble for P800-1 and P800-2. Moved 20 ms block alignment after addition of source signals, to ensure the overlap period is maintained as specified. --- item_gen_configs/P800-1.yml | 2 +- item_gen_configs/P800-2.yml | 2 +- .../generation/process_stereo_items.py | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/item_gen_configs/P800-1.yml b/item_gen_configs/P800-1.yml index edaf89f7..eeec0787 100644 --- a/item_gen_configs/P800-1.yml +++ b/item_gen_configs/P800-1.yml @@ -30,7 +30,7 @@ output_path: "experiments/selection/P800-1/proc_input" loudness: -26 ### Pre-amble and Post-amble length in seconds (default = 0.0) -preamble: 1.0 +preamble: 0.5 postamble: 1.0 ### Flag for adding low-level random background noise (amplitude +-4) instead of silence; default = false (silence) diff --git a/item_gen_configs/P800-2.yml b/item_gen_configs/P800-2.yml index 4add88e9..1f566421 100644 --- a/item_gen_configs/P800-2.yml +++ b/item_gen_configs/P800-2.yml @@ -30,7 +30,7 @@ output_path: "experiments/selection/P800-2/proc_input" loudness: -26 ### Pre-amble and Post-amble length in seconds (default = 0.0) -preamble: 1.0 +preamble: 0.5 postamble: 1.0 ### Flag for adding low-level random background noise (amplitude +-4) instead of silence; default = false (silence) diff --git a/ivas_processing_scripts/generation/process_stereo_items.py b/ivas_processing_scripts/generation/process_stereo_items.py index 35ef6bc5..7ddfecac 100644 --- a/ivas_processing_scripts/generation/process_stereo_items.py +++ b/ivas_processing_scripts/generation/process_stereo_items.py @@ -151,15 +151,6 @@ def generate_stereo_scene( pre = np.zeros((N_delay, x.audio.shape[1])) x.audio = np.concatenate([pre, x.audio]) - # pad with zeros to ensure that the signal length is a multiple of 20ms - N_frame = x.fs / 50 - if len(x.audio) % N_frame != 0: - N_pad = int(N_frame - len(x.audio) % N_frame) - - # insert all-zero preamble - pre = np.zeros((N_pad, x.audio.shape[1])) - x.audio = np.concatenate([pre, x.audio]) - # add source signal to the array of source signals y.fs = x.fs if y.audio is None: @@ -211,6 +202,15 @@ def generate_stereo_scene( post = np.zeros((N_post, y.audio.shape[1])) y.audio = np.concatenate([y.audio, post]) + # pad with zeros to ensure that the signal length is a multiple of 20ms + N_frame = y.fs / 50 + if y.audio.shape[0] % N_frame != 0: + N_pad = int(N_frame - y.audio.shape[0] % N_frame) + + # insert all-zero postamble + post = np.zeros((N_pad, y.audio.shape[1])) + y.audio = np.concatenate([y.audio, post]) + # add random noise if cfg.add_low_level_random_noise: # create uniformly distributed noise between -4 and 4 -- GitLab