From: FrancoisGrondin Date: Wed, 23 May 2018 20:06:07 +0000 (-0400) Subject: Renamed odascore as odaslive X-Git-Url: http://kyz.pub/gitweb/?a=commitdiff_plain;h=cd6658e3983b2bc5f5db30b64d6af49988383259;p=yn%2Fyn-odas.git Renamed odascore as odaslive --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 1050eb3..9a2ac3c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,15 +197,15 @@ target_link_libraries(odas pthread ) -add_executable(odascore - demo/odascore/main.c - demo/odascore/configs.c - demo/odascore/objects.c - demo/odascore/parameters.c - demo/odascore/profiler.c - demo/odascore/threads.c +add_executable(odaslive + demo/odaslive/main.c + demo/odaslive/configs.c + demo/odaslive/objects.c + demo/odaslive/parameters.c + demo/odaslive/profiler.c + demo/odaslive/threads.c ) -target_link_libraries(odascore +target_link_libraries(odaslive odas ) diff --git a/config/odascore/azimut_cma.cfg b/config/odascore/azimut_cma.cfg deleted file mode 100644 index 1ac9971..0000000 --- a/config/odascore/azimut_cma.cfg +++ /dev/null @@ -1,449 +0,0 @@ -# Configuration file for ReSpeaker circular sound card - -version = "2.1"; - -# Raw - -raw: -{ - - fS = 16000; - hopSize = 128; - nBits = 16; - nChannels = 16; - - # Input with raw signal from microphones - interface: { - type = "file"; - path = "input_cma.raw"; - } - -} - -# Mapping - -mapping: -{ - - map: (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); - -} - -# General - -general: -{ - - epsilon = 1E-20; - - size: - { - hopSize = 128; - frameSize = 256; - }; - - samplerate: - { - mu = 16000; - sigma2 = 0.01; - }; - - speedofsound: - { - mu = 343.0; - sigma2 = 25.0; - }; - - mics = ( - - # Microphone 1 - { - mu = ( +0.1250, -0.0725, +0.0725 ); - sigma2 = ( 0.0, 0.0, 0.0, 0.0, +1E-6, 0.0, 0.0, 0.0, +1E-6 ); - direction = ( +1.000, +0.000, +0.000 ); - #angle = ( 80.0, 100.0 ); - angle = ( 180.0, 180.0 ); - }, - - # Microphone 2 - { - mu = ( +0.1250, +0.0725, +0.0725 ); - sigma2 = ( 0.0, 0.0, 0.0, 0.0, +1E-6, 0.0, 0.0, 0.0, +1E-6 ); - direction = ( +1.000, +0.000, +0.000 ); - #angle = ( 80.0, 100.0 ); - angle = ( 180.0, 180.0 ); - - }, - - # Microphone 3 - { - mu = ( +0.1250, -0.0725, -0.0725 ); - sigma2 = ( 0.0, 0.0, 0.0, 0.0, +1E-6, 0.0, 0.0, 0.0, +1E-6 ); - direction = ( +1.000, +0.000, +0.000 ); - #angle = ( 80.0, 100.0 ); - angle = ( 180.0, 180.0 ); - - }, - - # Microphone 4 - { - mu = ( +0.1250, +0.0725, -0.0725 ); - sigma2 = ( 0.0, 0.0, 0.0, 0.0, +1E-6, 0.0, 0.0, 0.0, +1E-6 ); - direction = ( +1.000, +0.000, +0.000 ); - #angle = ( 80.0, 100.0 ); - angle = ( 180.0, 180.0 ); - - }, - - # Microphone 5 - { - mu = ( +0.0725, +0.1250, +0.0725 ); - sigma2 = ( +1E-6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, +1E-6 ); - direction = ( +0.000, +1.000, +0.000 ); - #angle = ( 80.0, 100.0 ); - angle = ( 180.0, 180.0 ); - - }, - - # Microphone 6 - { - mu = ( -0.0725, +0.1250, +0.0725 ); - sigma2 = ( +1E-6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, +1E-6 ); - direction = ( +0.000, +1.000, +0.000 ); - #angle = ( 80.0, 100.0 ); - angle = ( 180.0, 180.0 ); - - }, - - # Microphone 7 - { - mu = ( +0.0725, +0.1250, -0.0725 ); - sigma2 = ( +1E-6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, +1E-6 ); - direction = ( +0.000, +1.000, +0.000 ); - #angle = ( 80.0, 100.0 ); - angle = ( 180.0, 180.0 ); - - }, - - # Microphone 8 - { - mu = ( -0.0725, +0.1250, -0.0725 ); - sigma2 = ( +1E-6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, +1E-6 ); - direction = ( +0.000, +1.000, +0.000 ); - #angle = ( 80.0, 100.0 ); - angle = ( 180.0, 180.0 ); - - }, - - # Microphone 9 - { - mu = ( -0.1250, +0.0725, +0.0725 ); - sigma2 = ( 0.0, 0.0, 0.0, 0.0, +1E-6, 0.0, 0.0, 0.0, +1E-6 ); - direction = ( -1.000, +0.000, +0.000 ); - #angle = ( 80.0, 100.0 ); - angle = ( 180.0, 180.0 ); - - }, - - # Microphone 10 - { - mu = ( -0.1250, -0.0725, +0.0725 ); - sigma2 = ( 0.0, 0.0, 0.0, 0.0, +1E-6, 0.0, 0.0, 0.0, +1E-6 ); - direction = ( -1.000, +0.000, +0.000 ); - #angle = ( 80.0, 100.0 ); - angle = ( 180.0, 180.0 ); - - }, - - # Microphone 11 - { - mu = ( -0.1250, +0.0725, -0.0725 ); - sigma2 = ( 0.0, 0.0, 0.0, 0.0, +1E-6, 0.0, 0.0, 0.0, +1E-6 ); - direction = ( -1.000, +0.000, +0.000 ); - #angle = ( 80.0, 100.0 ); - angle = ( 180.0, 180.0 ); - - }, - - # Microphone 12 - { - mu = ( -0.1250, -0.0725, -0.0725 ); - sigma2 = ( 0.0, 0.0, 0.0, 0.0, +1E-6, 0.0, 0.0, 0.0, +1E-6 ); - direction = ( -1.000, +0.000, +0.000 ); - #angle = ( 80.0, 100.0 ); - angle = ( 180.0, 180.0 ); - - }, - - # Microphone 13 - { - mu = ( -0.0725, -0.1250, +0.0725 ); - sigma2 = ( +1E-6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, +1E-6 ); - direction = ( +0.000, -1.000, +0.000 ); - #angle = ( 80.0, 100.0 ); - angle = ( 180.0, 180.0 ); - - }, - - # Microphone 14 - { - mu = ( +0.0725, -0.1250, +0.0725 ); - sigma2 = ( +1E-6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, +1E-6 ); - direction = ( +0.000, -1.000, +0.000 ); - #angle = ( 80.0, 100.0 ); - angle = ( 180.0, 180.0 ); - - }, - - # Microphone 15 - { - mu = ( -0.0725, -0.1250, -0.0725 ); - sigma2 = ( +1E-6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, +1E-6 ); - direction = ( +0.000, -1.000, +0.000 ); - #angle = ( 80.0, 100.0 ); - angle = ( 180.0, 180.0 ); - - }, - - # Microphone 16 - { - mu = ( +0.0725, -0.1250, -0.0725 ); - sigma2 = ( +1E-6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, +1E-6 ); - direction = ( +0.000, -1.000, +0.000 ); - #angle = ( 80.0, 100.0 ); - angle = ( 180.0, 180.0 ); - - } - - ); - - # Spatial filter to include only a range of direction if required - # (may be useful to remove false detections from the floor) - spatialfilters = ( - - { - - direction = ( +0.000, +0.000, +1.000 ); - angle = (80.0, 90.0); - - } - - ); - - nThetas = 181; - gainMin = 0.25; - -}; - -# Stationnary noise estimation - -sne: -{ - - b = 3; - alphaS = 0.1; - L = 150; - delta = 3.0; - alphaD = 0.1; - -} - -# Sound Source Localization - -ssl: -{ - - nPots = 4; - nMatches = 10; - probMin = 0.3; - nRefinedLevels = 1; - interpRate = 1; - - # Number of scans: level is the resolution of the sphere - # and delta is the size of the maximum sliding window - # (delta = -1 means the size is automatically computed) - scans = ( - { level = 2; delta = -1; }, - { level = 4; delta = -1; } - ); - - # Output to export potential sources - potential: { - - format = "undefined"; - - interface: { - type = "blackhole"; - }; - - }; - -}; - -# Sound Source Tracking - -sst: -{ - - # Mode is either "kalman" or "particle" - - mode = "kalman"; - - # Add is either "static" or "dynamic" - - add = "dynamic"; - - # Parameters used by both the Kalman and particle filter - - active = ( - { weight = 1.0; mu = 0.15; sigma2 = 0.0025 } - ); - - inactive = ( - { weight = 1.0; mu = 0.05; sigma2 = 0.0025 } - ); - - sigmaR2_prob = 0.0025; - sigmaR2_active = 0.0225; - sigmaR2_target = 0.0025; - Pfalse = 0.1; - Pnew = 0.1; - Ptrack = 0.8; - - theta_new = 0.9; - N_prob = 5; - theta_prob = 0.8; - N_inactive = ( 150, 200, 250, 250 ); - theta_inactive = 0.9; - - # Parameters used by the Kalman filter only - - kalman: { - - sigmaQ = 0.001; - - }; - - # Parameters used by the particle filter only - - particle: { - - nParticles = 1000; - st_alpha = 2.0; - st_beta = 0.04; - st_ratio = 0.5; - ve_alpha = 0.05; - ve_beta = 0.2; - ve_ratio = 0.3; - ac_alpha = 0.5; - ac_beta = 0.2; - ac_ratio = 0.2; - Nmin = 0.7; - - }; - - target: (); - - # Output to export tracked sources - tracked: { - - format = "undefined"; - - interface: { - type = "blackhole"; - }; - - }; - -} - -sss: -{ - - # Mode is either "dds", "dgss" or "dmvdr" - - mode_sep = "dgss"; - mode_pf = "ms"; - - dds: { - - }; - - dgss: { - - mu = 0.0001; - lambda = 0.5; - - }; - - dmvdr: { - - }; - - ms: { - - alphaPmin = 0.07; - eta = 0.5; - alphaZ = 0.8; - thetaWin = 0.3; - alphaWin = 0.3; - maxAbsenceProb = 0.9; - Gmin = 0.01; - winSizeLocal = 3; - winSizeGlobal = 23; - winSizeFrame = 256; - - }; - - separated: { - - fS = 44100; - hopSize = 512; - nBits = 16; - - interface: { - type = "file"; - path = "separated_cma2.raw"; - } - - }; - - postfiltered: { - - fS = 44100; - hopSize = 512; - nBits = 16; - - interface: { - type = "file"; - path = "postfiltered_cma2.raw"; - } - - }; - -} - -classify: -{ - - frameSize = 1024; - winSize = 3; - tauMin = 32; - tauMax = 200; - deltaTauMax = 7; - alpha = 0.3; - gamma = 0.05; - phiMin = 0.15; - r0 = 0.2; - - category: { - - format = "undefined"; - - interface: { - type = "blackhole"; - } - - } - -} diff --git a/config/odascore/azimut_oma.cfg b/config/odascore/azimut_oma.cfg deleted file mode 100644 index 7044c9c..0000000 --- a/config/odascore/azimut_oma.cfg +++ /dev/null @@ -1,408 +0,0 @@ -# Configuration file for ReSpeaker circular sound card - -version = "2.1"; - -# Raw - -raw: -{ - - fS = 16000; - hopSize = 128; - nBits = 16; - nChannels = 16; - - # Input with raw signal from microphones - interface: { - type = "file"; - path = "input_oma.raw"; - } - -} - -# Mapping - -mapping: -{ - - map: (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); - -} - -# General - -general: -{ - - epsilon = 1E-20; - - size: - { - hopSize = 128; - frameSize = 256; - }; - - samplerate: - { - mu = 16000; - sigma2 = 0.01; - }; - - speedofsound: - { - mu = 343.0; - sigma2 = 25.0; - }; - - mics = ( - - # Microphone 1 - { - mu = ( 0.09000, 0.00000, 0.00000 ); - sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); - direction = ( 0.00000, 0.00000, 1.00000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 2 - { - mu = ( 0.11550, -0.04780, 0.00000 ); - sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); - direction = ( 0.00000, 0.00000, 1.00000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 3 - { - mu = ( 0.03540, 0.03540, 0.00000 ); - sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); - direction = ( 0.00000, 0.00000, 1.00000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 4 - { - mu = ( 0.11550, 0.04780, 0.00000 ); - sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); - direction = ( 0.00000, 0.00000, 1.00000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 5 - { - mu = ( 0.03540, -0.03540, 0.00000 ); - sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); - direction = ( 0.00000, 0.00000, 1.00000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 6 - { - mu = ( 0.04780, -0.11550, 0.00000 ); - sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); - direction = ( 0.00000, 0.00000, 1.00000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 7 - { - mu = ( -0.00000, -0.09000, 0.00000 ); - sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); - direction = ( 0.00000, 0.00000, 1.00000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 8 - { - mu = ( -0.04780, -0.11550, 0.00000 ); - sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); - direction = ( 0.00000, 0.00000, 1.00000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 9 - { - mu = ( -0.09000, 0.00000, 0.00000 ); - sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); - direction = ( 0.00000, 0.00000, 1.00000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 10 - { - mu = ( -0.11550, 0.04780, 0.00000 ); - sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); - direction = ( 0.00000, 0.00000, 1.00000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 11 - { - mu = ( -0.03540, -0.03540, 0.00000 ); - sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); - direction = ( 0.00000, 0.00000, 1.00000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 12 - { - mu = ( -0.11550, -0.04780, 0.00000 ); - sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); - direction = ( 0.00000, 0.00000, 1.00000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 13 - { - mu = ( -0.03540, 0.03540, 0.00000 ); - sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); - direction = ( 0.00000, 0.00000, 1.00000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 14 - { - mu = ( -0.04780, 0.11550, 0.00000 ); - sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); - direction = ( 0.00000, 0.00000, 1.00000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 15 - { - mu = ( 0.00000, 0.09000, 0.00000 ); - sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); - direction = ( 0.00000, 0.00000, 1.00000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 16 - { - mu = ( 0.04780, 0.11550, 0.00000 ); - sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); - direction = ( 0.00000, 0.00000, 1.00000 ); - angle = ( 80.0, 100.0 ); - } - - ); - - # Spatial filter to include only a range of direction if required - # (may be useful to remove false detections from the floor) - spatialfilters = ( - - { - - direction = ( +0.000, +0.000, +1.000 ); - angle = (80.0, 90.0); - - } - - ); - - nThetas = 181; - gainMin = 0.25; - -}; - -# Stationnary noise estimation - -sne: -{ - - b = 3; - alphaS = 0.1; - L = 150; - delta = 3.0; - alphaD = 0.1; - -} - -# Sound Source Localization - -ssl: -{ - - nPots = 4; - nMatches = 10; - probMin = 0.3; - nRefinedLevels = 1; - interpRate = 1; - - # Number of scans: level is the resolution of the sphere - # and delta is the size of the maximum sliding window - # (delta = -1 means the size is automatically computed) - scans = ( - { level = 2; delta = -1; }, - { level = 4; delta = -1; } - ); - - # Output to export potential sources - potential: { - - format = "undefined"; - - interface: { - type = "blackhole"; - }; - - }; - -}; - -# Sound Source Tracking - -sst: -{ - - # Mode is either "kalman" or "particle" - - mode = "kalman"; - - # Parameters used by both the Kalman and particle filter - - active = ( - { weight = 1.0; mu = 0.3; sigma2 = 0.0025 } - ); - - inactive = ( - { weight = 1.0; mu = 0.15; sigma2 = 0.0025 } - ); - - sigmaR2_prob = 0.0025; - sigmaR2_active = 0.0225; - Pfalse = 0.1; - Pnew = 0.1; - Ptrack = 0.8; - - theta_new = 0.9; - N_prob = 5; - theta_prob = 0.8; - N_inactive = ( 150, 200, 250, 250 ); - theta_inactive = 0.9; - - # Parameters used by the Kalman filter only - - kalman: { - - sigmaQ = 0.001; - - }; - - # Parameters used by the particle filter only - - particle: { - - nParticles = 1000; - st_alpha = 2.0; - st_beta = 0.04; - st_ratio = 0.5; - ve_alpha = 0.05; - ve_beta = 0.2; - ve_ratio = 0.3; - ac_alpha = 0.5; - ac_beta = 0.2; - ac_ratio = 0.2; - Nmin = 0.7; - - }; - - # Output to export tracked sources - tracked: { - - format = "undefined"; - - interface: { - type = "blackhole"; - }; - - }; - -} - -sss: -{ - - # Mode is either "dds", "dgss" or "dmvdr" - - mode_sep = "dds"; - mode_pf = "ms"; - - dds: { - - }; - - dgss: { - - }; - - dmvdr: { - - }; - - ms: { - - alphaPmin = 0.07; - eta = 0.5; - alphaZ = 0.8; - thetaWin = 0.3; - alphaWin = 0.3; - maxAbsenceProb = 0.9; - Gmin = 0.01; - winSizeLocal = 3; - winSizeGlobal = 23; - winSizeFrame = 256; - - }; - - separated: { - - fS = 44100; - hopSize = 512; - nBits = 16; - - interface: { - type = "file"; - path = "separated_oma.raw"; - } - - }; - - postfiltered: { - - fS = 44100; - hopSize = 512; - nBits = 16; - - interface: { - type = "file"; - path = "postfiltered_oma.raw"; - } - - }; - -} - -classify: -{ - - frameSize = 1024; - winSize = 3; - tauMin = 32; - tauMax = 200; - deltaTauMax = 7; - alpha = 0.3; - gamma = 0.05; - phiMin = 0.15; - r0 = 0.2; - - category: { - - format = "undefined"; - - interface: { - type = "blackhole"; - } - - } - -} diff --git a/config/odascore/beam.cfg b/config/odascore/beam.cfg deleted file mode 100644 index af93715..0000000 --- a/config/odascore/beam.cfg +++ /dev/null @@ -1,360 +0,0 @@ -# Configuration file for XMOS circular sound card - -version = "2.1"; - -# Raw - -raw: -{ - - fS = 44100; - hopSize = 512; - nBits = 16; - nChannels = 8; - - # Input from 8SoundsUSB - interface: { - type = "file"; - path = "micsBeam.raw"; - } - -} - -# Mapping - -mapping: -{ - - map: (1, 2, 3, 4, 5, 6, 7, 8); - -} - -# General - -general: -{ - - epsilon = 1E-20; - - size: - { - hopSize = 512; - frameSize = 1024; - }; - - samplerate: - { - mu = 44100; - sigma2 = 0.01; - }; - - speedofsound: - { - mu = 343.0; - sigma2 = 25.0; - }; - - mics = ( - - # Microphone 1 - { - mu = ( +0.085, +0.000, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 2 - { - mu = ( +0.062, -0.062, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 3 - { - mu = ( +0.000, -0.085, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 4 - { - mu = ( -0.062, -0.062, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 5 - { - mu = ( -0.085, +0.000, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 6 - { - mu = ( -0.062, +0.062, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 7 - { - mu = ( +0.000, +0.085, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 8 - { - mu = ( +0.062, +0.062, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - } - - ); - - # Spatial filters to include only a range of direction if required - # (may be useful to remove false detections from the floor, or - # limit the space search to a restricted region) - spatialfilters = ( - - { - - direction = ( +0.000, +0.000, +1.000 ); - angle = (80.0, 90.0); - - } - - ); - - nThetas = 181; - gainMin = 0.25; - -}; - -# Stationnary noise estimation - -sne: -{ - - b = 3; - alphaS = 0.1; - L = 150; - delta = 3.0; - alphaD = 0.1; - -} - -# Sound Source Localization - -ssl: -{ - - nPots = 4; - nMatches = 10; - probMin = 0.5; - nRefinedLevels = 1; - interpRate = 1; - - # Number of scans: level is the resolution of the sphere - # and delta is the size of the maximum sliding window - # (delta = -1 means the size is automatically computed) - scans = ( - { level = 2; delta = -1; }, - { level = 4; delta = -1; } - ); - - # Output to export potential sources - potential: { - - format = "undefined"; - - interface: { - type = "blackhole"; - }; - - }; - -}; - -# Target sources - -# Sound Source Tracking - -sst: -{ - - # Mode is either "kalman" or "particle" - - mode = "kalman"; - - # Add is either "static" or "dynamic" - - add = "dynamic"; - - # Parameters used by both the Kalman and particle filter - - active = ( - { weight = 1.0; mu = 0.25; sigma2 = 0.0020 } - ); - - inactive = ( - { weight = 1.0; mu = 0.05; sigma2 = 0.0020 } - ); - - sigmaR2_prob = 0.0025; - sigmaR2_active = 0.0225; - sigmaR2_target = 0.0025; - Pfalse = 0.1; - Pnew = 0.1; - Ptrack = 0.8; - - theta_new = 0.9; - N_prob = 5; - theta_prob = 0.8; - N_inactive = ( 150, 200, 250, 250 ); - theta_inactive = 0.9; - - # Parameters used by the Kalman filter only - - kalman: { - - sigmaQ = 0.001; - - }; - - # Parameters used by the particle filter only - - particle: { - - nParticles = 1000; - st_alpha = 2.0; - st_beta = 0.04; - st_ratio = 0.5; - ve_alpha = 0.05; - ve_beta = 0.2; - ve_ratio = 0.3; - ac_alpha = 0.5; - ac_beta = 0.2; - ac_ratio = 0.2; - Nmin = 0.7; - - }; - - target: - ( - { tag = "fan"; x = 0.0; y = 0.0; z = 1.0 } - ); - - # Output to export tracked sources - tracked: { - - format = "json"; - - interface: { - type = "terminal"; - }; - - }; - -} - -sss: -{ - - # Mode is either "dds", "dgss" or "dmvdr" - - mode_sep = "dds"; - mode_pf = "ms"; - - dds: { - - }; - - dgss: { - - mu = 0.01; - lambda = 0.5; - - }; - - dmvdr: { - - }; - - ms: { - - alphaPmin = 0.07; - eta = 0.3; - alphaZ = 0.8; - thetaWin = 0.3; - alphaWin = 0.3; - maxAbsenceProb = 0.9; - Gmin = 0.01; - winSizeLocal = 3; - winSizeGlobal = 33; - winSizeFrame = 1024; - - }; - - separated: { - - fS = 44100; - hopSize = 512; - nBits = 16; - - interface: { - type = "file"; - path = "separated.raw"; - } - - }; - - postfiltered: { - - fS = 44100; - hopSize = 512; - nBits = 16; - - interface: { - type = "file"; - path = "postfiltered.raw"; - } - - }; - -} - -classify: -{ - - frameSize = 4096; - winSize = 3; - tauMin = 88; - tauMax = 551; - deltaTauMax = 20; - alpha = 0.3; - gamma = 0.05; - phiMin = 0.5; - r0 = 0.2; - - category: { - - format = "undefined"; - - interface: { - type = "blackhole"; - } - - } - -} diff --git a/config/odascore/delta1010lt.cfg b/config/odascore/delta1010lt.cfg deleted file mode 100644 index 2886eaf..0000000 --- a/config/odascore/delta1010lt.cfg +++ /dev/null @@ -1,417 +0,0 @@ -# Configuration file for M-Audio Delta 1010LT PCI card - -version = "2.1"; - -/* -The M-Audio Delta 1010LT PCI card is an 8-input card that shows up as a single device with a single input channel. -In order to have each of the channels available for use in ODAS, you can create a virtual device with each of the -Delta 1010LT mono inputs as a separate channel, and then use that virtual device for input. This can be done by -putting a configuration such as the following in your ~/.asoundrc or /etc/asound.conf file: - -******************************************************************************************** -# .asoundrc for a Delta 1010LT to have individual record channels -# -# Create virtual devices -# JACK will need MMAP_COMPLEX support to use this. -# ICE1712 chip has 12 capture channels and 10 playback channels. -# No. of channels in slaves must equal 12 for capture and 10 for playback -# otherwise "invalid argument" errors result. - -pcm.multi_capture { - type multi - slaves.a.pcm hw:0 - slaves.a.channels 12 - -# First 8 channels of first soundcard (capture) - bindings.0.slave a - bindings.0.channel 0 - bindings.1.slave a - bindings.1.channel 1 - bindings.2.slave a - bindings.2.channel 2 - bindings.3.slave a - bindings.3.channel 3 - bindings.4.slave a - bindings.4.channel 4 - bindings.5.slave a - bindings.5.channel 5 - bindings.6.slave a - bindings.6.channel 6 - bindings.7.slave a - bindings.7.channel 7 - -} - -ctl.multi_capture { - type hw - card 0 -} -******************************************************************************************** - -This configuration presumes that your card is showing up as hardware device 0. If it is not you will need to adjust the -"hw:0" and "card 0" configuration. Once that configuration is in place, you should be able to use the settings below for -ODAS. - -*/ - -# Raw - -raw: -{ - - fS = 44100; - hopSize = 128; - nBits = 32; - nChannels = 8; - - # Input with raw signal from microphones - interface: { - type = "soundcard_name"; - devicename = "multi_capture"; - } - -} - -# Mapping - -mapping: -{ - - map: (1, 2, 3, 4, 5, 6, 7, 8); - -} - -# General - -general: -{ - - epsilon = 1E-20; - - size: - { - hopSize = 128; - frameSize = 256; - }; - - samplerate: - { - mu = 44100; - sigma2 = 0.01; - }; - - speedofsound: - { - mu = 343.0; - sigma2 = 25.0; - }; - - mics = ( - - # Microphone 1 - { - mu = ( +0.0000, +0.0000, +0.0000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 90.0 ); - }, - - # Microphone 2 - { - mu = ( -0.0160, +0.0277, +0.0000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 90.0 ); - }, - - # Microphone 3 - { - mu = ( -0.0320, +0.0000, +0.0000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 90.0 ); - }, - - # Microphone 4 - { - mu = ( -0.0160, -0.0277, +0.0000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 90.0 ); - }, - - # Microphone 5 - { - mu = ( +0.0160, -0.0277, +0.0000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 90.0 ); - }, - - # Microphone 6 - { - mu = ( +0.0320, +0.0000, +0.0000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 90.0 ); - }, - - # Microphone 7 - { - mu = ( +0.0160, +0.0277, +0.0000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 90.0 ); - }, - - # Microphone 8 - { - mu = ( +0.0160, +0.0277, +0.0000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 90.0 ); - } - - ); - - # Spatial filter to include only a range of direction if required - # (may be useful to remove false detections from the floor) - spatialfilters = ( - - { - - direction = ( +0.000, +0.000, +1.000 ); - angle = (80.0, 90.0); - - } - - ); - - nThetas = 181; - gainMin = 0.25; - -}; - -# Stationnary noise estimation - -sne: -{ - - b = 3; - alphaS = 0.1; - L = 150; - delta = 3.0; - alphaD = 0.1; - -} - -# Sound Source Localization - -ssl: -{ - - nPots = 4; - nMatches = 10; - probMin = 0.5; - nRefinedLevels = 1; - interpRate = 4; - - # Number of scans: level is the resolution of the sphere - # and delta is the size of the maximum sliding window - # (delta = -1 means the size is automatically computed) - scans = ( - { level = 2; delta = -1; }, - { level = 4; delta = -1; } - ); - - # Output to export potential sources - potential: { - - format = "undefined"; - - interface: { - type = "blackhole"; - }; - - }; - -}; - -# Sound Source Tracking - -sst: -{ - - # Mode is either "kalman" or "particle" - - mode = "kalman"; - - # Add is either "static" or "dynamic" - - add = "dynamic"; - - # Parameters used by both the Kalman and particle filter - - active = ( - { weight = 1.0; mu = 0.3; sigma2 = 0.0025 } - ); - - inactive = ( - { weight = 1.0; mu = 0.15; sigma2 = 0.0025 } - ); - - sigmaR2_prob = 0.0025; - sigmaR2_active = 0.0225; - sigmaR2_target = 0.0025; - Pfalse = 0.1; - Pnew = 0.1; - Ptrack = 0.8; - - theta_new = 0.9; - N_prob = 5; - theta_prob = 0.8; - N_inactive = ( 150, 200, 250, 250 ); - theta_inactive = 0.9; - - # Parameters used by the Kalman filter only - - kalman: { - - sigmaQ = 0.001; - - }; - - # Parameters used by the particle filter only - - particle: { - - nParticles = 1000; - st_alpha = 2.0; - st_beta = 0.04; - st_ratio = 0.5; - ve_alpha = 0.05; - ve_beta = 0.2; - ve_ratio = 0.3; - ac_alpha = 0.5; - ac_beta = 0.2; - ac_ratio = 0.2; - Nmin = 0.7; - - }; - - target: (); - - # Output to export tracked sources - tracked: { - - format = "undefined"; - - interface: { - type = "blackhole"; - }; - - }; - -} - -sss: -{ - - # Mode is either "dds", "dgss" or "dmvdr" - - mode_sep = "dds"; - mode_pf = "ms"; - - gain_sep = 1.0; - gain_pf = 10.0; - - dds: { - - }; - - dgss: { - - mu = 0.01; - lambda = 0.5; - - }; - - dmvdr: { - - }; - - ms: { - - alphaPmin = 0.07; - eta = 0.5; - alphaZ = 0.8; - thetaWin = 0.3; - alphaWin = 0.3; - maxAbsenceProb = 0.9; - Gmin = 0.01; - winSizeLocal = 3; - winSizeGlobal = 23; - winSizeFrame = 256; - - }; - - ss: { - - Gmin = 0.01; - Gmid = 0.9; - Gslope = 10.0; - - } - - separated: { - - fS = 44100; - hopSize = 512; - nBits = 16; - - interface: { - type = "file"; - path = "separated.raw"; - } - - }; - - postfiltered: { - - fS = 44100; - hopSize = 512; - nBits = 16; - - interface: { - type = "file"; - path = "postfiltered.raw"; - } - - }; - -} - -classify: -{ - - frameSize = 1024; - winSize = 3; - tauMin = 32; - tauMax = 200; - deltaTauMax = 7; - alpha = 0.3; - gamma = 0.05; - phiMin = 0.15; - r0 = 0.2; - - category: { - - format = "undefined"; - - interface: { - type = "blackhole"; - } - - } - -} diff --git a/config/odascore/matrix_creator.cfg b/config/odascore/matrix_creator.cfg deleted file mode 100644 index 65ed718..0000000 --- a/config/odascore/matrix_creator.cfg +++ /dev/null @@ -1,372 +0,0 @@ -# Configuration file for MATRIX Creator Raspberry Pi shield - -version = "2.1"; - -# Raw - -raw: -{ - - fS = 48000; - hopSize = 512; - nBits = 16; - nChannels = 8; - - # Input with raw signal from microphones - interface: { - type = "soundcard"; - card = 2; - device = 0; - } - -} - -# Mapping - -mapping: -{ - - map: (1, 2, 3, 4, 5, 6, 7, 8); - -} - -# General - -general: -{ - - epsilon = 1E-20; - - size: - { - hopSize = 128; - frameSize = 256; - }; - - samplerate: - { - mu = 16000; - sigma2 = 0.01; - }; - - speedofsound: - { - mu = 343.0; - sigma2 = 25.0; - }; - - mics = ( - - # Microphone 1 - { - mu = ( +0.020091, -0.048504, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 2 - { - mu = ( -0.020091, -0.048504, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 3 - { - mu = ( -0.048504, -0.020091, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 4 - { - mu = ( -0.048504, +0.020091, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 5 - { - mu = ( -0.020091, +0.048504, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 6 - { - mu = ( +0.020091, +0.048504, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 7 - { - mu = ( +0.048504, +0.020091, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 8 - { - mu = ( +0.048504, -0.020091, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - } - - ); - - # Spatial filter to include only a range of direction if required - # (may be useful to remove false detections from the floor) - spatialfilters = ( - - { - - direction = ( +0.000, +0.000, +1.000 ); - angle = (80.0, 100.0); - - } - - ); - - nThetas = 181; - gainMin = 0.25; - -}; - -# Stationnary noise estimation - -sne: -{ - - b = 3; - alphaS = 0.1; - L = 150; - delta = 3.0; - alphaD = 0.1; - -} - -# Sound Source Localization - -ssl: -{ - - nPots = 4; - nMatches = 10; - probMin = 0.5; - nRefinedLevels = 1; - interpRate = 4; - - # Number of scans: level is the resolution of the sphere - # and delta is the size of the maximum sliding window - # (delta = -1 means the size is automatically computed) - scans = ( - { level = 2; delta = -1; }, - { level = 4; delta = -1; } - ); - - # Output to export potential sources - potential: { - - format = "json"; - interface: { - type = "socket"; - ip = ""; - port = 9001; - }; - - }; - -}; - -# Sound Source Tracking - -sst: -{ - - # Mode is either "kalman" or "particle" - - mode = "kalman"; - - # Add is either "static" or "dynamic" - - add = "dynamic"; - - # Parameters used by both the Kalman and particle filter - - active = ( - { weight = 1.0; mu = 0.4; sigma2 = 0.0025 } - ); - - inactive = ( - { weight = 1.0; mu = 0.25; sigma2 = 0.0025 } - ); - - sigmaR2_prob = 0.0025; - sigmaR2_active = 0.0225; - sigmaR2_target = 0.0025; - Pfalse = 0.1; - Pnew = 0.1; - Ptrack = 0.8; - - theta_new = 0.9; - N_prob = 5; - theta_prob = 0.8; - N_inactive = ( 250, 250, 250, 250 ); - theta_inactive = 0.9; - - # Parameters used by the Kalman filter only - - kalman: { - - sigmaQ = 0.001; - - }; - - # Parameters used by the particle filter only - - particle: { - - nParticles = 1000; - st_alpha = 2.0; - st_beta = 0.04; - st_ratio = 0.5; - ve_alpha = 0.05; - ve_beta = 0.2; - ve_ratio = 0.3; - ac_alpha = 0.5; - ac_beta = 0.2; - ac_ratio = 0.2; - Nmin = 0.7; - - }; - - target: (); - - # Output to export tracked sources - tracked: { - - format = "json"; - - interface: { - type = "socket"; - ip = ""; - port = 9000; - }; - - }; - -} - -sss: -{ - - # Mode is either "dds", "dgss" or "dmvdr" - - mode_sep = "dds"; - mode_pf = "ss"; - - gain_sep = 1.0; - gain_pf = 10.0; - - dds: { - - }; - - dgss: { - - mu = 0.01; - lambda = 0.5; - - }; - - dmvdr: { - - }; - - ms: { - - alphaPmin = 0.07; - eta = 0.5; - alphaZ = 0.8; - thetaWin = 0.3; - alphaWin = 0.3; - maxAbsenceProb = 0.9; - Gmin = 0.01; - winSizeLocal = 3; - winSizeGlobal = 23; - winSizeFrame = 256; - - }; - - ss: { - - Gmin = 0.01; - Gmid = 0.5; - Gslope = 10.0; - - } - - separated: { - - fS = 16000; - hopSize = 128; - nBits = 16; - - interface: { - type = "socket"; - ip = ""; - port = 10000; - } - - }; - - postfiltered: { - - fS = 16000; - hopSize = 128; - nBits = 16; - gain = 10.0; - - interface: { - type = "socket"; - ip = ""; - port = 10010; - } - - }; - -}; - -classify: -{ - - frameSize = 4096; - winSize = 3; - tauMin = 88; - tauMax = 551; - deltaTauMax = 20; - alpha = 0.3; - gamma = 0.05; - phiMin = 0.5; - r0 = 0.2; - - category: { - - format = "undefined"; - - interface: { - type = "blackhole"; - } - - } - -} diff --git a/config/odascore/matrix_voice.cfg b/config/odascore/matrix_voice.cfg deleted file mode 100644 index 90b0c79..0000000 --- a/config/odascore/matrix_voice.cfg +++ /dev/null @@ -1,373 +0,0 @@ -# Configuration file for MATRIX Voice Raspberry Pi shield - -version = "2.1"; - -# Raw - -raw: -{ - - fS = 48000; - hopSize = 512; - nBits = 16; - nChannels = 8; - - # Input with raw signal from microphones - interface: { - type = "soundcard"; - card = 2; - device = 0; - } - -} - -# Mapping - -mapping: -{ - - map: (1, 2, 3, 4, 5, 6, 7, 8); - -} - -# General - -general: -{ - - epsilon = 1E-20; - - size: - { - hopSize = 128; - frameSize = 256; - }; - - samplerate: - { - mu = 16000; - sigma2 = 0.01; - }; - - speedofsound: - { - mu = 343.0; - sigma2 = 25.0; - }; - - mics = ( - - # Microphone 1 - { - mu = ( +0.000, +0.000, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 2 - { - mu = ( -0.038133, +0.003576, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 3 - { - mu = ( -0.020980, +0.032043, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 4 - { - mu = ( +0.011971, +0.036381, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 5 - { - mu = ( +0.035908, +0.013323, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 6 - { - mu = ( +0.032805, -0.019767, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 7 - { - mu = ( +0.004999, -0.037972, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 8 - { - mu = ( -0.026571, -0.027584, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - } - - ); - - # Spatial filters to include only a range of direction if required - # (may be useful to remove false detections from the floor, or - # limit the space search to a restricted region) - spatialfilters = ( - - { - - direction = ( +0.000, +0.000, +1.000 ); - angle = (80.0, 90.0); - - } - - ); - - nThetas = 181; - gainMin = 0.25; - -}; - -# Stationnary noise estimation - -sne: -{ - - b = 3; - alphaS = 0.1; - L = 150; - delta = 3.0; - alphaD = 0.1; - -} - -# Sound Source Localization - -ssl: -{ - - nPots = 4; - nMatches = 10; - probMin = 0.5; - nRefinedLevels = 1; - interpRate = 4; - - # Number of scans: level is the resolution of the sphere - # and delta is the size of the maximum sliding window - # (delta = -1 means the size is automatically computed) - scans = ( - { level = 2; delta = -1; }, - { level = 4; delta = -1; } - ); - - # Output to export potential sources - potential: { - - format = "json"; - interface: { - type = "socket"; - ip = ""; - port = 9001; - }; - - }; - -}; - -# Sound Source Tracking - -sst: -{ - - # Mode is either "kalman" or "particle" - - mode = "kalman"; - - # Add is either "static" or "dynamic" - - add = "dynamic"; - - # Parameters used by both the Kalman and particle filter - - active = ( - { weight = 1.0; mu = 0.4; sigma2 = 0.0025 } - ); - - inactive = ( - { weight = 1.0; mu = 0.25; sigma2 = 0.0025 } - ); - - sigmaR2_prob = 0.0025; - sigmaR2_active = 0.0225; - sigmaR2_target = 0.0025; - Pfalse = 0.1; - Pnew = 0.1; - Ptrack = 0.8; - - theta_new = 0.9; - N_prob = 5; - theta_prob = 0.8; - N_inactive = ( 250, 250, 250, 250 ); - theta_inactive = 0.9; - - # Parameters used by the Kalman filter only - - kalman: { - - sigmaQ = 0.001; - - }; - - # Parameters used by the particle filter only - - particle: { - - nParticles = 1000; - st_alpha = 2.0; - st_beta = 0.04; - st_ratio = 0.5; - ve_alpha = 0.05; - ve_beta = 0.2; - ve_ratio = 0.3; - ac_alpha = 0.5; - ac_beta = 0.2; - ac_ratio = 0.2; - Nmin = 0.7; - - }; - - target: (); - - # Output to export tracked sources - tracked: { - - format = "json"; - - interface: { - type = "socket"; - ip = ""; - port = 9000; - }; - - }; - -} - -sss: -{ - - # Mode is either "dds", "dgss" or "dmvdr" - - mode_sep = "dds"; - mode_pf = "ss"; - - gain_sep = 1.0; - gain_pf = 10.0; - - dds: { - - }; - - dgss: { - - mu = 0.01; - lambda = 0.5; - - }; - - dmvdr: { - - }; - - ms: { - - alphaPmin = 0.07; - eta = 0.5; - alphaZ = 0.8; - thetaWin = 0.3; - alphaWin = 0.3; - maxAbsenceProb = 0.9; - Gmin = 0.01; - winSizeLocal = 3; - winSizeGlobal = 23; - winSizeFrame = 256; - - }; - - ss: { - - Gmin = 0.01; - Gmid = 0.5; - Gslope = 10.0; - - } - - separated: { - - fS = 16000; - hopSize = 128; - nBits = 16; - - interface: { - type = "socket"; - ip = ""; - port = 10000; - } - - }; - - postfiltered: { - - fS = 16000; - hopSize = 128; - nBits = 16; - gain = 10.0; - - interface: { - type = "socket"; - ip = ""; - port = 10010; - } - - }; - -}; - -classify: -{ - - frameSize = 4096; - winSize = 3; - tauMin = 88; - tauMax = 551; - deltaTauMax = 20; - alpha = 0.3; - gamma = 0.05; - phiMin = 0.5; - r0 = 0.2; - - category: { - - format = "undefined"; - - interface: { - type = "blackhole"; - } - - } - -} diff --git a/config/odascore/minidsp.cfg b/config/odascore/minidsp.cfg deleted file mode 100644 index d47d321..0000000 --- a/config/odascore/minidsp.cfg +++ /dev/null @@ -1,360 +0,0 @@ -# Configuration file for XMOS circular sound card - -version = "2.1"; - -# Raw - -raw: -{ - - fS = 48000; - hopSize = 512; - nBits = 32; - nChannels = 8; - - # Input with raw signal from microphones - interface: { - type = "soundcard"; - card = 2; - device = 0; - } - -} - -# Mapping - -mapping: -{ - - map: (1, 2, 3, 4, 5, 6, 7); - -} - -# General - -general: -{ - - epsilon = 1E-20; - - size: - { - hopSize = 128; - frameSize = 256; - }; - - samplerate: - { - mu = 16000; - sigma2 = 0.01; - }; - - speedofsound: - { - mu = 343.0; - sigma2 = 25.0; - }; - - mics = ( - - # Microphone 0 - { - mu = ( +0.000, +0.000, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 90.0, 100.0 ); - }, - - # Microphone 1 - { - mu = ( +0.000, +0.043, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 90.0, 100.0 ); - }, - - # Microphone 2 - { - mu = ( +0.037, +0.021, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 90.0, 100.0 ); - }, - - # Microphone 3 - { - mu = ( +0.037, -0.021, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 90.0, 100.0 ); - }, - - # Microphone 4 - { - mu = ( +0.000, -0.043, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 90.0, 100.0 ); - }, - - # Microphone 5 - { - mu = ( -0.037, -0.021, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 90.0, 100.0 ); - }, - - # Microphone 6 - { - mu = ( -0.037, +0.021, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 90.0, 100.0 ); - } - - ); - - # Spatial filters to include only a range of direction if required - # (may be useful to remove false detections from the floor, or - # limit the space search to a restricted region) - spatialfilters = ( - - { - - direction = ( +0.000, +0.000, +1.000 ); - angle = (90.0, 95.0); - - } - - ); - - nThetas = 181; - gainMin = 0.25; - -}; - -# Stationnary noise estimation - -sne: -{ - - b = 3; - alphaS = 0.1; - L = 150; - delta = 3.0; - alphaD = 0.1; - -} - -# Sound Source Localization - -ssl: -{ - - nPots = 4; - nMatches = 10; - probMin = 0.5; - nRefinedLevels = 1; - interpRate = 4; - - # Number of scans: level is the resolution of the sphere - # and delta is the size of the maximum sliding window - # (delta = -1 means the size is automatically computed) - scans = ( - { level = 2; delta = -1; }, - { level = 4; delta = -1; } - ); - - # Output to export potential sources - potential: { - - format = "undefined"; - - interface: { - type = "blackhole"; - }; - - }; - -}; - -# Sound Source Tracking - -sst: -{ - - # Mode is either "kalman" or "particle" - - mode = "kalman"; - - # Add is either "static" or "dynamic" - - add = "dynamic"; - - # Parameters used by both the Kalman and particle filter - - active = ( - { weight = 1.0; mu = 0.4; sigma2 = 0.0025 } - ); - - inactive = ( - { weight = 1.0; mu = 0.25; sigma2 = 0.0025 } - ); - - sigmaR2_prob = 0.0025; - sigmaR2_active = 0.0225; - sigmaR2_target = 0.0025; - Pfalse = 0.1; - Pnew = 0.1; - Ptrack = 0.8; - - theta_new = 0.3; - N_prob = 5; - theta_prob = 0.8; - N_inactive = ( 150, 150, 150, 150 ); - theta_inactive = 0.9; - - # Parameters used by the Kalman filter only - - kalman: { - - sigmaQ = 0.001; - - }; - - # Parameters used by the particle filter only - - particle: { - - nParticles = 1000; - st_alpha = 2.0; - st_beta = 0.04; - st_ratio = 0.5; - ve_alpha = 0.05; - ve_beta = 0.2; - ve_ratio = 0.3; - ac_alpha = 0.5; - ac_beta = 0.2; - ac_ratio = 0.2; - Nmin = 0.7; - - }; - - target: (); - - # Output to export tracked sources - tracked: { - - format = "json"; - - interface: { - type = "terminal"; - }; - - }; - -} - -sss: -{ - - # Mode is either "dds", "dgss" or "dmvdr" - - mode_sep = "dds"; - mode_pf = "ss"; - - gain_sep = 1.0; - gain_pf = 10.0; - - dds: { - - }; - - dgss: { - - mu = 0.01; - lambda = 0.5; - - }; - - dmvdr: { - - }; - - ms: { - - alphaPmin = 0.07; - eta = 0.5; - alphaZ = 0.8; - thetaWin = 0.3; - alphaWin = 0.3; - maxAbsenceProb = 0.9; - Gmin = 0.01; - winSizeLocal = 3; - winSizeGlobal = 23; - winSizeFrame = 256; - - }; - - ss: { - - Gmin = 0.01; - Gmid = 0.5; - Gslope = 10.0; - - } - - separated: { - - fS = 16000; - hopSize = 128; - nBits = 16; - - interface: { - type = "file"; - path = "test_separated.raw"; - }; - - }; - - postfiltered: { - - fS = 16000; - hopSize = 128; - nBits = 16; - gain = 10.0; - - interface: { - type = "file"; - path = "test_postfiltered.raw"; - }; - - }; - -}; - -classify: -{ - - frameSize = 4096; - winSize = 3; - tauMin = 88; - tauMax = 551; - deltaTauMax = 20; - alpha = 0.3; - gamma = 0.05; - phiMin = 0.5; - r0 = 0.2; - - category: { - - format = "undefined"; - - interface: { - type = "blackhole"; - } - - } - -} diff --git a/config/odascore/pepper.cfg b/config/odascore/pepper.cfg deleted file mode 100644 index f24e100..0000000 --- a/config/odascore/pepper.cfg +++ /dev/null @@ -1,336 +0,0 @@ -# Configuration file for the Aldebaran Pepper Robot - -version = "2.1"; - -# Raw - -raw: -{ - - fS = 48000; - hopSize = 512; - nBits = 16; - nChannels = 4; - - # Input with raw signal from microphones - interface: { - type = "soundcard_name"; - devicename = "AD1989A_inputs"; - } - -} - -# Mapping - -mapping: -{ - - map: (1, 2, 3, 4); - -} - -# General - -general: -{ - - epsilon = 1E-20; - - size: - { - hopSize = 128; - frameSize = 256; - }; - - samplerate: - { - mu = 16000; - sigma2 = 0.01; - }; - - speedofsound: - { - mu = 343.0; - sigma2 = 25.0; - }; - - mics = ( - - # Microphone 1 - { - mu = ( -0.0267, +0.0343, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 2 - { - mu = ( -0.0267, -0.0343, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 3 - { - mu = ( +0.0313, +0.0343, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 4 - { - mu = ( +0.0313, -0.0343, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - } - - ); - - # Spatial filters to include only a range of direction if required - # (may be useful to remove false detections from the floor, or - # limit the space search to a restricted region) - spatialfilters = ( - - { - - direction = ( +0.000, +0.000, +1.000 ); - angle = (80.0, 90.0); - - } - - ); - - nThetas = 181; - gainMin = 0.25; - -}; - -# Stationnary noise estimation - -sne: -{ - - b = 3; - alphaS = 0.1; - L = 150; - delta = 3.0; - alphaD = 0.1; - -} - -# Sound Source Localization - -ssl: -{ - - nPots = 4; - nMatches = 10; - probMin = 0.5; - nRefinedLevels = 1; - interpRate = 4; - - # Number of scans: level is the resolution of the sphere - # and delta is the size of the maximum sliding window - # (delta = -1 means the size is automatically computed) - scans = ( - { level = 2; delta = -1; }, - { level = 4; delta = -1; } - ); - - # Output to export potential sources - potential: { - - format = "undefined"; - - interface: { - type = "blackhole"; - }; - - }; - -}; - -# Sound Source Tracking - -sst: -{ - - # Mode is either "kalman" or "particle" - - mode = "kalman"; - - # Add is either "static" or "dynamic" - - add = "dynamic"; - - # Parameters used by both the Kalman and particle filter - - active = ( - { weight = 1.0; mu = 0.4; sigma2 = 0.0025 } - ); - - inactive = ( - { weight = 1.0; mu = 0.25; sigma2 = 0.0025 } - ); - - sigmaR2_prob = 0.0025; - sigmaR2_active = 0.0225; - sigmaR2_target = 0.0025; - Pfalse = 0.1; - Pnew = 0.1; - Ptrack = 0.8; - - theta_new = 0.9; - N_prob = 5; - theta_prob = 0.8; - N_inactive = ( 250, 250, 250, 250 ); - theta_inactive = 0.9; - - # Parameters used by the Kalman filter only - - kalman: { - - sigmaQ = 0.001; - - }; - - # Parameters used by the particle filter only - - particle: { - - nParticles = 1000; - st_alpha = 2.0; - st_beta = 0.04; - st_ratio = 0.5; - ve_alpha = 0.05; - ve_beta = 0.2; - ve_ratio = 0.3; - ac_alpha = 0.5; - ac_beta = 0.2; - ac_ratio = 0.2; - Nmin = 0.7; - - }; - - target: (); - - # Output to export tracked sources - tracked: { - - format = "json"; - - interface: { - type = "file"; - path = "tracks.txt"; - }; - - }; - -} - -sss: -{ - - # Mode is either "dds", "dgss" or "dmvdr" - - mode_sep = "dds"; - mode_pf = "ss"; - - gain_sep = 1.0; - gain_pf = 10.0; - - dds: { - - }; - - dgss: { - - mu = 0.01; - lambda = 0.5; - - }; - - dmvdr: { - - }; - - ms: { - - alphaPmin = 0.07; - eta = 0.5; - alphaZ = 0.8; - thetaWin = 0.3; - alphaWin = 0.3; - maxAbsenceProb = 0.9; - Gmin = 0.01; - winSizeLocal = 3; - winSizeGlobal = 23; - winSizeFrame = 256; - - }; - - ss: { - - Gmin = 0.01; - Gmid = 0.5; - Gslope = 10.0; - - } - - separated: { - - fS = 16000; - hopSize = 128; - nBits = 16; - - interface: { - type = "file"; - path = "separated.raw"; - }; - - }; - - postfiltered: { - - fS = 16000; - hopSize = 128; - nBits = 16; - gain = 10.0; - - interface: { - type = "file"; - path = "postfiltered.raw"; - }; - - }; - -}; - -classify: -{ - - frameSize = 4096; - winSize = 3; - tauMin = 88; - tauMax = 551; - deltaTauMax = 20; - alpha = 0.3; - gamma = 0.05; - phiMin = 0.5; - r0 = 0.2; - - category: { - - format = "undefined"; - - interface: { - type = "blackhole"; - } - - } - -} diff --git a/config/odascore/pseye.cfg b/config/odascore/pseye.cfg deleted file mode 100644 index 8dd8dec..0000000 --- a/config/odascore/pseye.cfg +++ /dev/null @@ -1,343 +0,0 @@ -# Configuration file for XMOS circular sound card - -version = "2.1"; - -# Raw - -raw: -{ - - fS = 48000; - hopSize = 512; - nBits = 16; - nChannels = 4; - - # Input with raw signal from microphones - interface: { - type = "soundcard"; - card = 2; - device = 0; - } - -} - -# Mapping - -mapping: -{ - - map: (1, 2, 3, 4); - -} - -# General - -general: -{ - - epsilon = 1E-20; - - size: - { - hopSize = 128; - frameSize = 256; - }; - - samplerate: - { - mu = 16000; - sigma2 = 0.01; - }; - - speedofsound: - { - mu = 343.0; - sigma2 = 25.0; - }; - - mics = ( - - # Microphone 0 - { - mu = ( +0.000, -0.030, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +1.000, +0.000, +0.000 ); - angle = ( 90.0, 100.0 ); - }, - - # Microphone 1 - { - mu = ( +0.000, +0.010, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +1.000, +0.000, +0.000 ); - angle = ( 90.0, 100.0 ); - }, - - # Microphone 2 - { - mu = ( +0.000, +0.010, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +1.000, +0.000, +0.000 ); - angle = ( 90.0, 100.0 ); - }, - - # Microphone 3 - { - mu = ( +0.000, +0.030, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +1.000, +0.000, +0.000 ); - angle = ( 90.0, 100.0 ); - } - - ); - - # Spatial filters to include only a range of direction if required - # (may be useful to remove false detections from the floor, or - # limit the space search to a restricted region) - spatialfilters = ( - - { - - direction = ( +0.000, +0.000, +1.000 ); - angle = (90.0, 95.0); - - }, - - { - - direction = ( +0.000, +0.000, -1.000 ); - angle = (90.0, 95.0); - - } - - ); - - nThetas = 181; - gainMin = 0.25; - -}; - -# Stationnary noise estimation - -sne: -{ - - b = 3; - alphaS = 0.1; - L = 150; - delta = 3.0; - alphaD = 0.1; - -} - -# Sound Source Localization - -ssl: -{ - - nPots = 4; - nMatches = 10; - probMin = 0.5; - nRefinedLevels = 1; - interpRate = 4; - - # Number of scans: level is the resolution of the sphere - # and delta is the size of the maximum sliding window - # (delta = -1 means the size is automatically computed) - scans = ( - { level = 2; delta = -1; }, - { level = 4; delta = -1; } - ); - - # Output to export potential sources - potential: { - - format = "undefined"; - - interface: { - type = "blackhole"; - }; - - }; - -}; - -# Sound Source Tracking - -sst: -{ - - # Mode is either "kalman" or "particle" - - mode = "kalman"; - - # Add is either "static" or "dynamic" - - add = "dynamic"; - - # Parameters used by both the Kalman and particle filter - - active = ( - { weight = 1.0; mu = 0.4; sigma2 = 0.0025 } - ); - - inactive = ( - { weight = 1.0; mu = 0.25; sigma2 = 0.0025 } - ); - - sigmaR2_prob = 0.0025; - sigmaR2_active = 0.0225; - sigmaR2_target = 0.0025; - Pfalse = 0.1; - Pnew = 0.1; - Ptrack = 0.8; - - theta_new = 0.3; - N_prob = 5; - theta_prob = 0.8; - N_inactive = ( 150, 150, 150, 150 ); - theta_inactive = 0.9; - - # Parameters used by the Kalman filter only - - kalman: { - - sigmaQ = 0.001; - - }; - - # Parameters used by the particle filter only - - particle: { - - nParticles = 1000; - st_alpha = 2.0; - st_beta = 0.04; - st_ratio = 0.5; - ve_alpha = 0.05; - ve_beta = 0.2; - ve_ratio = 0.3; - ac_alpha = 0.5; - ac_beta = 0.2; - ac_ratio = 0.2; - Nmin = 0.7; - - }; - - target: (); - - # Output to export tracked sources - tracked: { - - format = "json"; - - interface: { - type = "terminal"; - }; - - }; - -} - -sss: -{ - - # Mode is either "dds", "dgss" or "dmvdr" - - mode_sep = "dds"; - mode_pf = "ss"; - - gain_sep = 1.0; - gain_pf = 10.0; - - dds: { - - }; - - dgss: { - - mu = 0.01; - lambda = 0.5; - - }; - - dmvdr: { - - }; - - ms: { - - alphaPmin = 0.07; - eta = 0.5; - alphaZ = 0.8; - thetaWin = 0.3; - alphaWin = 0.3; - maxAbsenceProb = 0.9; - Gmin = 0.01; - winSizeLocal = 3; - winSizeGlobal = 23; - winSizeFrame = 256; - - }; - - ss: { - - Gmin = 0.01; - Gmid = 0.5; - Gslope = 10.0; - - } - - separated: { - - fS = 16000; - hopSize = 128; - nBits = 16; - - interface: { - type = "file"; - path = "test_separated.raw"; - }; - - }; - - postfiltered: { - - fS = 16000; - hopSize = 128; - nBits = 16; - gain = 10.0; - - interface: { - type = "file"; - path = "test_postfiltered.raw"; - }; - - }; - -}; - -classify: -{ - - frameSize = 4096; - winSize = 3; - tauMin = 88; - tauMax = 551; - deltaTauMax = 20; - alpha = 0.3; - gamma = 0.05; - phiMin = 0.5; - r0 = 0.2; - - category: { - - format = "undefined"; - - interface: { - type = "blackhole"; - } - - } - -} diff --git a/config/odascore/respeaker.cfg b/config/odascore/respeaker.cfg deleted file mode 100644 index 69d6d0d..0000000 --- a/config/odascore/respeaker.cfg +++ /dev/null @@ -1,359 +0,0 @@ -# Configuration file for ReSpeaker circular sound card - -version = "2.1"; - -# Raw - -raw: -{ - - fS = 16000; - hopSize = 128; - nBits = 16; - nChannels = 8; - - # Input with raw signal from microphones - interface: { - type = "soundcard"; - card = 3; - device = 0; - } - -} - -# Mapping - -mapping: -{ - - map: (1, 2, 3, 4, 5, 6, 7); - -} - -# General - -general: -{ - - epsilon = 1E-20; - - size: - { - hopSize = 128; - frameSize = 256; - }; - - samplerate: - { - mu = 16000; - sigma2 = 0.01; - }; - - speedofsound: - { - mu = 343.0; - sigma2 = 25.0; - }; - - mics = ( - - # Microphone 1 - { - mu = ( +0.0000, +0.0000, +0.0000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 90.0 ); - }, - - # Microphone 2 - { - mu = ( -0.0160, +0.0277, +0.0000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 90.0 ); - }, - - # Microphone 3 - { - mu = ( -0.0320, +0.0000, +0.0000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 90.0 ); - }, - - # Microphone 4 - { - mu = ( -0.0160, -0.0277, +0.0000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 90.0 ); - }, - - # Microphone 5 - { - mu = ( +0.0160, -0.0277, +0.0000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 90.0 ); - }, - - # Microphone 6 - { - mu = ( +0.0320, +0.0000, +0.0000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 90.0 ); - }, - - # Microphone 7 - { - mu = ( +0.0160, +0.0277, +0.0000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 90.0 ); - } - - ); - - # Spatial filters to include only a range of direction if required - # (may be useful to remove false detections from the floor, or - # limit the space search to a restricted region) - spatialfilters = ( - - { - - direction = ( +0.000, +0.000, +1.000 ); - angle = (80.0, 90.0); - - } - - ); - - nThetas = 181; - gainMin = 0.25; - -}; - -# Stationnary noise estimation - -sne: -{ - - b = 3; - alphaS = 0.1; - L = 150; - delta = 3.0; - alphaD = 0.1; - -} - -# Sound Source Localization - -ssl: -{ - - nPots = 4; - nMatches = 10; - probMin = 0.5; - nRefinedLevels = 1; - interpRate = 4; - - # Number of scans: level is the resolution of the sphere - # and delta is the size of the maximum sliding window - # (delta = -1 means the size is automatically computed) - scans = ( - { level = 2; delta = -1; }, - { level = 4; delta = -1; } - ); - - # Output to export potential sources - potential: { - - format = "undefined"; - - interface: { - type = "blackhole"; - }; - - }; - -}; - -# Sound Source Tracking - -sst: -{ - - # Mode is either "kalman" or "particle" - - mode = "kalman"; - - # Add is either "static" or "dynamic" - - add = "dynamic"; - - # Parameters used by both the Kalman and particle filter - - active = ( - { weight = 1.0; mu = 0.3; sigma2 = 0.0025 } - ); - - inactive = ( - { weight = 1.0; mu = 0.15; sigma2 = 0.0025 } - ); - - sigmaR2_prob = 0.0025; - sigmaR2_active = 0.0225; - sigmaR2_target = 0.0025; - Pfalse = 0.1; - Pnew = 0.1; - Ptrack = 0.8; - - theta_new = 0.9; - N_prob = 5; - theta_prob = 0.8; - N_inactive = ( 150, 200, 250, 250 ); - theta_inactive = 0.9; - - # Parameters used by the Kalman filter only - - kalman: { - - sigmaQ = 0.001; - - }; - - # Parameters used by the particle filter only - - particle: { - - nParticles = 1000; - st_alpha = 2.0; - st_beta = 0.04; - st_ratio = 0.5; - ve_alpha = 0.05; - ve_beta = 0.2; - ve_ratio = 0.3; - ac_alpha = 0.5; - ac_beta = 0.2; - ac_ratio = 0.2; - Nmin = 0.7; - - }; - - target: (); - - # Output to export tracked sources - tracked: { - - format = "undefined"; - - interface: { - type = "blackhole"; - }; - - }; - -} - -sss: -{ - - # Mode is either "dds", "dgss" or "dmvdr" - - mode_sep = "dds"; - mode_pf = "ms"; - - gain_sep = 1.0; - gain_pf = 10.0; - - dds: { - - }; - - dgss: { - - mu = 0.01; - lambda = 0.5; - - }; - - dmvdr: { - - }; - - ms: { - - alphaPmin = 0.07; - eta = 0.5; - alphaZ = 0.8; - thetaWin = 0.3; - alphaWin = 0.3; - maxAbsenceProb = 0.9; - Gmin = 0.01; - winSizeLocal = 3; - winSizeGlobal = 23; - winSizeFrame = 256; - - }; - - ss: { - - Gmin = 0.01; - Gmid = 0.9; - Gslope = 10.0; - - } - - separated: { - - fS = 44100; - hopSize = 512; - nBits = 16; - - interface: { - type = "file"; - path = "separated.raw"; - } - - }; - - postfiltered: { - - fS = 44100; - hopSize = 512; - nBits = 16; - - interface: { - type = "file"; - path = "postfiltered.raw"; - } - - }; - -} - -classify: -{ - - frameSize = 1024; - winSize = 3; - tauMin = 32; - tauMax = 200; - deltaTauMax = 7; - alpha = 0.3; - gamma = 0.05; - phiMin = 0.15; - r0 = 0.2; - - category: { - - format = "undefined"; - - interface: { - type = "blackhole"; - } - - } - -} diff --git a/config/odascore/respeaker_4_mic_array.cfg b/config/odascore/respeaker_4_mic_array.cfg deleted file mode 100644 index 07625cd..0000000 --- a/config/odascore/respeaker_4_mic_array.cfg +++ /dev/null @@ -1,338 +0,0 @@ -# Configuration file for ReSpeaker 4 Mic Array (a hat for Raspberry Pi) - -version = "2.1"; - -# Raw - -raw: -{ - - fS = 16000; - hopSize = 128; - nBits = 32; - nChannels = 4; - - # Input with raw signal from microphones - interface: { - type = "soundcard"; - card = 1; - device = 0; - } - -} - -# Mapping - -mapping: -{ - - map: (1, 2, 3, 4); - -} - -# General - -general: -{ - - epsilon = 1E-20; - - size: - { - hopSize = 128; - frameSize = 256; - }; - - samplerate: - { - mu = 16000; - sigma2 = 0.01; - }; - - speedofsound: - { - mu = 343.0; - sigma2 = 25.0; - }; - - mics = ( - - # Microphone 1 - { - mu = ( -0.0405, +0.0000, +0.0000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 90.0 ); - }, - - # Microphone 2 - { - mu = ( +0.0000, +0.0405, +0.0000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 90.0 ); - }, - - # Microphone 3 - { - mu = ( +0.0405, +0.0000, +0.0000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 90.0 ); - }, - - # Microphone 4 - { - mu = ( +0.0000, -0.0405, +0.0000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 90.0 ); - } - - ); - - # Spatial filters to include only a range of direction if required - # (may be useful to remove false detections from the floor, or - # limit the space search to a restricted region) - spatialfilters = ( - - { - - direction = ( +0.000, +0.000, +1.000 ); - angle = (80.0, 90.0); - - } - - ); - - nThetas = 181; - gainMin = 0.25; - -}; - -# Stationnary noise estimation - -sne: -{ - - b = 3; - alphaS = 0.1; - L = 150; - delta = 3.0; - alphaD = 0.1; - -} - -# Sound Source Localization - -ssl: -{ - - nPots = 4; - nMatches = 10; - probMin = 0.5; - nRefinedLevels = 1; - interpRate = 4; - - # Number of scans: level is the resolution of the sphere - # and delta is the size of the maximum sliding window - # (delta = -1 means the size is automatically computed) - scans = ( - { level = 2; delta = -1; }, - { level = 4; delta = -1; } - ); - - # Output to export potential sources - potential: { - - # format = "undefined"; - format = "json"; - - interface: { - # type = "blackhole"; - type = "socket"; ip = "127.0.0.1"; port = 9001; - }; - }; - -}; - -# Sound Source Tracking - -sst: -{ - - # Mode is either "kalman" or "particle" - - mode = "kalman"; - - # Add is either "static" or "dynamic" - - add = "dynamic"; - - # Parameters used by both the Kalman and particle filter - - active = ( - { weight = 1.0; mu = 0.3; sigma2 = 0.0025 } - ); - - inactive = ( - { weight = 1.0; mu = 0.15; sigma2 = 0.0025 } - ); - - sigmaR2_prob = 0.0025; - sigmaR2_active = 0.0225; - sigmaR2_target = 0.0025; - Pfalse = 0.1; - Pnew = 0.1; - Ptrack = 0.8; - - theta_new = 0.9; - N_prob = 5; - theta_prob = 0.8; - N_inactive = ( 150, 200, 250, 250 ); - theta_inactive = 0.9; - - # Parameters used by the Kalman filter only - - kalman: { - - sigmaQ = 0.001; - - }; - - # Parameters used by the particle filter only - - particle: { - - nParticles = 1000; - st_alpha = 2.0; - st_beta = 0.04; - st_ratio = 0.5; - ve_alpha = 0.05; - ve_beta = 0.2; - ve_ratio = 0.3; - ac_alpha = 0.5; - ac_beta = 0.2; - ac_ratio = 0.2; - Nmin = 0.7; - - }; - - target: (); - - # Output to export tracked sources - tracked: { - - # format = "undefined"; - format = "json"; - - interface: { - # type = "blackhole"; - type = "socket"; ip = "127.0.0.1"; port = 9000; - }; - - }; - -} - -sss: -{ - - # Mode is either "dds", "dgss" or "dmvdr" - - mode_sep = "dds"; - mode_pf = "ms"; - - gain_sep = 1.0; - gain_pf = 10.0; - - dds: { - - }; - - dgss: { - - mu = 0.01; - lambda = 0.5; - - }; - - dmvdr: { - - }; - - ms: { - - alphaPmin = 0.07; - eta = 0.5; - alphaZ = 0.8; - thetaWin = 0.3; - alphaWin = 0.3; - maxAbsenceProb = 0.9; - Gmin = 0.01; - winSizeLocal = 3; - winSizeGlobal = 23; - winSizeFrame = 256; - - }; - - ss: { - - Gmin = 0.01; - Gmid = 0.9; - Gslope = 10.0; - - } - - separated: { - - fS = 44100; - hopSize = 512; - nBits = 16; - - interface: { - type = "file"; - path = "separated.raw"; - } - - }; - - postfiltered: { - - fS = 44100; - hopSize = 512; - nBits = 16; - - interface: { - type = "file"; - path = "postfiltered.raw"; - } - - }; - -} - -classify: -{ - - frameSize = 1024; - winSize = 3; - tauMin = 32; - tauMax = 200; - deltaTauMax = 7; - alpha = 0.3; - gamma = 0.05; - phiMin = 0.15; - r0 = 0.2; - - category: { - - format = "undefined"; - - interface: { - type = "blackhole"; - } - - } - -} diff --git a/config/odascore/xmos.cfg b/config/odascore/xmos.cfg deleted file mode 100644 index c92efae..0000000 --- a/config/odascore/xmos.cfg +++ /dev/null @@ -1,360 +0,0 @@ -# Configuration file for XMOS circular sound card - -version = "2.1"; - -# Raw - -raw: -{ - - fS = 48000; - hopSize = 512; - nBits = 16; - nChannels = 8; - - # Input with raw signal from microphones - interface: { - type = "file"; - path = "meeting_recorded_raw_16.raw"; - } - -} - -# Mapping - -mapping: -{ - - map: (1, 2, 3, 4, 5, 6, 7); - -} - -# General - -general: -{ - - epsilon = 1E-20; - - size: - { - hopSize = 128; - frameSize = 256; - }; - - samplerate: - { - mu = 16000; - sigma2 = 0.01; - }; - - speedofsound: - { - mu = 343.0; - sigma2 = 25.0; - }; - - mics = ( - - # Microphone 1 - { - mu = ( +0.000, +0.000, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 2 - { - mu = ( -0.022, -0.037, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 3 - { - mu = ( -0.043, +0.000, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 4 - { - mu = ( -0.022, +0.037, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 5 - { - mu = ( +0.022, +0.037, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 6 - { - mu = ( +0.043, +0.000, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - }, - - # Microphone 7 - { - mu = ( +0.022, -0.037, +0.000 ); - sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); - direction = ( +0.000, +0.000, +1.000 ); - angle = ( 80.0, 100.0 ); - } - - ); - - # Spatial filters to include only a range of direction if required - # (may be useful to remove false detections from the floor, or - # limit the space search to a restricted region) - spatialfilters = ( - - { - - direction = ( +0.000, +0.000, +1.000 ); - angle = (80.0, 90.0); - - } - - ); - - nThetas = 181; - gainMin = 0.25; - -}; - -# Stationnary noise estimation - -sne: -{ - - b = 3; - alphaS = 0.1; - L = 150; - delta = 3.0; - alphaD = 0.1; - -} - -# Sound Source Localization - -ssl: -{ - - nPots = 4; - nMatches = 10; - probMin = 0.5; - nRefinedLevels = 1; - interpRate = 4; - - # Number of scans: level is the resolution of the sphere - # and delta is the size of the maximum sliding window - # (delta = -1 means the size is automatically computed) - scans = ( - { level = 2; delta = -1; }, - { level = 4; delta = -1; } - ); - - # Output to export potential sources - potential: { - - format = "undefined"; - - interface: { - type = "blackhole"; - }; - - }; - -}; - -# Sound Source Tracking - -sst: -{ - - # Mode is either "kalman" or "particle" - - mode = "kalman"; - - # Add is either "static" or "dynamic" - - add = "dynamic"; - - # Parameters used by both the Kalman and particle filter - - active = ( - { weight = 1.0; mu = 0.4; sigma2 = 0.0025 } - ); - - inactive = ( - { weight = 1.0; mu = 0.25; sigma2 = 0.0025 } - ); - - sigmaR2_prob = 0.0025; - sigmaR2_active = 0.0225; - sigmaR2_target = 0.0025; - Pfalse = 0.1; - Pnew = 0.1; - Ptrack = 0.8; - - theta_new = 0.9; - N_prob = 5; - theta_prob = 0.8; - N_inactive = ( 250, 250, 250, 250 ); - theta_inactive = 0.9; - - # Parameters used by the Kalman filter only - - kalman: { - - sigmaQ = 0.001; - - }; - - # Parameters used by the particle filter only - - particle: { - - nParticles = 1000; - st_alpha = 2.0; - st_beta = 0.04; - st_ratio = 0.5; - ve_alpha = 0.05; - ve_beta = 0.2; - ve_ratio = 0.3; - ac_alpha = 0.5; - ac_beta = 0.2; - ac_ratio = 0.2; - Nmin = 0.7; - - }; - - target: (); - - # Output to export tracked sources - tracked: { - - format = "json"; - - interface: { - type = "file"; - path = "tracks.txt"; - }; - - }; - -} - -sss: -{ - - # Mode is either "dds", "dgss" or "dmvdr" - - mode_sep = "dds"; - mode_pf = "ss"; - - gain_sep = 1.0; - gain_pf = 10.0; - - dds: { - - }; - - dgss: { - - mu = 0.01; - lambda = 0.5; - - }; - - dmvdr: { - - }; - - ms: { - - alphaPmin = 0.07; - eta = 0.5; - alphaZ = 0.8; - thetaWin = 0.3; - alphaWin = 0.3; - maxAbsenceProb = 0.9; - Gmin = 0.01; - winSizeLocal = 3; - winSizeGlobal = 23; - winSizeFrame = 256; - - }; - - ss: { - - Gmin = 0.01; - Gmid = 0.5; - Gslope = 10.0; - - } - - separated: { - - fS = 16000; - hopSize = 128; - nBits = 16; - - interface: { - type = "file"; - path = "separated.raw"; - }; - - }; - - postfiltered: { - - fS = 16000; - hopSize = 128; - nBits = 16; - gain = 10.0; - - interface: { - type = "file"; - path = "postfiltered.raw"; - }; - - }; - -}; - -classify: -{ - - frameSize = 4096; - winSize = 3; - tauMin = 88; - tauMax = 551; - deltaTauMax = 20; - alpha = 0.3; - gamma = 0.05; - phiMin = 0.5; - r0 = 0.2; - - category: { - - format = "undefined"; - - interface: { - type = "blackhole"; - } - - } - -} diff --git a/config/odaslive/azimut_cma.cfg b/config/odaslive/azimut_cma.cfg new file mode 100644 index 0000000..1ac9971 --- /dev/null +++ b/config/odaslive/azimut_cma.cfg @@ -0,0 +1,449 @@ +# Configuration file for ReSpeaker circular sound card + +version = "2.1"; + +# Raw + +raw: +{ + + fS = 16000; + hopSize = 128; + nBits = 16; + nChannels = 16; + + # Input with raw signal from microphones + interface: { + type = "file"; + path = "input_cma.raw"; + } + +} + +# Mapping + +mapping: +{ + + map: (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + +} + +# General + +general: +{ + + epsilon = 1E-20; + + size: + { + hopSize = 128; + frameSize = 256; + }; + + samplerate: + { + mu = 16000; + sigma2 = 0.01; + }; + + speedofsound: + { + mu = 343.0; + sigma2 = 25.0; + }; + + mics = ( + + # Microphone 1 + { + mu = ( +0.1250, -0.0725, +0.0725 ); + sigma2 = ( 0.0, 0.0, 0.0, 0.0, +1E-6, 0.0, 0.0, 0.0, +1E-6 ); + direction = ( +1.000, +0.000, +0.000 ); + #angle = ( 80.0, 100.0 ); + angle = ( 180.0, 180.0 ); + }, + + # Microphone 2 + { + mu = ( +0.1250, +0.0725, +0.0725 ); + sigma2 = ( 0.0, 0.0, 0.0, 0.0, +1E-6, 0.0, 0.0, 0.0, +1E-6 ); + direction = ( +1.000, +0.000, +0.000 ); + #angle = ( 80.0, 100.0 ); + angle = ( 180.0, 180.0 ); + + }, + + # Microphone 3 + { + mu = ( +0.1250, -0.0725, -0.0725 ); + sigma2 = ( 0.0, 0.0, 0.0, 0.0, +1E-6, 0.0, 0.0, 0.0, +1E-6 ); + direction = ( +1.000, +0.000, +0.000 ); + #angle = ( 80.0, 100.0 ); + angle = ( 180.0, 180.0 ); + + }, + + # Microphone 4 + { + mu = ( +0.1250, +0.0725, -0.0725 ); + sigma2 = ( 0.0, 0.0, 0.0, 0.0, +1E-6, 0.0, 0.0, 0.0, +1E-6 ); + direction = ( +1.000, +0.000, +0.000 ); + #angle = ( 80.0, 100.0 ); + angle = ( 180.0, 180.0 ); + + }, + + # Microphone 5 + { + mu = ( +0.0725, +0.1250, +0.0725 ); + sigma2 = ( +1E-6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, +1E-6 ); + direction = ( +0.000, +1.000, +0.000 ); + #angle = ( 80.0, 100.0 ); + angle = ( 180.0, 180.0 ); + + }, + + # Microphone 6 + { + mu = ( -0.0725, +0.1250, +0.0725 ); + sigma2 = ( +1E-6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, +1E-6 ); + direction = ( +0.000, +1.000, +0.000 ); + #angle = ( 80.0, 100.0 ); + angle = ( 180.0, 180.0 ); + + }, + + # Microphone 7 + { + mu = ( +0.0725, +0.1250, -0.0725 ); + sigma2 = ( +1E-6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, +1E-6 ); + direction = ( +0.000, +1.000, +0.000 ); + #angle = ( 80.0, 100.0 ); + angle = ( 180.0, 180.0 ); + + }, + + # Microphone 8 + { + mu = ( -0.0725, +0.1250, -0.0725 ); + sigma2 = ( +1E-6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, +1E-6 ); + direction = ( +0.000, +1.000, +0.000 ); + #angle = ( 80.0, 100.0 ); + angle = ( 180.0, 180.0 ); + + }, + + # Microphone 9 + { + mu = ( -0.1250, +0.0725, +0.0725 ); + sigma2 = ( 0.0, 0.0, 0.0, 0.0, +1E-6, 0.0, 0.0, 0.0, +1E-6 ); + direction = ( -1.000, +0.000, +0.000 ); + #angle = ( 80.0, 100.0 ); + angle = ( 180.0, 180.0 ); + + }, + + # Microphone 10 + { + mu = ( -0.1250, -0.0725, +0.0725 ); + sigma2 = ( 0.0, 0.0, 0.0, 0.0, +1E-6, 0.0, 0.0, 0.0, +1E-6 ); + direction = ( -1.000, +0.000, +0.000 ); + #angle = ( 80.0, 100.0 ); + angle = ( 180.0, 180.0 ); + + }, + + # Microphone 11 + { + mu = ( -0.1250, +0.0725, -0.0725 ); + sigma2 = ( 0.0, 0.0, 0.0, 0.0, +1E-6, 0.0, 0.0, 0.0, +1E-6 ); + direction = ( -1.000, +0.000, +0.000 ); + #angle = ( 80.0, 100.0 ); + angle = ( 180.0, 180.0 ); + + }, + + # Microphone 12 + { + mu = ( -0.1250, -0.0725, -0.0725 ); + sigma2 = ( 0.0, 0.0, 0.0, 0.0, +1E-6, 0.0, 0.0, 0.0, +1E-6 ); + direction = ( -1.000, +0.000, +0.000 ); + #angle = ( 80.0, 100.0 ); + angle = ( 180.0, 180.0 ); + + }, + + # Microphone 13 + { + mu = ( -0.0725, -0.1250, +0.0725 ); + sigma2 = ( +1E-6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, +1E-6 ); + direction = ( +0.000, -1.000, +0.000 ); + #angle = ( 80.0, 100.0 ); + angle = ( 180.0, 180.0 ); + + }, + + # Microphone 14 + { + mu = ( +0.0725, -0.1250, +0.0725 ); + sigma2 = ( +1E-6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, +1E-6 ); + direction = ( +0.000, -1.000, +0.000 ); + #angle = ( 80.0, 100.0 ); + angle = ( 180.0, 180.0 ); + + }, + + # Microphone 15 + { + mu = ( -0.0725, -0.1250, -0.0725 ); + sigma2 = ( +1E-6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, +1E-6 ); + direction = ( +0.000, -1.000, +0.000 ); + #angle = ( 80.0, 100.0 ); + angle = ( 180.0, 180.0 ); + + }, + + # Microphone 16 + { + mu = ( +0.0725, -0.1250, -0.0725 ); + sigma2 = ( +1E-6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, +1E-6 ); + direction = ( +0.000, -1.000, +0.000 ); + #angle = ( 80.0, 100.0 ); + angle = ( 180.0, 180.0 ); + + } + + ); + + # Spatial filter to include only a range of direction if required + # (may be useful to remove false detections from the floor) + spatialfilters = ( + + { + + direction = ( +0.000, +0.000, +1.000 ); + angle = (80.0, 90.0); + + } + + ); + + nThetas = 181; + gainMin = 0.25; + +}; + +# Stationnary noise estimation + +sne: +{ + + b = 3; + alphaS = 0.1; + L = 150; + delta = 3.0; + alphaD = 0.1; + +} + +# Sound Source Localization + +ssl: +{ + + nPots = 4; + nMatches = 10; + probMin = 0.3; + nRefinedLevels = 1; + interpRate = 1; + + # Number of scans: level is the resolution of the sphere + # and delta is the size of the maximum sliding window + # (delta = -1 means the size is automatically computed) + scans = ( + { level = 2; delta = -1; }, + { level = 4; delta = -1; } + ); + + # Output to export potential sources + potential: { + + format = "undefined"; + + interface: { + type = "blackhole"; + }; + + }; + +}; + +# Sound Source Tracking + +sst: +{ + + # Mode is either "kalman" or "particle" + + mode = "kalman"; + + # Add is either "static" or "dynamic" + + add = "dynamic"; + + # Parameters used by both the Kalman and particle filter + + active = ( + { weight = 1.0; mu = 0.15; sigma2 = 0.0025 } + ); + + inactive = ( + { weight = 1.0; mu = 0.05; sigma2 = 0.0025 } + ); + + sigmaR2_prob = 0.0025; + sigmaR2_active = 0.0225; + sigmaR2_target = 0.0025; + Pfalse = 0.1; + Pnew = 0.1; + Ptrack = 0.8; + + theta_new = 0.9; + N_prob = 5; + theta_prob = 0.8; + N_inactive = ( 150, 200, 250, 250 ); + theta_inactive = 0.9; + + # Parameters used by the Kalman filter only + + kalman: { + + sigmaQ = 0.001; + + }; + + # Parameters used by the particle filter only + + particle: { + + nParticles = 1000; + st_alpha = 2.0; + st_beta = 0.04; + st_ratio = 0.5; + ve_alpha = 0.05; + ve_beta = 0.2; + ve_ratio = 0.3; + ac_alpha = 0.5; + ac_beta = 0.2; + ac_ratio = 0.2; + Nmin = 0.7; + + }; + + target: (); + + # Output to export tracked sources + tracked: { + + format = "undefined"; + + interface: { + type = "blackhole"; + }; + + }; + +} + +sss: +{ + + # Mode is either "dds", "dgss" or "dmvdr" + + mode_sep = "dgss"; + mode_pf = "ms"; + + dds: { + + }; + + dgss: { + + mu = 0.0001; + lambda = 0.5; + + }; + + dmvdr: { + + }; + + ms: { + + alphaPmin = 0.07; + eta = 0.5; + alphaZ = 0.8; + thetaWin = 0.3; + alphaWin = 0.3; + maxAbsenceProb = 0.9; + Gmin = 0.01; + winSizeLocal = 3; + winSizeGlobal = 23; + winSizeFrame = 256; + + }; + + separated: { + + fS = 44100; + hopSize = 512; + nBits = 16; + + interface: { + type = "file"; + path = "separated_cma2.raw"; + } + + }; + + postfiltered: { + + fS = 44100; + hopSize = 512; + nBits = 16; + + interface: { + type = "file"; + path = "postfiltered_cma2.raw"; + } + + }; + +} + +classify: +{ + + frameSize = 1024; + winSize = 3; + tauMin = 32; + tauMax = 200; + deltaTauMax = 7; + alpha = 0.3; + gamma = 0.05; + phiMin = 0.15; + r0 = 0.2; + + category: { + + format = "undefined"; + + interface: { + type = "blackhole"; + } + + } + +} diff --git a/config/odaslive/azimut_oma.cfg b/config/odaslive/azimut_oma.cfg new file mode 100644 index 0000000..7044c9c --- /dev/null +++ b/config/odaslive/azimut_oma.cfg @@ -0,0 +1,408 @@ +# Configuration file for ReSpeaker circular sound card + +version = "2.1"; + +# Raw + +raw: +{ + + fS = 16000; + hopSize = 128; + nBits = 16; + nChannels = 16; + + # Input with raw signal from microphones + interface: { + type = "file"; + path = "input_oma.raw"; + } + +} + +# Mapping + +mapping: +{ + + map: (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + +} + +# General + +general: +{ + + epsilon = 1E-20; + + size: + { + hopSize = 128; + frameSize = 256; + }; + + samplerate: + { + mu = 16000; + sigma2 = 0.01; + }; + + speedofsound: + { + mu = 343.0; + sigma2 = 25.0; + }; + + mics = ( + + # Microphone 1 + { + mu = ( 0.09000, 0.00000, 0.00000 ); + sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); + direction = ( 0.00000, 0.00000, 1.00000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 2 + { + mu = ( 0.11550, -0.04780, 0.00000 ); + sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); + direction = ( 0.00000, 0.00000, 1.00000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 3 + { + mu = ( 0.03540, 0.03540, 0.00000 ); + sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); + direction = ( 0.00000, 0.00000, 1.00000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 4 + { + mu = ( 0.11550, 0.04780, 0.00000 ); + sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); + direction = ( 0.00000, 0.00000, 1.00000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 5 + { + mu = ( 0.03540, -0.03540, 0.00000 ); + sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); + direction = ( 0.00000, 0.00000, 1.00000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 6 + { + mu = ( 0.04780, -0.11550, 0.00000 ); + sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); + direction = ( 0.00000, 0.00000, 1.00000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 7 + { + mu = ( -0.00000, -0.09000, 0.00000 ); + sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); + direction = ( 0.00000, 0.00000, 1.00000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 8 + { + mu = ( -0.04780, -0.11550, 0.00000 ); + sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); + direction = ( 0.00000, 0.00000, 1.00000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 9 + { + mu = ( -0.09000, 0.00000, 0.00000 ); + sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); + direction = ( 0.00000, 0.00000, 1.00000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 10 + { + mu = ( -0.11550, 0.04780, 0.00000 ); + sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); + direction = ( 0.00000, 0.00000, 1.00000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 11 + { + mu = ( -0.03540, -0.03540, 0.00000 ); + sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); + direction = ( 0.00000, 0.00000, 1.00000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 12 + { + mu = ( -0.11550, -0.04780, 0.00000 ); + sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); + direction = ( 0.00000, 0.00000, 1.00000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 13 + { + mu = ( -0.03540, 0.03540, 0.00000 ); + sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); + direction = ( 0.00000, 0.00000, 1.00000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 14 + { + mu = ( -0.04780, 0.11550, 0.00000 ); + sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); + direction = ( 0.00000, 0.00000, 1.00000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 15 + { + mu = ( 0.00000, 0.09000, 0.00000 ); + sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); + direction = ( 0.00000, 0.00000, 1.00000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 16 + { + mu = ( 0.04780, 0.11550, 0.00000 ); + sigma2 = ( 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000010000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000 ); + direction = ( 0.00000, 0.00000, 1.00000 ); + angle = ( 80.0, 100.0 ); + } + + ); + + # Spatial filter to include only a range of direction if required + # (may be useful to remove false detections from the floor) + spatialfilters = ( + + { + + direction = ( +0.000, +0.000, +1.000 ); + angle = (80.0, 90.0); + + } + + ); + + nThetas = 181; + gainMin = 0.25; + +}; + +# Stationnary noise estimation + +sne: +{ + + b = 3; + alphaS = 0.1; + L = 150; + delta = 3.0; + alphaD = 0.1; + +} + +# Sound Source Localization + +ssl: +{ + + nPots = 4; + nMatches = 10; + probMin = 0.3; + nRefinedLevels = 1; + interpRate = 1; + + # Number of scans: level is the resolution of the sphere + # and delta is the size of the maximum sliding window + # (delta = -1 means the size is automatically computed) + scans = ( + { level = 2; delta = -1; }, + { level = 4; delta = -1; } + ); + + # Output to export potential sources + potential: { + + format = "undefined"; + + interface: { + type = "blackhole"; + }; + + }; + +}; + +# Sound Source Tracking + +sst: +{ + + # Mode is either "kalman" or "particle" + + mode = "kalman"; + + # Parameters used by both the Kalman and particle filter + + active = ( + { weight = 1.0; mu = 0.3; sigma2 = 0.0025 } + ); + + inactive = ( + { weight = 1.0; mu = 0.15; sigma2 = 0.0025 } + ); + + sigmaR2_prob = 0.0025; + sigmaR2_active = 0.0225; + Pfalse = 0.1; + Pnew = 0.1; + Ptrack = 0.8; + + theta_new = 0.9; + N_prob = 5; + theta_prob = 0.8; + N_inactive = ( 150, 200, 250, 250 ); + theta_inactive = 0.9; + + # Parameters used by the Kalman filter only + + kalman: { + + sigmaQ = 0.001; + + }; + + # Parameters used by the particle filter only + + particle: { + + nParticles = 1000; + st_alpha = 2.0; + st_beta = 0.04; + st_ratio = 0.5; + ve_alpha = 0.05; + ve_beta = 0.2; + ve_ratio = 0.3; + ac_alpha = 0.5; + ac_beta = 0.2; + ac_ratio = 0.2; + Nmin = 0.7; + + }; + + # Output to export tracked sources + tracked: { + + format = "undefined"; + + interface: { + type = "blackhole"; + }; + + }; + +} + +sss: +{ + + # Mode is either "dds", "dgss" or "dmvdr" + + mode_sep = "dds"; + mode_pf = "ms"; + + dds: { + + }; + + dgss: { + + }; + + dmvdr: { + + }; + + ms: { + + alphaPmin = 0.07; + eta = 0.5; + alphaZ = 0.8; + thetaWin = 0.3; + alphaWin = 0.3; + maxAbsenceProb = 0.9; + Gmin = 0.01; + winSizeLocal = 3; + winSizeGlobal = 23; + winSizeFrame = 256; + + }; + + separated: { + + fS = 44100; + hopSize = 512; + nBits = 16; + + interface: { + type = "file"; + path = "separated_oma.raw"; + } + + }; + + postfiltered: { + + fS = 44100; + hopSize = 512; + nBits = 16; + + interface: { + type = "file"; + path = "postfiltered_oma.raw"; + } + + }; + +} + +classify: +{ + + frameSize = 1024; + winSize = 3; + tauMin = 32; + tauMax = 200; + deltaTauMax = 7; + alpha = 0.3; + gamma = 0.05; + phiMin = 0.15; + r0 = 0.2; + + category: { + + format = "undefined"; + + interface: { + type = "blackhole"; + } + + } + +} diff --git a/config/odaslive/beam.cfg b/config/odaslive/beam.cfg new file mode 100644 index 0000000..af93715 --- /dev/null +++ b/config/odaslive/beam.cfg @@ -0,0 +1,360 @@ +# Configuration file for XMOS circular sound card + +version = "2.1"; + +# Raw + +raw: +{ + + fS = 44100; + hopSize = 512; + nBits = 16; + nChannels = 8; + + # Input from 8SoundsUSB + interface: { + type = "file"; + path = "micsBeam.raw"; + } + +} + +# Mapping + +mapping: +{ + + map: (1, 2, 3, 4, 5, 6, 7, 8); + +} + +# General + +general: +{ + + epsilon = 1E-20; + + size: + { + hopSize = 512; + frameSize = 1024; + }; + + samplerate: + { + mu = 44100; + sigma2 = 0.01; + }; + + speedofsound: + { + mu = 343.0; + sigma2 = 25.0; + }; + + mics = ( + + # Microphone 1 + { + mu = ( +0.085, +0.000, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 2 + { + mu = ( +0.062, -0.062, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 3 + { + mu = ( +0.000, -0.085, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 4 + { + mu = ( -0.062, -0.062, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 5 + { + mu = ( -0.085, +0.000, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 6 + { + mu = ( -0.062, +0.062, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 7 + { + mu = ( +0.000, +0.085, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 8 + { + mu = ( +0.062, +0.062, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + } + + ); + + # Spatial filters to include only a range of direction if required + # (may be useful to remove false detections from the floor, or + # limit the space search to a restricted region) + spatialfilters = ( + + { + + direction = ( +0.000, +0.000, +1.000 ); + angle = (80.0, 90.0); + + } + + ); + + nThetas = 181; + gainMin = 0.25; + +}; + +# Stationnary noise estimation + +sne: +{ + + b = 3; + alphaS = 0.1; + L = 150; + delta = 3.0; + alphaD = 0.1; + +} + +# Sound Source Localization + +ssl: +{ + + nPots = 4; + nMatches = 10; + probMin = 0.5; + nRefinedLevels = 1; + interpRate = 1; + + # Number of scans: level is the resolution of the sphere + # and delta is the size of the maximum sliding window + # (delta = -1 means the size is automatically computed) + scans = ( + { level = 2; delta = -1; }, + { level = 4; delta = -1; } + ); + + # Output to export potential sources + potential: { + + format = "undefined"; + + interface: { + type = "blackhole"; + }; + + }; + +}; + +# Target sources + +# Sound Source Tracking + +sst: +{ + + # Mode is either "kalman" or "particle" + + mode = "kalman"; + + # Add is either "static" or "dynamic" + + add = "dynamic"; + + # Parameters used by both the Kalman and particle filter + + active = ( + { weight = 1.0; mu = 0.25; sigma2 = 0.0020 } + ); + + inactive = ( + { weight = 1.0; mu = 0.05; sigma2 = 0.0020 } + ); + + sigmaR2_prob = 0.0025; + sigmaR2_active = 0.0225; + sigmaR2_target = 0.0025; + Pfalse = 0.1; + Pnew = 0.1; + Ptrack = 0.8; + + theta_new = 0.9; + N_prob = 5; + theta_prob = 0.8; + N_inactive = ( 150, 200, 250, 250 ); + theta_inactive = 0.9; + + # Parameters used by the Kalman filter only + + kalman: { + + sigmaQ = 0.001; + + }; + + # Parameters used by the particle filter only + + particle: { + + nParticles = 1000; + st_alpha = 2.0; + st_beta = 0.04; + st_ratio = 0.5; + ve_alpha = 0.05; + ve_beta = 0.2; + ve_ratio = 0.3; + ac_alpha = 0.5; + ac_beta = 0.2; + ac_ratio = 0.2; + Nmin = 0.7; + + }; + + target: + ( + { tag = "fan"; x = 0.0; y = 0.0; z = 1.0 } + ); + + # Output to export tracked sources + tracked: { + + format = "json"; + + interface: { + type = "terminal"; + }; + + }; + +} + +sss: +{ + + # Mode is either "dds", "dgss" or "dmvdr" + + mode_sep = "dds"; + mode_pf = "ms"; + + dds: { + + }; + + dgss: { + + mu = 0.01; + lambda = 0.5; + + }; + + dmvdr: { + + }; + + ms: { + + alphaPmin = 0.07; + eta = 0.3; + alphaZ = 0.8; + thetaWin = 0.3; + alphaWin = 0.3; + maxAbsenceProb = 0.9; + Gmin = 0.01; + winSizeLocal = 3; + winSizeGlobal = 33; + winSizeFrame = 1024; + + }; + + separated: { + + fS = 44100; + hopSize = 512; + nBits = 16; + + interface: { + type = "file"; + path = "separated.raw"; + } + + }; + + postfiltered: { + + fS = 44100; + hopSize = 512; + nBits = 16; + + interface: { + type = "file"; + path = "postfiltered.raw"; + } + + }; + +} + +classify: +{ + + frameSize = 4096; + winSize = 3; + tauMin = 88; + tauMax = 551; + deltaTauMax = 20; + alpha = 0.3; + gamma = 0.05; + phiMin = 0.5; + r0 = 0.2; + + category: { + + format = "undefined"; + + interface: { + type = "blackhole"; + } + + } + +} diff --git a/config/odaslive/delta1010lt.cfg b/config/odaslive/delta1010lt.cfg new file mode 100644 index 0000000..2886eaf --- /dev/null +++ b/config/odaslive/delta1010lt.cfg @@ -0,0 +1,417 @@ +# Configuration file for M-Audio Delta 1010LT PCI card + +version = "2.1"; + +/* +The M-Audio Delta 1010LT PCI card is an 8-input card that shows up as a single device with a single input channel. +In order to have each of the channels available for use in ODAS, you can create a virtual device with each of the +Delta 1010LT mono inputs as a separate channel, and then use that virtual device for input. This can be done by +putting a configuration such as the following in your ~/.asoundrc or /etc/asound.conf file: + +******************************************************************************************** +# .asoundrc for a Delta 1010LT to have individual record channels +# +# Create virtual devices +# JACK will need MMAP_COMPLEX support to use this. +# ICE1712 chip has 12 capture channels and 10 playback channels. +# No. of channels in slaves must equal 12 for capture and 10 for playback +# otherwise "invalid argument" errors result. + +pcm.multi_capture { + type multi + slaves.a.pcm hw:0 + slaves.a.channels 12 + +# First 8 channels of first soundcard (capture) + bindings.0.slave a + bindings.0.channel 0 + bindings.1.slave a + bindings.1.channel 1 + bindings.2.slave a + bindings.2.channel 2 + bindings.3.slave a + bindings.3.channel 3 + bindings.4.slave a + bindings.4.channel 4 + bindings.5.slave a + bindings.5.channel 5 + bindings.6.slave a + bindings.6.channel 6 + bindings.7.slave a + bindings.7.channel 7 + +} + +ctl.multi_capture { + type hw + card 0 +} +******************************************************************************************** + +This configuration presumes that your card is showing up as hardware device 0. If it is not you will need to adjust the +"hw:0" and "card 0" configuration. Once that configuration is in place, you should be able to use the settings below for +ODAS. + +*/ + +# Raw + +raw: +{ + + fS = 44100; + hopSize = 128; + nBits = 32; + nChannels = 8; + + # Input with raw signal from microphones + interface: { + type = "soundcard_name"; + devicename = "multi_capture"; + } + +} + +# Mapping + +mapping: +{ + + map: (1, 2, 3, 4, 5, 6, 7, 8); + +} + +# General + +general: +{ + + epsilon = 1E-20; + + size: + { + hopSize = 128; + frameSize = 256; + }; + + samplerate: + { + mu = 44100; + sigma2 = 0.01; + }; + + speedofsound: + { + mu = 343.0; + sigma2 = 25.0; + }; + + mics = ( + + # Microphone 1 + { + mu = ( +0.0000, +0.0000, +0.0000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 90.0 ); + }, + + # Microphone 2 + { + mu = ( -0.0160, +0.0277, +0.0000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 90.0 ); + }, + + # Microphone 3 + { + mu = ( -0.0320, +0.0000, +0.0000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 90.0 ); + }, + + # Microphone 4 + { + mu = ( -0.0160, -0.0277, +0.0000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 90.0 ); + }, + + # Microphone 5 + { + mu = ( +0.0160, -0.0277, +0.0000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 90.0 ); + }, + + # Microphone 6 + { + mu = ( +0.0320, +0.0000, +0.0000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 90.0 ); + }, + + # Microphone 7 + { + mu = ( +0.0160, +0.0277, +0.0000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 90.0 ); + }, + + # Microphone 8 + { + mu = ( +0.0160, +0.0277, +0.0000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 90.0 ); + } + + ); + + # Spatial filter to include only a range of direction if required + # (may be useful to remove false detections from the floor) + spatialfilters = ( + + { + + direction = ( +0.000, +0.000, +1.000 ); + angle = (80.0, 90.0); + + } + + ); + + nThetas = 181; + gainMin = 0.25; + +}; + +# Stationnary noise estimation + +sne: +{ + + b = 3; + alphaS = 0.1; + L = 150; + delta = 3.0; + alphaD = 0.1; + +} + +# Sound Source Localization + +ssl: +{ + + nPots = 4; + nMatches = 10; + probMin = 0.5; + nRefinedLevels = 1; + interpRate = 4; + + # Number of scans: level is the resolution of the sphere + # and delta is the size of the maximum sliding window + # (delta = -1 means the size is automatically computed) + scans = ( + { level = 2; delta = -1; }, + { level = 4; delta = -1; } + ); + + # Output to export potential sources + potential: { + + format = "undefined"; + + interface: { + type = "blackhole"; + }; + + }; + +}; + +# Sound Source Tracking + +sst: +{ + + # Mode is either "kalman" or "particle" + + mode = "kalman"; + + # Add is either "static" or "dynamic" + + add = "dynamic"; + + # Parameters used by both the Kalman and particle filter + + active = ( + { weight = 1.0; mu = 0.3; sigma2 = 0.0025 } + ); + + inactive = ( + { weight = 1.0; mu = 0.15; sigma2 = 0.0025 } + ); + + sigmaR2_prob = 0.0025; + sigmaR2_active = 0.0225; + sigmaR2_target = 0.0025; + Pfalse = 0.1; + Pnew = 0.1; + Ptrack = 0.8; + + theta_new = 0.9; + N_prob = 5; + theta_prob = 0.8; + N_inactive = ( 150, 200, 250, 250 ); + theta_inactive = 0.9; + + # Parameters used by the Kalman filter only + + kalman: { + + sigmaQ = 0.001; + + }; + + # Parameters used by the particle filter only + + particle: { + + nParticles = 1000; + st_alpha = 2.0; + st_beta = 0.04; + st_ratio = 0.5; + ve_alpha = 0.05; + ve_beta = 0.2; + ve_ratio = 0.3; + ac_alpha = 0.5; + ac_beta = 0.2; + ac_ratio = 0.2; + Nmin = 0.7; + + }; + + target: (); + + # Output to export tracked sources + tracked: { + + format = "undefined"; + + interface: { + type = "blackhole"; + }; + + }; + +} + +sss: +{ + + # Mode is either "dds", "dgss" or "dmvdr" + + mode_sep = "dds"; + mode_pf = "ms"; + + gain_sep = 1.0; + gain_pf = 10.0; + + dds: { + + }; + + dgss: { + + mu = 0.01; + lambda = 0.5; + + }; + + dmvdr: { + + }; + + ms: { + + alphaPmin = 0.07; + eta = 0.5; + alphaZ = 0.8; + thetaWin = 0.3; + alphaWin = 0.3; + maxAbsenceProb = 0.9; + Gmin = 0.01; + winSizeLocal = 3; + winSizeGlobal = 23; + winSizeFrame = 256; + + }; + + ss: { + + Gmin = 0.01; + Gmid = 0.9; + Gslope = 10.0; + + } + + separated: { + + fS = 44100; + hopSize = 512; + nBits = 16; + + interface: { + type = "file"; + path = "separated.raw"; + } + + }; + + postfiltered: { + + fS = 44100; + hopSize = 512; + nBits = 16; + + interface: { + type = "file"; + path = "postfiltered.raw"; + } + + }; + +} + +classify: +{ + + frameSize = 1024; + winSize = 3; + tauMin = 32; + tauMax = 200; + deltaTauMax = 7; + alpha = 0.3; + gamma = 0.05; + phiMin = 0.15; + r0 = 0.2; + + category: { + + format = "undefined"; + + interface: { + type = "blackhole"; + } + + } + +} diff --git a/config/odaslive/matrix_creator.cfg b/config/odaslive/matrix_creator.cfg new file mode 100644 index 0000000..65ed718 --- /dev/null +++ b/config/odaslive/matrix_creator.cfg @@ -0,0 +1,372 @@ +# Configuration file for MATRIX Creator Raspberry Pi shield + +version = "2.1"; + +# Raw + +raw: +{ + + fS = 48000; + hopSize = 512; + nBits = 16; + nChannels = 8; + + # Input with raw signal from microphones + interface: { + type = "soundcard"; + card = 2; + device = 0; + } + +} + +# Mapping + +mapping: +{ + + map: (1, 2, 3, 4, 5, 6, 7, 8); + +} + +# General + +general: +{ + + epsilon = 1E-20; + + size: + { + hopSize = 128; + frameSize = 256; + }; + + samplerate: + { + mu = 16000; + sigma2 = 0.01; + }; + + speedofsound: + { + mu = 343.0; + sigma2 = 25.0; + }; + + mics = ( + + # Microphone 1 + { + mu = ( +0.020091, -0.048504, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 2 + { + mu = ( -0.020091, -0.048504, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 3 + { + mu = ( -0.048504, -0.020091, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 4 + { + mu = ( -0.048504, +0.020091, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 5 + { + mu = ( -0.020091, +0.048504, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 6 + { + mu = ( +0.020091, +0.048504, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 7 + { + mu = ( +0.048504, +0.020091, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 8 + { + mu = ( +0.048504, -0.020091, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + } + + ); + + # Spatial filter to include only a range of direction if required + # (may be useful to remove false detections from the floor) + spatialfilters = ( + + { + + direction = ( +0.000, +0.000, +1.000 ); + angle = (80.0, 100.0); + + } + + ); + + nThetas = 181; + gainMin = 0.25; + +}; + +# Stationnary noise estimation + +sne: +{ + + b = 3; + alphaS = 0.1; + L = 150; + delta = 3.0; + alphaD = 0.1; + +} + +# Sound Source Localization + +ssl: +{ + + nPots = 4; + nMatches = 10; + probMin = 0.5; + nRefinedLevels = 1; + interpRate = 4; + + # Number of scans: level is the resolution of the sphere + # and delta is the size of the maximum sliding window + # (delta = -1 means the size is automatically computed) + scans = ( + { level = 2; delta = -1; }, + { level = 4; delta = -1; } + ); + + # Output to export potential sources + potential: { + + format = "json"; + interface: { + type = "socket"; + ip = ""; + port = 9001; + }; + + }; + +}; + +# Sound Source Tracking + +sst: +{ + + # Mode is either "kalman" or "particle" + + mode = "kalman"; + + # Add is either "static" or "dynamic" + + add = "dynamic"; + + # Parameters used by both the Kalman and particle filter + + active = ( + { weight = 1.0; mu = 0.4; sigma2 = 0.0025 } + ); + + inactive = ( + { weight = 1.0; mu = 0.25; sigma2 = 0.0025 } + ); + + sigmaR2_prob = 0.0025; + sigmaR2_active = 0.0225; + sigmaR2_target = 0.0025; + Pfalse = 0.1; + Pnew = 0.1; + Ptrack = 0.8; + + theta_new = 0.9; + N_prob = 5; + theta_prob = 0.8; + N_inactive = ( 250, 250, 250, 250 ); + theta_inactive = 0.9; + + # Parameters used by the Kalman filter only + + kalman: { + + sigmaQ = 0.001; + + }; + + # Parameters used by the particle filter only + + particle: { + + nParticles = 1000; + st_alpha = 2.0; + st_beta = 0.04; + st_ratio = 0.5; + ve_alpha = 0.05; + ve_beta = 0.2; + ve_ratio = 0.3; + ac_alpha = 0.5; + ac_beta = 0.2; + ac_ratio = 0.2; + Nmin = 0.7; + + }; + + target: (); + + # Output to export tracked sources + tracked: { + + format = "json"; + + interface: { + type = "socket"; + ip = ""; + port = 9000; + }; + + }; + +} + +sss: +{ + + # Mode is either "dds", "dgss" or "dmvdr" + + mode_sep = "dds"; + mode_pf = "ss"; + + gain_sep = 1.0; + gain_pf = 10.0; + + dds: { + + }; + + dgss: { + + mu = 0.01; + lambda = 0.5; + + }; + + dmvdr: { + + }; + + ms: { + + alphaPmin = 0.07; + eta = 0.5; + alphaZ = 0.8; + thetaWin = 0.3; + alphaWin = 0.3; + maxAbsenceProb = 0.9; + Gmin = 0.01; + winSizeLocal = 3; + winSizeGlobal = 23; + winSizeFrame = 256; + + }; + + ss: { + + Gmin = 0.01; + Gmid = 0.5; + Gslope = 10.0; + + } + + separated: { + + fS = 16000; + hopSize = 128; + nBits = 16; + + interface: { + type = "socket"; + ip = ""; + port = 10000; + } + + }; + + postfiltered: { + + fS = 16000; + hopSize = 128; + nBits = 16; + gain = 10.0; + + interface: { + type = "socket"; + ip = ""; + port = 10010; + } + + }; + +}; + +classify: +{ + + frameSize = 4096; + winSize = 3; + tauMin = 88; + tauMax = 551; + deltaTauMax = 20; + alpha = 0.3; + gamma = 0.05; + phiMin = 0.5; + r0 = 0.2; + + category: { + + format = "undefined"; + + interface: { + type = "blackhole"; + } + + } + +} diff --git a/config/odaslive/matrix_voice.cfg b/config/odaslive/matrix_voice.cfg new file mode 100644 index 0000000..90b0c79 --- /dev/null +++ b/config/odaslive/matrix_voice.cfg @@ -0,0 +1,373 @@ +# Configuration file for MATRIX Voice Raspberry Pi shield + +version = "2.1"; + +# Raw + +raw: +{ + + fS = 48000; + hopSize = 512; + nBits = 16; + nChannels = 8; + + # Input with raw signal from microphones + interface: { + type = "soundcard"; + card = 2; + device = 0; + } + +} + +# Mapping + +mapping: +{ + + map: (1, 2, 3, 4, 5, 6, 7, 8); + +} + +# General + +general: +{ + + epsilon = 1E-20; + + size: + { + hopSize = 128; + frameSize = 256; + }; + + samplerate: + { + mu = 16000; + sigma2 = 0.01; + }; + + speedofsound: + { + mu = 343.0; + sigma2 = 25.0; + }; + + mics = ( + + # Microphone 1 + { + mu = ( +0.000, +0.000, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 2 + { + mu = ( -0.038133, +0.003576, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 3 + { + mu = ( -0.020980, +0.032043, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 4 + { + mu = ( +0.011971, +0.036381, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 5 + { + mu = ( +0.035908, +0.013323, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 6 + { + mu = ( +0.032805, -0.019767, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 7 + { + mu = ( +0.004999, -0.037972, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 8 + { + mu = ( -0.026571, -0.027584, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + } + + ); + + # Spatial filters to include only a range of direction if required + # (may be useful to remove false detections from the floor, or + # limit the space search to a restricted region) + spatialfilters = ( + + { + + direction = ( +0.000, +0.000, +1.000 ); + angle = (80.0, 90.0); + + } + + ); + + nThetas = 181; + gainMin = 0.25; + +}; + +# Stationnary noise estimation + +sne: +{ + + b = 3; + alphaS = 0.1; + L = 150; + delta = 3.0; + alphaD = 0.1; + +} + +# Sound Source Localization + +ssl: +{ + + nPots = 4; + nMatches = 10; + probMin = 0.5; + nRefinedLevels = 1; + interpRate = 4; + + # Number of scans: level is the resolution of the sphere + # and delta is the size of the maximum sliding window + # (delta = -1 means the size is automatically computed) + scans = ( + { level = 2; delta = -1; }, + { level = 4; delta = -1; } + ); + + # Output to export potential sources + potential: { + + format = "json"; + interface: { + type = "socket"; + ip = ""; + port = 9001; + }; + + }; + +}; + +# Sound Source Tracking + +sst: +{ + + # Mode is either "kalman" or "particle" + + mode = "kalman"; + + # Add is either "static" or "dynamic" + + add = "dynamic"; + + # Parameters used by both the Kalman and particle filter + + active = ( + { weight = 1.0; mu = 0.4; sigma2 = 0.0025 } + ); + + inactive = ( + { weight = 1.0; mu = 0.25; sigma2 = 0.0025 } + ); + + sigmaR2_prob = 0.0025; + sigmaR2_active = 0.0225; + sigmaR2_target = 0.0025; + Pfalse = 0.1; + Pnew = 0.1; + Ptrack = 0.8; + + theta_new = 0.9; + N_prob = 5; + theta_prob = 0.8; + N_inactive = ( 250, 250, 250, 250 ); + theta_inactive = 0.9; + + # Parameters used by the Kalman filter only + + kalman: { + + sigmaQ = 0.001; + + }; + + # Parameters used by the particle filter only + + particle: { + + nParticles = 1000; + st_alpha = 2.0; + st_beta = 0.04; + st_ratio = 0.5; + ve_alpha = 0.05; + ve_beta = 0.2; + ve_ratio = 0.3; + ac_alpha = 0.5; + ac_beta = 0.2; + ac_ratio = 0.2; + Nmin = 0.7; + + }; + + target: (); + + # Output to export tracked sources + tracked: { + + format = "json"; + + interface: { + type = "socket"; + ip = ""; + port = 9000; + }; + + }; + +} + +sss: +{ + + # Mode is either "dds", "dgss" or "dmvdr" + + mode_sep = "dds"; + mode_pf = "ss"; + + gain_sep = 1.0; + gain_pf = 10.0; + + dds: { + + }; + + dgss: { + + mu = 0.01; + lambda = 0.5; + + }; + + dmvdr: { + + }; + + ms: { + + alphaPmin = 0.07; + eta = 0.5; + alphaZ = 0.8; + thetaWin = 0.3; + alphaWin = 0.3; + maxAbsenceProb = 0.9; + Gmin = 0.01; + winSizeLocal = 3; + winSizeGlobal = 23; + winSizeFrame = 256; + + }; + + ss: { + + Gmin = 0.01; + Gmid = 0.5; + Gslope = 10.0; + + } + + separated: { + + fS = 16000; + hopSize = 128; + nBits = 16; + + interface: { + type = "socket"; + ip = ""; + port = 10000; + } + + }; + + postfiltered: { + + fS = 16000; + hopSize = 128; + nBits = 16; + gain = 10.0; + + interface: { + type = "socket"; + ip = ""; + port = 10010; + } + + }; + +}; + +classify: +{ + + frameSize = 4096; + winSize = 3; + tauMin = 88; + tauMax = 551; + deltaTauMax = 20; + alpha = 0.3; + gamma = 0.05; + phiMin = 0.5; + r0 = 0.2; + + category: { + + format = "undefined"; + + interface: { + type = "blackhole"; + } + + } + +} diff --git a/config/odaslive/minidsp.cfg b/config/odaslive/minidsp.cfg new file mode 100644 index 0000000..d47d321 --- /dev/null +++ b/config/odaslive/minidsp.cfg @@ -0,0 +1,360 @@ +# Configuration file for XMOS circular sound card + +version = "2.1"; + +# Raw + +raw: +{ + + fS = 48000; + hopSize = 512; + nBits = 32; + nChannels = 8; + + # Input with raw signal from microphones + interface: { + type = "soundcard"; + card = 2; + device = 0; + } + +} + +# Mapping + +mapping: +{ + + map: (1, 2, 3, 4, 5, 6, 7); + +} + +# General + +general: +{ + + epsilon = 1E-20; + + size: + { + hopSize = 128; + frameSize = 256; + }; + + samplerate: + { + mu = 16000; + sigma2 = 0.01; + }; + + speedofsound: + { + mu = 343.0; + sigma2 = 25.0; + }; + + mics = ( + + # Microphone 0 + { + mu = ( +0.000, +0.000, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 90.0, 100.0 ); + }, + + # Microphone 1 + { + mu = ( +0.000, +0.043, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 90.0, 100.0 ); + }, + + # Microphone 2 + { + mu = ( +0.037, +0.021, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 90.0, 100.0 ); + }, + + # Microphone 3 + { + mu = ( +0.037, -0.021, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 90.0, 100.0 ); + }, + + # Microphone 4 + { + mu = ( +0.000, -0.043, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 90.0, 100.0 ); + }, + + # Microphone 5 + { + mu = ( -0.037, -0.021, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 90.0, 100.0 ); + }, + + # Microphone 6 + { + mu = ( -0.037, +0.021, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 90.0, 100.0 ); + } + + ); + + # Spatial filters to include only a range of direction if required + # (may be useful to remove false detections from the floor, or + # limit the space search to a restricted region) + spatialfilters = ( + + { + + direction = ( +0.000, +0.000, +1.000 ); + angle = (90.0, 95.0); + + } + + ); + + nThetas = 181; + gainMin = 0.25; + +}; + +# Stationnary noise estimation + +sne: +{ + + b = 3; + alphaS = 0.1; + L = 150; + delta = 3.0; + alphaD = 0.1; + +} + +# Sound Source Localization + +ssl: +{ + + nPots = 4; + nMatches = 10; + probMin = 0.5; + nRefinedLevels = 1; + interpRate = 4; + + # Number of scans: level is the resolution of the sphere + # and delta is the size of the maximum sliding window + # (delta = -1 means the size is automatically computed) + scans = ( + { level = 2; delta = -1; }, + { level = 4; delta = -1; } + ); + + # Output to export potential sources + potential: { + + format = "undefined"; + + interface: { + type = "blackhole"; + }; + + }; + +}; + +# Sound Source Tracking + +sst: +{ + + # Mode is either "kalman" or "particle" + + mode = "kalman"; + + # Add is either "static" or "dynamic" + + add = "dynamic"; + + # Parameters used by both the Kalman and particle filter + + active = ( + { weight = 1.0; mu = 0.4; sigma2 = 0.0025 } + ); + + inactive = ( + { weight = 1.0; mu = 0.25; sigma2 = 0.0025 } + ); + + sigmaR2_prob = 0.0025; + sigmaR2_active = 0.0225; + sigmaR2_target = 0.0025; + Pfalse = 0.1; + Pnew = 0.1; + Ptrack = 0.8; + + theta_new = 0.3; + N_prob = 5; + theta_prob = 0.8; + N_inactive = ( 150, 150, 150, 150 ); + theta_inactive = 0.9; + + # Parameters used by the Kalman filter only + + kalman: { + + sigmaQ = 0.001; + + }; + + # Parameters used by the particle filter only + + particle: { + + nParticles = 1000; + st_alpha = 2.0; + st_beta = 0.04; + st_ratio = 0.5; + ve_alpha = 0.05; + ve_beta = 0.2; + ve_ratio = 0.3; + ac_alpha = 0.5; + ac_beta = 0.2; + ac_ratio = 0.2; + Nmin = 0.7; + + }; + + target: (); + + # Output to export tracked sources + tracked: { + + format = "json"; + + interface: { + type = "terminal"; + }; + + }; + +} + +sss: +{ + + # Mode is either "dds", "dgss" or "dmvdr" + + mode_sep = "dds"; + mode_pf = "ss"; + + gain_sep = 1.0; + gain_pf = 10.0; + + dds: { + + }; + + dgss: { + + mu = 0.01; + lambda = 0.5; + + }; + + dmvdr: { + + }; + + ms: { + + alphaPmin = 0.07; + eta = 0.5; + alphaZ = 0.8; + thetaWin = 0.3; + alphaWin = 0.3; + maxAbsenceProb = 0.9; + Gmin = 0.01; + winSizeLocal = 3; + winSizeGlobal = 23; + winSizeFrame = 256; + + }; + + ss: { + + Gmin = 0.01; + Gmid = 0.5; + Gslope = 10.0; + + } + + separated: { + + fS = 16000; + hopSize = 128; + nBits = 16; + + interface: { + type = "file"; + path = "test_separated.raw"; + }; + + }; + + postfiltered: { + + fS = 16000; + hopSize = 128; + nBits = 16; + gain = 10.0; + + interface: { + type = "file"; + path = "test_postfiltered.raw"; + }; + + }; + +}; + +classify: +{ + + frameSize = 4096; + winSize = 3; + tauMin = 88; + tauMax = 551; + deltaTauMax = 20; + alpha = 0.3; + gamma = 0.05; + phiMin = 0.5; + r0 = 0.2; + + category: { + + format = "undefined"; + + interface: { + type = "blackhole"; + } + + } + +} diff --git a/config/odaslive/pepper.cfg b/config/odaslive/pepper.cfg new file mode 100644 index 0000000..f24e100 --- /dev/null +++ b/config/odaslive/pepper.cfg @@ -0,0 +1,336 @@ +# Configuration file for the Aldebaran Pepper Robot + +version = "2.1"; + +# Raw + +raw: +{ + + fS = 48000; + hopSize = 512; + nBits = 16; + nChannels = 4; + + # Input with raw signal from microphones + interface: { + type = "soundcard_name"; + devicename = "AD1989A_inputs"; + } + +} + +# Mapping + +mapping: +{ + + map: (1, 2, 3, 4); + +} + +# General + +general: +{ + + epsilon = 1E-20; + + size: + { + hopSize = 128; + frameSize = 256; + }; + + samplerate: + { + mu = 16000; + sigma2 = 0.01; + }; + + speedofsound: + { + mu = 343.0; + sigma2 = 25.0; + }; + + mics = ( + + # Microphone 1 + { + mu = ( -0.0267, +0.0343, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 2 + { + mu = ( -0.0267, -0.0343, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 3 + { + mu = ( +0.0313, +0.0343, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 4 + { + mu = ( +0.0313, -0.0343, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + } + + ); + + # Spatial filters to include only a range of direction if required + # (may be useful to remove false detections from the floor, or + # limit the space search to a restricted region) + spatialfilters = ( + + { + + direction = ( +0.000, +0.000, +1.000 ); + angle = (80.0, 90.0); + + } + + ); + + nThetas = 181; + gainMin = 0.25; + +}; + +# Stationnary noise estimation + +sne: +{ + + b = 3; + alphaS = 0.1; + L = 150; + delta = 3.0; + alphaD = 0.1; + +} + +# Sound Source Localization + +ssl: +{ + + nPots = 4; + nMatches = 10; + probMin = 0.5; + nRefinedLevels = 1; + interpRate = 4; + + # Number of scans: level is the resolution of the sphere + # and delta is the size of the maximum sliding window + # (delta = -1 means the size is automatically computed) + scans = ( + { level = 2; delta = -1; }, + { level = 4; delta = -1; } + ); + + # Output to export potential sources + potential: { + + format = "undefined"; + + interface: { + type = "blackhole"; + }; + + }; + +}; + +# Sound Source Tracking + +sst: +{ + + # Mode is either "kalman" or "particle" + + mode = "kalman"; + + # Add is either "static" or "dynamic" + + add = "dynamic"; + + # Parameters used by both the Kalman and particle filter + + active = ( + { weight = 1.0; mu = 0.4; sigma2 = 0.0025 } + ); + + inactive = ( + { weight = 1.0; mu = 0.25; sigma2 = 0.0025 } + ); + + sigmaR2_prob = 0.0025; + sigmaR2_active = 0.0225; + sigmaR2_target = 0.0025; + Pfalse = 0.1; + Pnew = 0.1; + Ptrack = 0.8; + + theta_new = 0.9; + N_prob = 5; + theta_prob = 0.8; + N_inactive = ( 250, 250, 250, 250 ); + theta_inactive = 0.9; + + # Parameters used by the Kalman filter only + + kalman: { + + sigmaQ = 0.001; + + }; + + # Parameters used by the particle filter only + + particle: { + + nParticles = 1000; + st_alpha = 2.0; + st_beta = 0.04; + st_ratio = 0.5; + ve_alpha = 0.05; + ve_beta = 0.2; + ve_ratio = 0.3; + ac_alpha = 0.5; + ac_beta = 0.2; + ac_ratio = 0.2; + Nmin = 0.7; + + }; + + target: (); + + # Output to export tracked sources + tracked: { + + format = "json"; + + interface: { + type = "file"; + path = "tracks.txt"; + }; + + }; + +} + +sss: +{ + + # Mode is either "dds", "dgss" or "dmvdr" + + mode_sep = "dds"; + mode_pf = "ss"; + + gain_sep = 1.0; + gain_pf = 10.0; + + dds: { + + }; + + dgss: { + + mu = 0.01; + lambda = 0.5; + + }; + + dmvdr: { + + }; + + ms: { + + alphaPmin = 0.07; + eta = 0.5; + alphaZ = 0.8; + thetaWin = 0.3; + alphaWin = 0.3; + maxAbsenceProb = 0.9; + Gmin = 0.01; + winSizeLocal = 3; + winSizeGlobal = 23; + winSizeFrame = 256; + + }; + + ss: { + + Gmin = 0.01; + Gmid = 0.5; + Gslope = 10.0; + + } + + separated: { + + fS = 16000; + hopSize = 128; + nBits = 16; + + interface: { + type = "file"; + path = "separated.raw"; + }; + + }; + + postfiltered: { + + fS = 16000; + hopSize = 128; + nBits = 16; + gain = 10.0; + + interface: { + type = "file"; + path = "postfiltered.raw"; + }; + + }; + +}; + +classify: +{ + + frameSize = 4096; + winSize = 3; + tauMin = 88; + tauMax = 551; + deltaTauMax = 20; + alpha = 0.3; + gamma = 0.05; + phiMin = 0.5; + r0 = 0.2; + + category: { + + format = "undefined"; + + interface: { + type = "blackhole"; + } + + } + +} diff --git a/config/odaslive/pseye.cfg b/config/odaslive/pseye.cfg new file mode 100644 index 0000000..8dd8dec --- /dev/null +++ b/config/odaslive/pseye.cfg @@ -0,0 +1,343 @@ +# Configuration file for XMOS circular sound card + +version = "2.1"; + +# Raw + +raw: +{ + + fS = 48000; + hopSize = 512; + nBits = 16; + nChannels = 4; + + # Input with raw signal from microphones + interface: { + type = "soundcard"; + card = 2; + device = 0; + } + +} + +# Mapping + +mapping: +{ + + map: (1, 2, 3, 4); + +} + +# General + +general: +{ + + epsilon = 1E-20; + + size: + { + hopSize = 128; + frameSize = 256; + }; + + samplerate: + { + mu = 16000; + sigma2 = 0.01; + }; + + speedofsound: + { + mu = 343.0; + sigma2 = 25.0; + }; + + mics = ( + + # Microphone 0 + { + mu = ( +0.000, -0.030, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +1.000, +0.000, +0.000 ); + angle = ( 90.0, 100.0 ); + }, + + # Microphone 1 + { + mu = ( +0.000, +0.010, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +1.000, +0.000, +0.000 ); + angle = ( 90.0, 100.0 ); + }, + + # Microphone 2 + { + mu = ( +0.000, +0.010, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +1.000, +0.000, +0.000 ); + angle = ( 90.0, 100.0 ); + }, + + # Microphone 3 + { + mu = ( +0.000, +0.030, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +1.000, +0.000, +0.000 ); + angle = ( 90.0, 100.0 ); + } + + ); + + # Spatial filters to include only a range of direction if required + # (may be useful to remove false detections from the floor, or + # limit the space search to a restricted region) + spatialfilters = ( + + { + + direction = ( +0.000, +0.000, +1.000 ); + angle = (90.0, 95.0); + + }, + + { + + direction = ( +0.000, +0.000, -1.000 ); + angle = (90.0, 95.0); + + } + + ); + + nThetas = 181; + gainMin = 0.25; + +}; + +# Stationnary noise estimation + +sne: +{ + + b = 3; + alphaS = 0.1; + L = 150; + delta = 3.0; + alphaD = 0.1; + +} + +# Sound Source Localization + +ssl: +{ + + nPots = 4; + nMatches = 10; + probMin = 0.5; + nRefinedLevels = 1; + interpRate = 4; + + # Number of scans: level is the resolution of the sphere + # and delta is the size of the maximum sliding window + # (delta = -1 means the size is automatically computed) + scans = ( + { level = 2; delta = -1; }, + { level = 4; delta = -1; } + ); + + # Output to export potential sources + potential: { + + format = "undefined"; + + interface: { + type = "blackhole"; + }; + + }; + +}; + +# Sound Source Tracking + +sst: +{ + + # Mode is either "kalman" or "particle" + + mode = "kalman"; + + # Add is either "static" or "dynamic" + + add = "dynamic"; + + # Parameters used by both the Kalman and particle filter + + active = ( + { weight = 1.0; mu = 0.4; sigma2 = 0.0025 } + ); + + inactive = ( + { weight = 1.0; mu = 0.25; sigma2 = 0.0025 } + ); + + sigmaR2_prob = 0.0025; + sigmaR2_active = 0.0225; + sigmaR2_target = 0.0025; + Pfalse = 0.1; + Pnew = 0.1; + Ptrack = 0.8; + + theta_new = 0.3; + N_prob = 5; + theta_prob = 0.8; + N_inactive = ( 150, 150, 150, 150 ); + theta_inactive = 0.9; + + # Parameters used by the Kalman filter only + + kalman: { + + sigmaQ = 0.001; + + }; + + # Parameters used by the particle filter only + + particle: { + + nParticles = 1000; + st_alpha = 2.0; + st_beta = 0.04; + st_ratio = 0.5; + ve_alpha = 0.05; + ve_beta = 0.2; + ve_ratio = 0.3; + ac_alpha = 0.5; + ac_beta = 0.2; + ac_ratio = 0.2; + Nmin = 0.7; + + }; + + target: (); + + # Output to export tracked sources + tracked: { + + format = "json"; + + interface: { + type = "terminal"; + }; + + }; + +} + +sss: +{ + + # Mode is either "dds", "dgss" or "dmvdr" + + mode_sep = "dds"; + mode_pf = "ss"; + + gain_sep = 1.0; + gain_pf = 10.0; + + dds: { + + }; + + dgss: { + + mu = 0.01; + lambda = 0.5; + + }; + + dmvdr: { + + }; + + ms: { + + alphaPmin = 0.07; + eta = 0.5; + alphaZ = 0.8; + thetaWin = 0.3; + alphaWin = 0.3; + maxAbsenceProb = 0.9; + Gmin = 0.01; + winSizeLocal = 3; + winSizeGlobal = 23; + winSizeFrame = 256; + + }; + + ss: { + + Gmin = 0.01; + Gmid = 0.5; + Gslope = 10.0; + + } + + separated: { + + fS = 16000; + hopSize = 128; + nBits = 16; + + interface: { + type = "file"; + path = "test_separated.raw"; + }; + + }; + + postfiltered: { + + fS = 16000; + hopSize = 128; + nBits = 16; + gain = 10.0; + + interface: { + type = "file"; + path = "test_postfiltered.raw"; + }; + + }; + +}; + +classify: +{ + + frameSize = 4096; + winSize = 3; + tauMin = 88; + tauMax = 551; + deltaTauMax = 20; + alpha = 0.3; + gamma = 0.05; + phiMin = 0.5; + r0 = 0.2; + + category: { + + format = "undefined"; + + interface: { + type = "blackhole"; + } + + } + +} diff --git a/config/odaslive/respeaker.cfg b/config/odaslive/respeaker.cfg new file mode 100644 index 0000000..69d6d0d --- /dev/null +++ b/config/odaslive/respeaker.cfg @@ -0,0 +1,359 @@ +# Configuration file for ReSpeaker circular sound card + +version = "2.1"; + +# Raw + +raw: +{ + + fS = 16000; + hopSize = 128; + nBits = 16; + nChannels = 8; + + # Input with raw signal from microphones + interface: { + type = "soundcard"; + card = 3; + device = 0; + } + +} + +# Mapping + +mapping: +{ + + map: (1, 2, 3, 4, 5, 6, 7); + +} + +# General + +general: +{ + + epsilon = 1E-20; + + size: + { + hopSize = 128; + frameSize = 256; + }; + + samplerate: + { + mu = 16000; + sigma2 = 0.01; + }; + + speedofsound: + { + mu = 343.0; + sigma2 = 25.0; + }; + + mics = ( + + # Microphone 1 + { + mu = ( +0.0000, +0.0000, +0.0000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 90.0 ); + }, + + # Microphone 2 + { + mu = ( -0.0160, +0.0277, +0.0000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 90.0 ); + }, + + # Microphone 3 + { + mu = ( -0.0320, +0.0000, +0.0000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 90.0 ); + }, + + # Microphone 4 + { + mu = ( -0.0160, -0.0277, +0.0000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 90.0 ); + }, + + # Microphone 5 + { + mu = ( +0.0160, -0.0277, +0.0000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 90.0 ); + }, + + # Microphone 6 + { + mu = ( +0.0320, +0.0000, +0.0000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 90.0 ); + }, + + # Microphone 7 + { + mu = ( +0.0160, +0.0277, +0.0000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 90.0 ); + } + + ); + + # Spatial filters to include only a range of direction if required + # (may be useful to remove false detections from the floor, or + # limit the space search to a restricted region) + spatialfilters = ( + + { + + direction = ( +0.000, +0.000, +1.000 ); + angle = (80.0, 90.0); + + } + + ); + + nThetas = 181; + gainMin = 0.25; + +}; + +# Stationnary noise estimation + +sne: +{ + + b = 3; + alphaS = 0.1; + L = 150; + delta = 3.0; + alphaD = 0.1; + +} + +# Sound Source Localization + +ssl: +{ + + nPots = 4; + nMatches = 10; + probMin = 0.5; + nRefinedLevels = 1; + interpRate = 4; + + # Number of scans: level is the resolution of the sphere + # and delta is the size of the maximum sliding window + # (delta = -1 means the size is automatically computed) + scans = ( + { level = 2; delta = -1; }, + { level = 4; delta = -1; } + ); + + # Output to export potential sources + potential: { + + format = "undefined"; + + interface: { + type = "blackhole"; + }; + + }; + +}; + +# Sound Source Tracking + +sst: +{ + + # Mode is either "kalman" or "particle" + + mode = "kalman"; + + # Add is either "static" or "dynamic" + + add = "dynamic"; + + # Parameters used by both the Kalman and particle filter + + active = ( + { weight = 1.0; mu = 0.3; sigma2 = 0.0025 } + ); + + inactive = ( + { weight = 1.0; mu = 0.15; sigma2 = 0.0025 } + ); + + sigmaR2_prob = 0.0025; + sigmaR2_active = 0.0225; + sigmaR2_target = 0.0025; + Pfalse = 0.1; + Pnew = 0.1; + Ptrack = 0.8; + + theta_new = 0.9; + N_prob = 5; + theta_prob = 0.8; + N_inactive = ( 150, 200, 250, 250 ); + theta_inactive = 0.9; + + # Parameters used by the Kalman filter only + + kalman: { + + sigmaQ = 0.001; + + }; + + # Parameters used by the particle filter only + + particle: { + + nParticles = 1000; + st_alpha = 2.0; + st_beta = 0.04; + st_ratio = 0.5; + ve_alpha = 0.05; + ve_beta = 0.2; + ve_ratio = 0.3; + ac_alpha = 0.5; + ac_beta = 0.2; + ac_ratio = 0.2; + Nmin = 0.7; + + }; + + target: (); + + # Output to export tracked sources + tracked: { + + format = "undefined"; + + interface: { + type = "blackhole"; + }; + + }; + +} + +sss: +{ + + # Mode is either "dds", "dgss" or "dmvdr" + + mode_sep = "dds"; + mode_pf = "ms"; + + gain_sep = 1.0; + gain_pf = 10.0; + + dds: { + + }; + + dgss: { + + mu = 0.01; + lambda = 0.5; + + }; + + dmvdr: { + + }; + + ms: { + + alphaPmin = 0.07; + eta = 0.5; + alphaZ = 0.8; + thetaWin = 0.3; + alphaWin = 0.3; + maxAbsenceProb = 0.9; + Gmin = 0.01; + winSizeLocal = 3; + winSizeGlobal = 23; + winSizeFrame = 256; + + }; + + ss: { + + Gmin = 0.01; + Gmid = 0.9; + Gslope = 10.0; + + } + + separated: { + + fS = 44100; + hopSize = 512; + nBits = 16; + + interface: { + type = "file"; + path = "separated.raw"; + } + + }; + + postfiltered: { + + fS = 44100; + hopSize = 512; + nBits = 16; + + interface: { + type = "file"; + path = "postfiltered.raw"; + } + + }; + +} + +classify: +{ + + frameSize = 1024; + winSize = 3; + tauMin = 32; + tauMax = 200; + deltaTauMax = 7; + alpha = 0.3; + gamma = 0.05; + phiMin = 0.15; + r0 = 0.2; + + category: { + + format = "undefined"; + + interface: { + type = "blackhole"; + } + + } + +} diff --git a/config/odaslive/respeaker_4_mic_array.cfg b/config/odaslive/respeaker_4_mic_array.cfg new file mode 100644 index 0000000..07625cd --- /dev/null +++ b/config/odaslive/respeaker_4_mic_array.cfg @@ -0,0 +1,338 @@ +# Configuration file for ReSpeaker 4 Mic Array (a hat for Raspberry Pi) + +version = "2.1"; + +# Raw + +raw: +{ + + fS = 16000; + hopSize = 128; + nBits = 32; + nChannels = 4; + + # Input with raw signal from microphones + interface: { + type = "soundcard"; + card = 1; + device = 0; + } + +} + +# Mapping + +mapping: +{ + + map: (1, 2, 3, 4); + +} + +# General + +general: +{ + + epsilon = 1E-20; + + size: + { + hopSize = 128; + frameSize = 256; + }; + + samplerate: + { + mu = 16000; + sigma2 = 0.01; + }; + + speedofsound: + { + mu = 343.0; + sigma2 = 25.0; + }; + + mics = ( + + # Microphone 1 + { + mu = ( -0.0405, +0.0000, +0.0000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 90.0 ); + }, + + # Microphone 2 + { + mu = ( +0.0000, +0.0405, +0.0000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 90.0 ); + }, + + # Microphone 3 + { + mu = ( +0.0405, +0.0000, +0.0000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 90.0 ); + }, + + # Microphone 4 + { + mu = ( +0.0000, -0.0405, +0.0000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 90.0 ); + } + + ); + + # Spatial filters to include only a range of direction if required + # (may be useful to remove false detections from the floor, or + # limit the space search to a restricted region) + spatialfilters = ( + + { + + direction = ( +0.000, +0.000, +1.000 ); + angle = (80.0, 90.0); + + } + + ); + + nThetas = 181; + gainMin = 0.25; + +}; + +# Stationnary noise estimation + +sne: +{ + + b = 3; + alphaS = 0.1; + L = 150; + delta = 3.0; + alphaD = 0.1; + +} + +# Sound Source Localization + +ssl: +{ + + nPots = 4; + nMatches = 10; + probMin = 0.5; + nRefinedLevels = 1; + interpRate = 4; + + # Number of scans: level is the resolution of the sphere + # and delta is the size of the maximum sliding window + # (delta = -1 means the size is automatically computed) + scans = ( + { level = 2; delta = -1; }, + { level = 4; delta = -1; } + ); + + # Output to export potential sources + potential: { + + # format = "undefined"; + format = "json"; + + interface: { + # type = "blackhole"; + type = "socket"; ip = "127.0.0.1"; port = 9001; + }; + }; + +}; + +# Sound Source Tracking + +sst: +{ + + # Mode is either "kalman" or "particle" + + mode = "kalman"; + + # Add is either "static" or "dynamic" + + add = "dynamic"; + + # Parameters used by both the Kalman and particle filter + + active = ( + { weight = 1.0; mu = 0.3; sigma2 = 0.0025 } + ); + + inactive = ( + { weight = 1.0; mu = 0.15; sigma2 = 0.0025 } + ); + + sigmaR2_prob = 0.0025; + sigmaR2_active = 0.0225; + sigmaR2_target = 0.0025; + Pfalse = 0.1; + Pnew = 0.1; + Ptrack = 0.8; + + theta_new = 0.9; + N_prob = 5; + theta_prob = 0.8; + N_inactive = ( 150, 200, 250, 250 ); + theta_inactive = 0.9; + + # Parameters used by the Kalman filter only + + kalman: { + + sigmaQ = 0.001; + + }; + + # Parameters used by the particle filter only + + particle: { + + nParticles = 1000; + st_alpha = 2.0; + st_beta = 0.04; + st_ratio = 0.5; + ve_alpha = 0.05; + ve_beta = 0.2; + ve_ratio = 0.3; + ac_alpha = 0.5; + ac_beta = 0.2; + ac_ratio = 0.2; + Nmin = 0.7; + + }; + + target: (); + + # Output to export tracked sources + tracked: { + + # format = "undefined"; + format = "json"; + + interface: { + # type = "blackhole"; + type = "socket"; ip = "127.0.0.1"; port = 9000; + }; + + }; + +} + +sss: +{ + + # Mode is either "dds", "dgss" or "dmvdr" + + mode_sep = "dds"; + mode_pf = "ms"; + + gain_sep = 1.0; + gain_pf = 10.0; + + dds: { + + }; + + dgss: { + + mu = 0.01; + lambda = 0.5; + + }; + + dmvdr: { + + }; + + ms: { + + alphaPmin = 0.07; + eta = 0.5; + alphaZ = 0.8; + thetaWin = 0.3; + alphaWin = 0.3; + maxAbsenceProb = 0.9; + Gmin = 0.01; + winSizeLocal = 3; + winSizeGlobal = 23; + winSizeFrame = 256; + + }; + + ss: { + + Gmin = 0.01; + Gmid = 0.9; + Gslope = 10.0; + + } + + separated: { + + fS = 44100; + hopSize = 512; + nBits = 16; + + interface: { + type = "file"; + path = "separated.raw"; + } + + }; + + postfiltered: { + + fS = 44100; + hopSize = 512; + nBits = 16; + + interface: { + type = "file"; + path = "postfiltered.raw"; + } + + }; + +} + +classify: +{ + + frameSize = 1024; + winSize = 3; + tauMin = 32; + tauMax = 200; + deltaTauMax = 7; + alpha = 0.3; + gamma = 0.05; + phiMin = 0.15; + r0 = 0.2; + + category: { + + format = "undefined"; + + interface: { + type = "blackhole"; + } + + } + +} diff --git a/config/odaslive/xmos.cfg b/config/odaslive/xmos.cfg new file mode 100644 index 0000000..c92efae --- /dev/null +++ b/config/odaslive/xmos.cfg @@ -0,0 +1,360 @@ +# Configuration file for XMOS circular sound card + +version = "2.1"; + +# Raw + +raw: +{ + + fS = 48000; + hopSize = 512; + nBits = 16; + nChannels = 8; + + # Input with raw signal from microphones + interface: { + type = "file"; + path = "meeting_recorded_raw_16.raw"; + } + +} + +# Mapping + +mapping: +{ + + map: (1, 2, 3, 4, 5, 6, 7); + +} + +# General + +general: +{ + + epsilon = 1E-20; + + size: + { + hopSize = 128; + frameSize = 256; + }; + + samplerate: + { + mu = 16000; + sigma2 = 0.01; + }; + + speedofsound: + { + mu = 343.0; + sigma2 = 25.0; + }; + + mics = ( + + # Microphone 1 + { + mu = ( +0.000, +0.000, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 2 + { + mu = ( -0.022, -0.037, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 3 + { + mu = ( -0.043, +0.000, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 4 + { + mu = ( -0.022, +0.037, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 5 + { + mu = ( +0.022, +0.037, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 6 + { + mu = ( +0.043, +0.000, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + }, + + # Microphone 7 + { + mu = ( +0.022, -0.037, +0.000 ); + sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 ); + direction = ( +0.000, +0.000, +1.000 ); + angle = ( 80.0, 100.0 ); + } + + ); + + # Spatial filters to include only a range of direction if required + # (may be useful to remove false detections from the floor, or + # limit the space search to a restricted region) + spatialfilters = ( + + { + + direction = ( +0.000, +0.000, +1.000 ); + angle = (80.0, 90.0); + + } + + ); + + nThetas = 181; + gainMin = 0.25; + +}; + +# Stationnary noise estimation + +sne: +{ + + b = 3; + alphaS = 0.1; + L = 150; + delta = 3.0; + alphaD = 0.1; + +} + +# Sound Source Localization + +ssl: +{ + + nPots = 4; + nMatches = 10; + probMin = 0.5; + nRefinedLevels = 1; + interpRate = 4; + + # Number of scans: level is the resolution of the sphere + # and delta is the size of the maximum sliding window + # (delta = -1 means the size is automatically computed) + scans = ( + { level = 2; delta = -1; }, + { level = 4; delta = -1; } + ); + + # Output to export potential sources + potential: { + + format = "undefined"; + + interface: { + type = "blackhole"; + }; + + }; + +}; + +# Sound Source Tracking + +sst: +{ + + # Mode is either "kalman" or "particle" + + mode = "kalman"; + + # Add is either "static" or "dynamic" + + add = "dynamic"; + + # Parameters used by both the Kalman and particle filter + + active = ( + { weight = 1.0; mu = 0.4; sigma2 = 0.0025 } + ); + + inactive = ( + { weight = 1.0; mu = 0.25; sigma2 = 0.0025 } + ); + + sigmaR2_prob = 0.0025; + sigmaR2_active = 0.0225; + sigmaR2_target = 0.0025; + Pfalse = 0.1; + Pnew = 0.1; + Ptrack = 0.8; + + theta_new = 0.9; + N_prob = 5; + theta_prob = 0.8; + N_inactive = ( 250, 250, 250, 250 ); + theta_inactive = 0.9; + + # Parameters used by the Kalman filter only + + kalman: { + + sigmaQ = 0.001; + + }; + + # Parameters used by the particle filter only + + particle: { + + nParticles = 1000; + st_alpha = 2.0; + st_beta = 0.04; + st_ratio = 0.5; + ve_alpha = 0.05; + ve_beta = 0.2; + ve_ratio = 0.3; + ac_alpha = 0.5; + ac_beta = 0.2; + ac_ratio = 0.2; + Nmin = 0.7; + + }; + + target: (); + + # Output to export tracked sources + tracked: { + + format = "json"; + + interface: { + type = "file"; + path = "tracks.txt"; + }; + + }; + +} + +sss: +{ + + # Mode is either "dds", "dgss" or "dmvdr" + + mode_sep = "dds"; + mode_pf = "ss"; + + gain_sep = 1.0; + gain_pf = 10.0; + + dds: { + + }; + + dgss: { + + mu = 0.01; + lambda = 0.5; + + }; + + dmvdr: { + + }; + + ms: { + + alphaPmin = 0.07; + eta = 0.5; + alphaZ = 0.8; + thetaWin = 0.3; + alphaWin = 0.3; + maxAbsenceProb = 0.9; + Gmin = 0.01; + winSizeLocal = 3; + winSizeGlobal = 23; + winSizeFrame = 256; + + }; + + ss: { + + Gmin = 0.01; + Gmid = 0.5; + Gslope = 10.0; + + } + + separated: { + + fS = 16000; + hopSize = 128; + nBits = 16; + + interface: { + type = "file"; + path = "separated.raw"; + }; + + }; + + postfiltered: { + + fS = 16000; + hopSize = 128; + nBits = 16; + gain = 10.0; + + interface: { + type = "file"; + path = "postfiltered.raw"; + }; + + }; + +}; + +classify: +{ + + frameSize = 4096; + winSize = 3; + tauMin = 88; + tauMax = 551; + deltaTauMax = 20; + alpha = 0.3; + gamma = 0.05; + phiMin = 0.5; + r0 = 0.2; + + category: { + + format = "undefined"; + + interface: { + type = "blackhole"; + } + + } + +} diff --git a/demo/odascore/configs.c b/demo/odascore/configs.c deleted file mode 100644 index e92f8a7..0000000 --- a/demo/odascore/configs.c +++ /dev/null @@ -1,502 +0,0 @@ - - #include "configs.h" - - configs * configs_construct(const char * file_config) { - - configs * cfgs; - unsigned int iSink; - - cfgs = (configs *) malloc(sizeof(configs)); - - // +----------------------------------------------------------+ - // | Raw | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Source | - // +------------------------------------------------------+ - - cfgs->src_hops_mics_config = parameters_src_hops_mics_config(file_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - cfgs->msg_hops_mics_raw_config = parameters_msg_hops_mics_raw_config(file_config); - - // +----------------------------------------------------------+ - // | Mapping | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - cfgs->mod_mapping_mics_config = parameters_mod_mapping_mics_config(file_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - cfgs->msg_hops_mics_map_config = parameters_msg_hops_mics_map_config(file_config); - - - // +----------------------------------------------------------+ - // | Resample | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - cfgs->mod_resample_mics_config = parameters_mod_resample_mics_config(file_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - cfgs->msg_hops_mics_rs_config = parameters_msg_hops_mics_rs_config(file_config); - - // +----------------------------------------------------------+ - // | STFT | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - cfgs->mod_stft_mics_config = parameters_mod_stft_mics_config(file_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - cfgs->msg_spectra_mics_config = parameters_msg_spectra_mics_config(file_config); - - // +----------------------------------------------------------+ - // | Noise | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - cfgs->mod_noise_mics_config = parameters_mod_noise_mics_config(file_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - cfgs->msg_powers_mics_config = parameters_msg_powers_mics_config(file_config); - - // +----------------------------------------------------------+ - // | SSL | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - cfgs->mod_ssl_config = parameters_mod_ssl_config(file_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - cfgs->msg_pots_ssl_config = parameters_msg_pots_ssl_config(file_config); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - cfgs->snk_pots_ssl_config = parameters_snk_pots_ssl_config(file_config); - - // +----------------------------------------------------------+ - // | Target | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Injector | - // +------------------------------------------------------+ - - cfgs->inj_targets_sst_config = parameters_inj_targets_sst_config(file_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - cfgs->msg_targets_sst_config = parameters_msg_targets_sst_config(file_config); - - // +----------------------------------------------------------+ - // | SST | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - cfgs->mod_sst_config = parameters_mod_sst_config(file_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - cfgs->msg_tracks_sst_config = parameters_msg_tracks_sst_config(file_config); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - cfgs->snk_tracks_sst_config = parameters_snk_tracks_sst_config(file_config); - - // +----------------------------------------------------------+ - // | SSS | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - cfgs->mod_sss_config = parameters_mod_sss_config(file_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - cfgs->msg_spectra_seps_config = parameters_msg_spectra_seps_config(file_config); - cfgs->msg_spectra_pfs_config = parameters_msg_spectra_pfs_config(file_config); - - // +----------------------------------------------------------+ - // | ISTFT | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - cfgs->mod_istft_seps_config = parameters_mod_istft_seps_config(file_config); - cfgs->mod_istft_pfs_config = parameters_mod_istft_pfs_config(file_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - cfgs->msg_hops_seps_config = parameters_msg_hops_seps_config(file_config); - cfgs->msg_hops_pfs_config = parameters_msg_hops_pfs_config(file_config); - - // +----------------------------------------------------------+ - // | Resample | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - cfgs->mod_resample_seps_config = parameters_mod_resample_seps_config(file_config); - cfgs->mod_resample_pfs_config = parameters_mod_resample_pfs_config(file_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - cfgs->msg_hops_seps_rs_config = parameters_msg_hops_seps_rs_config(file_config); - cfgs->msg_hops_pfs_rs_config = parameters_msg_hops_pfs_rs_config(file_config); - - // +----------------------------------------------------------+ - // | Volume | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - cfgs->mod_volume_seps_config = parameters_mod_volume_seps_config(file_config); - cfgs->mod_volume_pfs_config = parameters_mod_volume_pfs_config(file_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - cfgs->msg_hops_seps_vol_config = parameters_msg_hops_seps_vol_config(file_config); - cfgs->msg_hops_pfs_vol_config = parameters_msg_hops_pfs_vol_config(file_config); - - // +------------------------------------------------------+ - // | Sink | - // +------------------------------------------------------+ - - cfgs->snk_hops_seps_vol_config = parameters_snk_hops_seps_vol_config(file_config); - cfgs->snk_hops_pfs_vol_config = parameters_snk_hops_pfs_vol_config(file_config); - - // +----------------------------------------------------------+ - // | Classify | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - cfgs->mod_classify_config = parameters_mod_classify_config(file_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - cfgs->msg_categories_config = parameters_msg_categories_config(file_config); - - // +------------------------------------------------------+ - // | Sink | - // +------------------------------------------------------+ - - cfgs->snk_categories_config = parameters_snk_categories_config(file_config); - - return cfgs; - - } - - void configs_destroy(configs * cfgs) { - - unsigned int iSink; - - // +----------------------------------------------------------+ - // | Raw | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Source | - // +------------------------------------------------------+ - - src_hops_cfg_destroy(cfgs->src_hops_mics_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - msg_hops_cfg_destroy(cfgs->msg_hops_mics_raw_config); - - // +----------------------------------------------------------+ - // | Mapping | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - mod_mapping_cfg_destroy(cfgs->mod_mapping_mics_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - msg_hops_cfg_destroy(cfgs->msg_hops_mics_map_config); - - // +----------------------------------------------------------+ - // | Resample | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - mod_resample_cfg_destroy(cfgs->mod_resample_mics_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - msg_hops_cfg_destroy(cfgs->msg_hops_mics_rs_config); - - // +----------------------------------------------------------+ - // | STFT | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - mod_stft_cfg_destroy(cfgs->mod_stft_mics_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - msg_spectra_cfg_destroy(cfgs->msg_spectra_mics_config); - - // +----------------------------------------------------------+ - // | Noise | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - mod_noise_cfg_destroy(cfgs->mod_noise_mics_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - msg_powers_cfg_destroy(cfgs->msg_powers_mics_config); - - // +----------------------------------------------------------+ - // | SSL | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - mod_ssl_cfg_destroy(cfgs->mod_ssl_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - msg_pots_cfg_destroy(cfgs->msg_pots_ssl_config); - - // +------------------------------------------------------+ - // | Sink | - // +------------------------------------------------------+ - - snk_pots_cfg_destroy(cfgs->snk_pots_ssl_config); - - // +----------------------------------------------------------+ - // | Target | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Injector | - // +------------------------------------------------------+ - - inj_targets_cfg_destroy(cfgs->inj_targets_sst_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - msg_targets_cfg_destroy(cfgs->msg_targets_sst_config); - - // +----------------------------------------------------------+ - // | SST | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - mod_sst_cfg_destroy(cfgs->mod_sst_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - msg_tracks_cfg_destroy(cfgs->msg_tracks_sst_config); - - // +------------------------------------------------------+ - // | Sink | - // +------------------------------------------------------+ - - snk_tracks_cfg_destroy(cfgs->snk_tracks_sst_config); - - // +----------------------------------------------------------+ - // | SSS | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - mod_sss_cfg_destroy(cfgs->mod_sss_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - msg_spectra_cfg_destroy(cfgs->msg_spectra_seps_config); - msg_spectra_cfg_destroy(cfgs->msg_spectra_pfs_config); - - // +----------------------------------------------------------+ - // | ISTFT | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - mod_istft_cfg_destroy(cfgs->mod_istft_seps_config); - mod_istft_cfg_destroy(cfgs->mod_istft_pfs_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - msg_hops_cfg_destroy(cfgs->msg_hops_seps_config); - msg_hops_cfg_destroy(cfgs->msg_hops_pfs_config); - - // +----------------------------------------------------------+ - // | Resample | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - mod_resample_cfg_destroy(cfgs->mod_resample_seps_config); - mod_resample_cfg_destroy(cfgs->mod_resample_pfs_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - msg_hops_cfg_destroy(cfgs->msg_hops_seps_rs_config); - msg_hops_cfg_destroy(cfgs->msg_hops_pfs_rs_config); - - // +----------------------------------------------------------+ - // | Volume | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - mod_volume_cfg_destroy(cfgs->mod_volume_seps_config); - mod_volume_cfg_destroy(cfgs->mod_volume_pfs_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - msg_hops_cfg_destroy(cfgs->msg_hops_seps_vol_config); - msg_hops_cfg_destroy(cfgs->msg_hops_pfs_vol_config); - - // +------------------------------------------------------+ - // | Sink | - // +------------------------------------------------------+ - - snk_hops_cfg_destroy(cfgs->snk_hops_seps_vol_config); - snk_hops_cfg_destroy(cfgs->snk_hops_pfs_vol_config); - - // +----------------------------------------------------------+ - // | Classify | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - mod_classify_cfg_destroy(cfgs->mod_classify_config); - - // +------------------------------------------------------+ - // | Message | - // +------------------------------------------------------+ - - msg_categories_cfg_destroy(cfgs->msg_categories_config); - - // +------------------------------------------------------+ - // | Sink | - // +------------------------------------------------------+ - - snk_categories_cfg_destroy(cfgs->snk_categories_config); - - free((void *) cfgs); - - } diff --git a/demo/odascore/configs.h b/demo/odascore/configs.h deleted file mode 100644 index 06e5cf8..0000000 --- a/demo/odascore/configs.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef __DEMO_CONFIGS -#define __DEMO_CONFIGS - - #include "parameters.h" - - #include - #include - - typedef struct configs { - - src_hops_cfg * src_hops_mics_config; - msg_hops_cfg * msg_hops_mics_raw_config; - - mod_mapping_cfg * mod_mapping_mics_config; - msg_hops_cfg * msg_hops_mics_map_config; - - mod_resample_cfg * mod_resample_mics_config; - msg_hops_cfg * msg_hops_mics_rs_config; - - mod_stft_cfg * mod_stft_mics_config; - msg_spectra_cfg * msg_spectra_mics_config; - - mod_noise_cfg * mod_noise_mics_config; - msg_powers_cfg * msg_powers_mics_config; - - mod_ssl_cfg * mod_ssl_config; - msg_pots_cfg * msg_pots_ssl_config; - snk_pots_cfg * snk_pots_ssl_config; - - inj_targets_cfg * inj_targets_sst_config; - msg_targets_cfg * msg_targets_sst_config; - - mod_sst_cfg * mod_sst_config; - msg_tracks_cfg * msg_tracks_sst_config; - snk_tracks_cfg * snk_tracks_sst_config; - - mod_sss_cfg * mod_sss_config; - msg_spectra_cfg * msg_spectra_seps_config; - msg_spectra_cfg * msg_spectra_pfs_config; - - mod_istft_cfg * mod_istft_seps_config; - mod_istft_cfg * mod_istft_pfs_config; - msg_hops_cfg * msg_hops_seps_config; - msg_hops_cfg * msg_hops_pfs_config; - - mod_resample_cfg * mod_resample_seps_config; - mod_resample_cfg * mod_resample_pfs_config; - msg_hops_cfg * msg_hops_seps_rs_config; - msg_hops_cfg * msg_hops_pfs_rs_config; - - mod_volume_cfg * mod_volume_seps_config; - mod_volume_cfg * mod_volume_pfs_config; - msg_hops_cfg * msg_hops_seps_vol_config; - msg_hops_cfg * msg_hops_pfs_vol_config; - snk_hops_cfg * snk_hops_seps_vol_config; - snk_hops_cfg * snk_hops_pfs_vol_config; - - mod_classify_cfg * mod_classify_config; - msg_categories_cfg * msg_categories_config; - snk_categories_cfg * snk_categories_config; - - } configs; - - configs * configs_construct(const char * file_config); - - void configs_destroy(configs * cfgs); - -#endif \ No newline at end of file diff --git a/demo/odascore/main.c b/demo/odascore/main.c deleted file mode 100644 index b183af3..0000000 --- a/demo/odascore/main.c +++ /dev/null @@ -1,292 +0,0 @@ - - #include - - #include "parameters.h" - #include "configs.h" - #include "objects.h" - #include "threads.h" - #include "profiler.h" - - #include - #include - #include - - // +----------------------------------------------------------+ - // | Variables | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Type | - // +------------------------------------------------------+ - - enum processing { - processing_singlethread, - processing_multithread - } type; - - // +------------------------------------------------------+ - // | Getopt | - // +------------------------------------------------------+ - - int c; - char * file_config; - - // +------------------------------------------------------+ - // | Objects | - // +------------------------------------------------------+ - - objects * objs; - aobjects * aobjs; - - // +------------------------------------------------------+ - // | Configurations | - // +------------------------------------------------------+ - - configs * cfgs; - - // +------------------------------------------------------+ - // | Profiler | - // +------------------------------------------------------+ - - profiler * prf; - - // +------------------------------------------------------+ - // | Flag | - // +------------------------------------------------------+ - - char stopProcess; - - // +----------------------------------------------------------+ - // | Signal handler | - // +----------------------------------------------------------+ - - void sighandler(int signum) { - - if (type == processing_singlethread) { - stopProcess = 1; - } - if (type == processing_multithread) { - threads_multiple_stop(aobjs); - } - - } - - // +----------------------------------------------------------+ - // | Main routine | - // +----------------------------------------------------------+ - - int main(int argc, char * argv[]) { - - // +------------------------------------------------------+ - // | Arguments | - // +------------------------------------------------------+ - - file_config = (char *) NULL; - char verbose = 0x00; - - type = processing_multithread; - - while ((c = getopt(argc,argv, "c:hsv")) != -1) { - - switch(c) { - - case 'c': - - file_config = (char *) malloc(sizeof(char) * (strlen(optarg)+1)); - strcpy(file_config, optarg); - - break; - - case 'h': - - printf("+----------------------------------------------------+\n"); - printf("| ODAS (Open embeddeD Audition System) |\n"); - printf("+----------------------------------------------------+\n"); - printf("| Author: Francois Grondin |\n"); - printf("| Email: francois.grondin2@usherbrooke.ca |\n"); - printf("| Website: introlab.3it.usherbrooke.ca |\n"); - printf("| Repository: github.com/introlab/odas |\n"); - printf("| Version: 1.0 |\n"); - printf("+----------------------------------------------------+\n"); - printf("| -c Configuration file (.cfg) |\n"); - printf("| -h Help |\n"); - printf("| -s Process sequentially (no multithread) |\n"); - printf("| -v Verbose |\n"); - printf("+----------------------------------------------------+\n"); - - exit(EXIT_SUCCESS); - - break; - - case 's': - - type = processing_singlethread; - - break; - - case 'v': - - verbose = 0x01; - - break; - - } - - } - - if (file_config == NULL) { - printf("Missing configuration file.\n"); - exit(EXIT_FAILURE); - } - - // +------------------------------------------------------+ - // | Copyright | - // +------------------------------------------------------+ - - if (verbose == 0x01) { - - printf("+--------------------------------------------+\n"); - printf("| ODAS (Open embeddeD Audition System) |\n"); - printf("+--------------------------------------------+\n"); - printf("| Author: Francois Grondin |\n"); - printf("| Email: francois.grondin2@usherbrooke.ca |\n"); - printf("| Website: introlab.3it.usherbrooke.ca |\n"); - printf("| Version: 1.0 |\n"); - printf("+--------------------------------------------+\n"); - - } - - // +------------------------------------------------------+ - // | Single thread | - // +------------------------------------------------------+ - - if (type == processing_singlethread) { - - // +--------------------------------------------------+ - // | Profiler | - // +--------------------------------------------------+ - - prf = profiler_construct(); - - // +--------------------------------------------------+ - // | Configure | - // +--------------------------------------------------+ - - if (verbose == 0x01) printf("| + Initializing configurations...... "); fflush(stdout); - - cfgs = configs_construct(file_config); - - if (verbose == 0x01) printf("[Done] |\n"); - - // +--------------------------------------------------+ - // | Construct | - // +--------------------------------------------------+ - - if (verbose == 0x01) printf("| + Initializing objects............. "); fflush(stdout); - - objs = objects_construct(cfgs); - - if (verbose == 0x01) printf("[Done] |\n"); - - // +--------------------------------------------------+ - // | Processing | - // +--------------------------------------------------+ - - if (verbose == 0x01) printf("| + Processing....................... "); fflush(stdout); - - threads_single_open(objs); - stopProcess = 0; - while((threads_single_process(objs, prf) == 0) && (stopProcess == 0)); - threads_single_close(objs); - - if (verbose == 0x01) printf("[Done] |\n"); - - // +--------------------------------------------------+ - // | Free memory | - // +--------------------------------------------------+ - - if (verbose == 0x01) printf("| + Free memory...................... "); fflush(stdout); - - objects_destroy(objs); - configs_destroy(cfgs); - free((void *) file_config); - - if (verbose == 0x01) printf("[Done] |\n"); - - // +--------------------------------------------------+ - // | Results | - // +--------------------------------------------------+ - - if (verbose == 0x01) profiler_printf(prf); - - profiler_destroy(prf); - - } - - // +------------------------------------------------------+ - // | Multiple threads | - // +------------------------------------------------------+ - - if (type == processing_multithread) { - - // +--------------------------------------------------+ - // | Configure | - // +--------------------------------------------------+ - - if (verbose == 0x01) printf("| + Initializing configurations...... "); fflush(stdout); - - cfgs = configs_construct(file_config); - - if (verbose == 0x01) printf("[Done] |\n"); - - // +--------------------------------------------------+ - // | Construct | - // +--------------------------------------------------+ - - if (verbose == 0x01) printf("| + Initializing objects............. "); fflush(stdout); - - aobjs = aobjects_construct(cfgs); - - if (verbose == 0x01) printf("[Done] |\n"); - - // +--------------------------------------------------+ - // | Launch threads | - // +--------------------------------------------------+ - - signal(SIGINT, sighandler); - - if (verbose == 0x01) printf("| + Launch threads................... "); fflush(stdout); - - threads_multiple_start(aobjs); - - if (verbose == 0x01) printf("[Done] |\n"); - - // +--------------------------------------------------+ - // | Wait | - // +--------------------------------------------------+ - - if (verbose == 0x01) printf("| + Threads running.................. "); fflush(stdout); - - threads_multiple_join(aobjs); - - if (verbose == 0x01) printf("[Done] |\n"); - - // +--------------------------------------------------+ - // | Free memory | - // +--------------------------------------------------+ - - if (verbose == 0x01) printf("| + Free memory...................... "); fflush(stdout); - - aobjects_destroy(aobjs); - configs_destroy(cfgs); - free((void *) file_config); - - if (verbose == 0x01) printf("[Done] |\n"); - - if (verbose == 0x01) printf("+--------------------------------------------+\n"); - - } - - return 0; - - } diff --git a/demo/odascore/objects.c b/demo/odascore/objects.c deleted file mode 100644 index c7fecba..0000000 --- a/demo/odascore/objects.c +++ /dev/null @@ -1,1626 +0,0 @@ - - #include "objects.h" - - objects * objects_construct(const configs * cfgs) { - - objects * objs; - unsigned int iSink; - - objs = (objects *) malloc(sizeof(objects)); - - // +----------------------------------------------------------+ - // | Construct | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Raw | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Source | - // +--------------------------------------------------+ - - objs->src_hops_mics_object = src_hops_construct(cfgs->src_hops_mics_config, - cfgs->msg_hops_mics_raw_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->con_hops_mics_raw_object = con_hops_construct(1, cfgs->msg_hops_mics_raw_config); - - // +------------------------------------------------------+ - // | Mapping | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->mod_mapping_mics_object = mod_mapping_construct(cfgs->mod_mapping_mics_config, - cfgs->msg_hops_mics_map_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->con_hops_mics_map_object = con_hops_construct(1, cfgs->msg_hops_mics_map_config); - - // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->mod_resample_mics_object = mod_resample_construct(cfgs->mod_resample_mics_config, - cfgs->msg_hops_mics_map_config, - cfgs->msg_hops_mics_rs_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->con_hops_mics_rs_object = con_hops_construct(2, cfgs->msg_hops_mics_rs_config); - - // +------------------------------------------------------+ - // | STFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->mod_stft_mics_object = mod_stft_construct(cfgs->mod_stft_mics_config, - cfgs->msg_hops_mics_rs_config, - cfgs->msg_spectra_mics_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->con_spectra_mics_object = con_spectra_construct(3, cfgs->msg_spectra_mics_config); - - // +------------------------------------------------------+ - // | Noise | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->mod_noise_mics_object = mod_noise_construct(cfgs->mod_noise_mics_config, - cfgs->msg_spectra_mics_config, - cfgs->msg_powers_mics_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->con_powers_mics_object = con_powers_construct(1, cfgs->msg_powers_mics_config); - - // +------------------------------------------------------+ - // | SSL | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->mod_ssl_object = mod_ssl_construct(cfgs->mod_ssl_config, - cfgs->msg_spectra_mics_config, - cfgs->msg_pots_ssl_config); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - objs->snk_pots_ssl_object = snk_pots_construct(cfgs->snk_pots_ssl_config, - cfgs->msg_pots_ssl_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->con_pots_ssl_object = con_pots_construct(2, cfgs->msg_pots_ssl_config); - - // +------------------------------------------------------+ - // | Target | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Injector | - // +--------------------------------------------------+ - - objs->inj_targets_sst_object = inj_targets_construct(cfgs->inj_targets_sst_config, - cfgs->msg_hops_mics_rs_config, - cfgs->msg_targets_sst_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->con_targets_sst_object = con_targets_construct(1, cfgs->msg_targets_sst_config); - - // +------------------------------------------------------+ - // | SST | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->mod_sst_object = mod_sst_construct(cfgs->mod_sst_config, - cfgs->mod_ssl_config, - cfgs->msg_pots_ssl_config, - cfgs->msg_targets_sst_config, - cfgs->msg_tracks_sst_config); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - objs->snk_tracks_sst_object = snk_tracks_construct(cfgs->snk_tracks_sst_config, - cfgs->msg_tracks_sst_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->con_tracks_sst_object = con_tracks_construct(3, cfgs->msg_tracks_sst_config); - - // +------------------------------------------------------+ - // | SSS | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->mod_sss_object = mod_sss_construct(cfgs->mod_sss_config, - cfgs->msg_tracks_sst_config, - cfgs->msg_spectra_mics_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->con_spectra_seps_object = con_spectra_construct(1, cfgs->msg_spectra_seps_config); - objs->con_spectra_pfs_object = con_spectra_construct(1, cfgs->msg_spectra_pfs_config); - - // +------------------------------------------------------+ - // | ISTFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->mod_istft_seps_object = mod_istft_construct(cfgs->mod_istft_seps_config, - cfgs->msg_spectra_seps_config, - cfgs->msg_hops_seps_config); - - objs->mod_istft_pfs_object = mod_istft_construct(cfgs->mod_istft_pfs_config, - cfgs->msg_spectra_pfs_config, - cfgs->msg_hops_pfs_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->con_hops_seps_object = con_hops_construct(2, cfgs->msg_hops_seps_config); - objs->con_hops_pfs_object = con_hops_construct(1, cfgs->msg_hops_pfs_config); - - // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->mod_resample_seps_object = mod_resample_construct(cfgs->mod_resample_seps_config, - cfgs->msg_hops_seps_config, - cfgs->msg_hops_seps_rs_config); - - objs->mod_resample_pfs_object = mod_resample_construct(cfgs->mod_resample_pfs_config, - cfgs->msg_hops_pfs_config, - cfgs->msg_hops_pfs_rs_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->con_hops_seps_rs_object = con_hops_construct(1, cfgs->msg_hops_seps_rs_config); - objs->con_hops_pfs_rs_object = con_hops_construct(1, cfgs->msg_hops_pfs_rs_config); - - // +------------------------------------------------------+ - // | Volume | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->mod_volume_seps_object = mod_volume_construct(cfgs->mod_volume_seps_config, - cfgs->msg_hops_seps_vol_config); - - objs->mod_volume_pfs_object = mod_volume_construct(cfgs->mod_volume_pfs_config, - cfgs->msg_hops_pfs_vol_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->con_hops_seps_vol_object = con_hops_construct(1, cfgs->msg_hops_seps_vol_config); - objs->con_hops_pfs_vol_object = con_hops_construct(1, cfgs->msg_hops_pfs_vol_config); - - // +--------------------------------------------------+ - // | Sink | - // +--------------------------------------------------+ - - objs->snk_hops_seps_vol_object = snk_hops_construct(cfgs->snk_hops_seps_vol_config, - cfgs->msg_hops_seps_vol_config); - - objs->snk_hops_pfs_vol_object = snk_hops_construct(cfgs->snk_hops_pfs_vol_config, - cfgs->msg_hops_pfs_vol_config); - - // +------------------------------------------------------+ - // | Classify | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->mod_classify_object = mod_classify_construct(cfgs->mod_classify_config, - cfgs->msg_hops_seps_config, - cfgs->msg_tracks_sst_config, - cfgs->msg_categories_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->con_categories_object = con_categories_construct(1, cfgs->msg_categories_config); - - // +--------------------------------------------------+ - // | Sink | - // +--------------------------------------------------+ - - objs->snk_categories_object = snk_categories_construct(cfgs->snk_categories_config, - cfgs->msg_categories_config); - - // +----------------------------------------------------------+ - // | Connect | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Raw | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Source | - // +--------------------------------------------------+ - - src_hops_connect(objs->src_hops_mics_object, - objs->con_hops_mics_raw_object->in); - - // +------------------------------------------------------+ - // | Mapping | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_mapping_connect(objs->mod_mapping_mics_object, - objs->con_hops_mics_raw_object->outs[0], - objs->con_hops_mics_map_object->in); - - // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_resample_connect(objs->mod_resample_mics_object, - objs->con_hops_mics_map_object->outs[0], - objs->con_hops_mics_rs_object->in); - - // +------------------------------------------------------+ - // | STFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_stft_connect(objs->mod_stft_mics_object, - objs->con_hops_mics_rs_object->outs[0], - objs->con_spectra_mics_object->in); - - // +------------------------------------------------------+ - // | Noise | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_noise_connect(objs->mod_noise_mics_object, - objs->con_spectra_mics_object->outs[0], - objs->con_powers_mics_object->in); - - // +------------------------------------------------------+ - // | SSL | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_ssl_connect(objs->mod_ssl_object, - objs->con_spectra_mics_object->outs[1], - objs->con_pots_ssl_object->in); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - snk_pots_connect(objs->snk_pots_ssl_object, - objs->con_pots_ssl_object->outs[1]); - - // +------------------------------------------------------+ - // | Target | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Injector | - // +--------------------------------------------------+ - - inj_targets_connect(objs->inj_targets_sst_object, - objs->con_hops_mics_rs_object->outs[1], - objs->con_targets_sst_object->in); - - // +------------------------------------------------------+ - // | SST | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_sst_connect(objs->mod_sst_object, - objs->con_pots_ssl_object->outs[0], - objs->con_targets_sst_object->outs[0], - objs->con_tracks_sst_object->in); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - snk_tracks_connect(objs->snk_tracks_sst_object, - objs->con_tracks_sst_object->outs[2]); - - // +------------------------------------------------------+ - // | SSS | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_sss_connect(objs->mod_sss_object, - objs->con_spectra_mics_object->outs[2], - objs->con_powers_mics_object->outs[0], - objs->con_tracks_sst_object->outs[0], - objs->con_spectra_seps_object->in, - objs->con_spectra_pfs_object->in); - - // +------------------------------------------------------+ - // | ISTFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_istft_connect(objs->mod_istft_seps_object, - objs->con_spectra_seps_object->outs[0], - objs->con_hops_seps_object->in); - - mod_istft_connect(objs->mod_istft_pfs_object, - objs->con_spectra_pfs_object->outs[0], - objs->con_hops_pfs_object->in); - - // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_resample_connect(objs->mod_resample_seps_object, - objs->con_hops_seps_object->outs[0], - objs->con_hops_seps_rs_object->in); - - mod_resample_connect(objs->mod_resample_pfs_object, - objs->con_hops_pfs_object->outs[0], - objs->con_hops_pfs_rs_object->in); - - // +------------------------------------------------------+ - // | Volume | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_volume_connect(objs->mod_volume_seps_object, - objs->con_hops_seps_rs_object->outs[0], - objs->con_hops_seps_vol_object->in); - - mod_volume_connect(objs->mod_volume_pfs_object, - objs->con_hops_pfs_rs_object->outs[0], - objs->con_hops_pfs_vol_object->in); - - // +--------------------------------------------------+ - // | Sink | - // +--------------------------------------------------+ - - snk_hops_connect(objs->snk_hops_seps_vol_object, - objs->con_hops_seps_vol_object->outs[0]); - - snk_hops_connect(objs->snk_hops_pfs_vol_object, - objs->con_hops_pfs_vol_object->outs[0]); - - // +------------------------------------------------------+ - // | Classify | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_classify_connect(objs->mod_classify_object, - objs->con_hops_seps_object->outs[1], - objs->con_tracks_sst_object->outs[1], - objs->con_categories_object->in); - - // +--------------------------------------------------+ - // | Sink | - // +--------------------------------------------------+ - - snk_categories_connect(objs->snk_categories_object, - objs->con_categories_object->outs[0]); - - // +----------------------------------------------------------+ - // | Enable modules | - // +----------------------------------------------------------+ - - mod_mapping_enable(objs->mod_mapping_mics_object); - mod_resample_enable(objs->mod_resample_mics_object); - mod_stft_enable(objs->mod_stft_mics_object); - - if (cfgs->snk_pots_ssl_config->interface->type != interface_blackhole) { - - mod_ssl_enable(objs->mod_ssl_object); - - } - - if (cfgs->snk_tracks_sst_config->interface->type != interface_blackhole) { - - mod_ssl_enable(objs->mod_ssl_object); - mod_sst_enable(objs->mod_sst_object); - - } - - if (cfgs->snk_hops_seps_vol_config->interface->type != interface_blackhole) { - - mod_ssl_enable(objs->mod_ssl_object); - mod_sst_enable(objs->mod_sst_object); - mod_noise_enable(objs->mod_noise_mics_object); - mod_sss_enable(objs->mod_sss_object); - mod_istft_enable(objs->mod_istft_seps_object); - mod_resample_enable(objs->mod_resample_seps_object); - mod_volume_enable(objs->mod_volume_seps_object); - - } - - if (cfgs->snk_hops_pfs_vol_config->interface->type != interface_blackhole) { - - mod_ssl_enable(objs->mod_ssl_object); - mod_sst_enable(objs->mod_sst_object); - mod_noise_enable(objs->mod_noise_mics_object); - mod_sss_enable(objs->mod_sss_object); - mod_istft_enable(objs->mod_istft_pfs_object); - mod_resample_enable(objs->mod_resample_pfs_object); - mod_volume_enable(objs->mod_volume_pfs_object); - - } - - if (cfgs->snk_categories_config->interface->type != interface_blackhole) { - - mod_ssl_enable(objs->mod_ssl_object); - mod_sst_enable(objs->mod_sst_object); - mod_noise_enable(objs->mod_noise_mics_object); - mod_sss_enable(objs->mod_sss_object); - mod_istft_enable(objs->mod_istft_seps_object); - mod_classify_enable(objs->mod_classify_object); - - } - - return objs; - - } - - void objects_destroy(objects * objs) { - - unsigned int iSink; - - // +----------------------------------------------------------+ - // | Destroy | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Raw | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Source | - // +--------------------------------------------------+ - - src_hops_destroy(objs->src_hops_mics_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_hops_destroy(objs->con_hops_mics_raw_object); - - // +------------------------------------------------------+ - // | Mapping | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_mapping_destroy(objs->mod_mapping_mics_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_hops_destroy(objs->con_hops_mics_map_object); - - // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_resample_destroy(objs->mod_resample_mics_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_hops_destroy(objs->con_hops_mics_rs_object); - - // +------------------------------------------------------+ - // | STFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_stft_destroy(objs->mod_stft_mics_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_spectra_destroy(objs->con_spectra_mics_object); - - // +------------------------------------------------------+ - // | Noise | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_noise_destroy(objs->mod_noise_mics_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_powers_destroy(objs->con_powers_mics_object); - - // +------------------------------------------------------+ - // | SSL | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_ssl_destroy(objs->mod_ssl_object); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - snk_pots_destroy(objs->snk_pots_ssl_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_pots_destroy(objs->con_pots_ssl_object); - - // +------------------------------------------------------+ - // | Target | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Injector | - // +--------------------------------------------------+ - - inj_targets_destroy(objs->inj_targets_sst_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_targets_destroy(objs->con_targets_sst_object); - - // +------------------------------------------------------+ - // | SST | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_sst_destroy(objs->mod_sst_object); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - snk_tracks_destroy(objs->snk_tracks_sst_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_tracks_destroy(objs->con_tracks_sst_object); - - // +------------------------------------------------------+ - // | SSS | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_sss_destroy(objs->mod_sss_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_spectra_destroy(objs->con_spectra_seps_object); - con_spectra_destroy(objs->con_spectra_pfs_object); - - // +------------------------------------------------------+ - // | ISTFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_istft_destroy(objs->mod_istft_seps_object); - mod_istft_destroy(objs->mod_istft_pfs_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_hops_destroy(objs->con_hops_seps_object); - con_hops_destroy(objs->con_hops_pfs_object); - - // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_resample_destroy(objs->mod_resample_seps_object); - mod_resample_destroy(objs->mod_resample_pfs_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_hops_destroy(objs->con_hops_seps_rs_object); - con_hops_destroy(objs->con_hops_pfs_rs_object); - - // +------------------------------------------------------+ - // | Volume | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_volume_destroy(objs->mod_volume_seps_object); - mod_volume_destroy(objs->mod_volume_pfs_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_hops_destroy(objs->con_hops_seps_vol_object); - con_hops_destroy(objs->con_hops_pfs_vol_object); - - // +--------------------------------------------------+ - // | Sink | - // +--------------------------------------------------+ - - snk_hops_destroy(objs->snk_hops_seps_vol_object); - snk_hops_destroy(objs->snk_hops_pfs_vol_object); - - // +------------------------------------------------------+ - // | Classify | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_classify_destroy(objs->mod_classify_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_categories_destroy(objs->con_categories_object); - - // +--------------------------------------------------+ - // | Sink | - // +--------------------------------------------------+ - - snk_categories_destroy(objs->snk_categories_object); - - free((void *) objs); - - } - - aobjects * aobjects_construct(const configs * cfgs) { - - aobjects * objs; - unsigned int iSink; - - objs = (aobjects *) malloc(sizeof(aobjects)); - - objs->nMessages = 100; - - // +----------------------------------------------------------+ - // | Construct | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Raw | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Source | - // +--------------------------------------------------+ - - objs->asrc_hops_mics_object = asrc_hops_construct(cfgs->src_hops_mics_config, - cfgs->msg_hops_mics_raw_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->acon_hops_mics_raw_object = acon_hops_construct(1, objs->nMessages, cfgs->msg_hops_mics_raw_config); - - // +------------------------------------------------------+ - // | Mapping | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_mapping_mics_object = amod_mapping_construct(cfgs->mod_mapping_mics_config, - cfgs->msg_hops_mics_map_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->acon_hops_mics_map_object = acon_hops_construct(1, objs->nMessages, cfgs->msg_hops_mics_map_config); - - // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_resample_mics_object = amod_resample_construct(cfgs->mod_resample_mics_config, - cfgs->msg_hops_mics_map_config, - cfgs->msg_hops_mics_rs_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->acon_hops_mics_rs_object = acon_hops_construct(2, objs->nMessages, cfgs->msg_hops_mics_rs_config); - - // +------------------------------------------------------+ - // | STFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_stft_mics_object = amod_stft_construct(cfgs->mod_stft_mics_config, - cfgs->msg_hops_mics_rs_config, - cfgs->msg_spectra_mics_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->acon_spectra_mics_object = acon_spectra_construct(3, objs->nMessages, cfgs->msg_spectra_mics_config); - - // +------------------------------------------------------+ - // | Noise | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_noise_mics_object = amod_noise_construct(cfgs->mod_noise_mics_config, - cfgs->msg_spectra_mics_config, - cfgs->msg_powers_mics_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->acon_powers_mics_object = acon_powers_construct(1, objs->nMessages, cfgs->msg_powers_mics_config); - - // +------------------------------------------------------+ - // | SSL | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_ssl_object = amod_ssl_construct(cfgs->mod_ssl_config, - cfgs->msg_spectra_mics_config, - cfgs->msg_pots_ssl_config); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - objs->asnk_pots_ssl_object = asnk_pots_construct(cfgs->snk_pots_ssl_config, - cfgs->msg_pots_ssl_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->acon_pots_ssl_object = acon_pots_construct(2, objs->nMessages, cfgs->msg_pots_ssl_config); - - // +------------------------------------------------------+ - // | Target | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Injector | - // +--------------------------------------------------+ - - objs->ainj_targets_sst_object = ainj_targets_construct(cfgs->inj_targets_sst_config, - cfgs->msg_hops_mics_rs_config, - cfgs->msg_targets_sst_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->acon_targets_sst_object = acon_targets_construct(1, objs->nMessages, cfgs->msg_targets_sst_config); - - // +------------------------------------------------------+ - // | SST | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_sst_object = amod_sst_construct(cfgs->mod_sst_config, - cfgs->mod_ssl_config, - cfgs->msg_pots_ssl_config, - cfgs->msg_targets_sst_config, - cfgs->msg_tracks_sst_config); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - objs->asnk_tracks_sst_object = asnk_tracks_construct(cfgs->snk_tracks_sst_config, - cfgs->msg_tracks_sst_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->acon_tracks_sst_object = acon_tracks_construct(3, objs->nMessages, cfgs->msg_tracks_sst_config); - - // +------------------------------------------------------+ - // | SSS | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_sss_object = amod_sss_construct(cfgs->mod_sss_config, - cfgs->msg_tracks_sst_config, - cfgs->msg_spectra_mics_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->acon_spectra_seps_object = acon_spectra_construct(1, objs->nMessages, cfgs->msg_spectra_seps_config); - objs->acon_spectra_pfs_object = acon_spectra_construct(1, objs->nMessages, cfgs->msg_spectra_pfs_config); - - // +------------------------------------------------------+ - // | ISTFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_istft_seps_object = amod_istft_construct(cfgs->mod_istft_seps_config, - cfgs->msg_spectra_seps_config, - cfgs->msg_hops_seps_config); - - objs->amod_istft_pfs_object = amod_istft_construct(cfgs->mod_istft_pfs_config, - cfgs->msg_spectra_pfs_config, - cfgs->msg_hops_pfs_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->acon_hops_seps_object = acon_hops_construct(2, objs->nMessages, cfgs->msg_hops_seps_config); - objs->acon_hops_pfs_object = acon_hops_construct(1, objs->nMessages, cfgs->msg_hops_pfs_config); - - // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_resample_seps_object = amod_resample_construct(cfgs->mod_resample_seps_config, - cfgs->msg_hops_seps_config, - cfgs->msg_hops_seps_rs_config); - - objs->amod_resample_pfs_object = amod_resample_construct(cfgs->mod_resample_pfs_config, - cfgs->msg_hops_pfs_config, - cfgs->msg_hops_pfs_rs_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->acon_hops_seps_rs_object = acon_hops_construct(1, objs->nMessages, cfgs->msg_hops_seps_rs_config); - - objs->acon_hops_pfs_rs_object = acon_hops_construct(1, objs->nMessages, cfgs->msg_hops_pfs_rs_config); - - // +------------------------------------------------------+ - // | Volume | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_volume_seps_object = amod_volume_construct(cfgs->mod_volume_seps_config, - cfgs->msg_hops_seps_vol_config); - - objs->amod_volume_pfs_object = amod_volume_construct(cfgs->mod_volume_pfs_config, - cfgs->msg_hops_pfs_vol_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->acon_hops_seps_vol_object = acon_hops_construct(1, objs->nMessages, cfgs->msg_hops_seps_vol_config); - - objs->acon_hops_pfs_vol_object = acon_hops_construct(1, objs->nMessages, cfgs->msg_hops_pfs_vol_config); - - // +--------------------------------------------------+ - // | Sink | - // +--------------------------------------------------+ - - objs->asnk_hops_seps_vol_object = asnk_hops_construct(cfgs->snk_hops_seps_vol_config, - cfgs->msg_hops_seps_vol_config); - - objs->asnk_hops_pfs_vol_object = asnk_hops_construct(cfgs->snk_hops_pfs_vol_config, - cfgs->msg_hops_pfs_vol_config); - - // +------------------------------------------------------+ - // | Classify | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_classify_object = amod_classify_construct(cfgs->mod_classify_config, - cfgs->msg_hops_seps_config, - cfgs->msg_tracks_sst_config, - cfgs->msg_categories_config); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - objs->acon_categories_object = acon_categories_construct(1, objs->nMessages, cfgs->msg_categories_config); - - // +--------------------------------------------------+ - // | Sink | - // +--------------------------------------------------+ - - objs->asnk_categories_object = asnk_categories_construct(cfgs->snk_categories_config, - cfgs->msg_categories_config); - - // +----------------------------------------------------------+ - // | Connect | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Raw | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Source | - // +--------------------------------------------------+ - - asrc_hops_connect(objs->asrc_hops_mics_object, - objs->acon_hops_mics_raw_object->in); - - // +------------------------------------------------------+ - // | Mapping | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_mapping_connect(objs->amod_mapping_mics_object, - objs->acon_hops_mics_raw_object->outs[0], - objs->acon_hops_mics_map_object->in); - - // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_resample_connect(objs->amod_resample_mics_object, - objs->acon_hops_mics_map_object->outs[0], - objs->acon_hops_mics_rs_object->in); - - // +------------------------------------------------------+ - // | STFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_stft_connect(objs->amod_stft_mics_object, - objs->acon_hops_mics_rs_object->outs[0], - objs->acon_spectra_mics_object->in); - - // +------------------------------------------------------+ - // | Noise | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_noise_connect(objs->amod_noise_mics_object, - objs->acon_spectra_mics_object->outs[0], - objs->acon_powers_mics_object->in); - - // +------------------------------------------------------+ - // | SSL | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_ssl_connect(objs->amod_ssl_object, - objs->acon_spectra_mics_object->outs[1], - objs->acon_pots_ssl_object->in); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - asnk_pots_connect(objs->asnk_pots_ssl_object, - objs->acon_pots_ssl_object->outs[1]); - - // +------------------------------------------------------+ - // | Target | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Injector | - // +--------------------------------------------------+ - - ainj_targets_connect(objs->ainj_targets_sst_object, - objs->acon_hops_mics_rs_object->outs[1], - objs->acon_targets_sst_object->in); - - // +------------------------------------------------------+ - // | SST | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_sst_connect(objs->amod_sst_object, - objs->acon_pots_ssl_object->outs[0], - objs->acon_targets_sst_object->outs[0], - objs->acon_tracks_sst_object->in); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - asnk_tracks_connect(objs->asnk_tracks_sst_object, - objs->acon_tracks_sst_object->outs[2]); - - // +------------------------------------------------------+ - // | SSS | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_sss_connect(objs->amod_sss_object, - objs->acon_spectra_mics_object->outs[2], - objs->acon_powers_mics_object->outs[0], - objs->acon_tracks_sst_object->outs[0], - objs->acon_spectra_seps_object->in, - objs->acon_spectra_pfs_object->in); - - // +------------------------------------------------------+ - // | ISTFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_istft_connect(objs->amod_istft_seps_object, - objs->acon_spectra_seps_object->outs[0], - objs->acon_hops_seps_object->in); - - amod_istft_connect(objs->amod_istft_pfs_object, - objs->acon_spectra_pfs_object->outs[0], - objs->acon_hops_pfs_object->in); - - // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_resample_connect(objs->amod_resample_seps_object, - objs->acon_hops_seps_object->outs[0], - objs->acon_hops_seps_rs_object->in); - - amod_resample_connect(objs->amod_resample_pfs_object, - objs->acon_hops_pfs_object->outs[0], - objs->acon_hops_pfs_rs_object->in); - - // +------------------------------------------------------+ - // | Volume | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_volume_connect(objs->amod_volume_seps_object, - objs->acon_hops_seps_rs_object->outs[0], - objs->acon_hops_seps_vol_object->in); - - amod_volume_connect(objs->amod_volume_pfs_object, - objs->acon_hops_pfs_rs_object->outs[0], - objs->acon_hops_pfs_vol_object->in); - - // +--------------------------------------------------+ - // | Sink | - // +--------------------------------------------------+ - - asnk_hops_connect(objs->asnk_hops_seps_vol_object, - objs->acon_hops_seps_vol_object->outs[0]); - - asnk_hops_connect(objs->asnk_hops_pfs_vol_object, - objs->acon_hops_pfs_vol_object->outs[0]); - - // +------------------------------------------------------+ - // | Classify | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_classify_connect(objs->amod_classify_object, - objs->acon_hops_seps_object->outs[1], - objs->acon_tracks_sst_object->outs[1], - objs->acon_categories_object->in); - - // +--------------------------------------------------+ - // | Sink | - // +--------------------------------------------------+ - - asnk_categories_connect(objs->asnk_categories_object, - objs->acon_categories_object->outs[0]); - - // +----------------------------------------------------------+ - // | Enable modules | - // +----------------------------------------------------------+ - - amod_mapping_enable(objs->amod_mapping_mics_object); - amod_resample_enable(objs->amod_resample_mics_object); - amod_stft_enable(objs->amod_stft_mics_object); - - if (cfgs->snk_pots_ssl_config->interface->type != interface_blackhole) { - - amod_ssl_enable(objs->amod_ssl_object); - - } - - if (cfgs->snk_tracks_sst_config->interface->type != interface_blackhole) { - - amod_ssl_enable(objs->amod_ssl_object); - amod_sst_enable(objs->amod_sst_object); - - } - - if (cfgs->snk_hops_seps_vol_config->interface->type != interface_blackhole) { - - amod_ssl_enable(objs->amod_ssl_object); - amod_sst_enable(objs->amod_sst_object); - amod_noise_enable(objs->amod_noise_mics_object); - amod_sss_enable(objs->amod_sss_object); - amod_istft_enable(objs->amod_istft_seps_object); - amod_resample_enable(objs->amod_resample_seps_object); - amod_volume_enable(objs->amod_volume_seps_object); - - } - - if (cfgs->snk_hops_pfs_vol_config->interface->type != interface_blackhole) { - - amod_ssl_enable(objs->amod_ssl_object); - amod_sst_enable(objs->amod_sst_object); - amod_noise_enable(objs->amod_noise_mics_object); - amod_sss_enable(objs->amod_sss_object); - amod_istft_enable(objs->amod_istft_pfs_object); - amod_resample_enable(objs->amod_resample_pfs_object); - amod_volume_enable(objs->amod_volume_pfs_object); - - } - - if (cfgs->snk_categories_config->interface->type != interface_blackhole) { - - amod_ssl_enable(objs->amod_ssl_object); - amod_sst_enable(objs->amod_sst_object); - amod_noise_enable(objs->amod_noise_mics_object); - amod_sss_enable(objs->amod_sss_object); - amod_istft_enable(objs->amod_istft_seps_object); - amod_classify_enable(objs->amod_classify_object); - - } - - return objs; - - } - - void aobjects_destroy(aobjects * objs) { - - unsigned int iSink; - - // +----------------------------------------------------------+ - // | Destroy | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Raw | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Source | - // +--------------------------------------------------+ - - asrc_hops_destroy(objs->asrc_hops_mics_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - acon_hops_destroy(objs->acon_hops_mics_raw_object); - - // +------------------------------------------------------+ - // | Mapping | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_mapping_destroy(objs->amod_mapping_mics_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - acon_hops_destroy(objs->acon_hops_mics_map_object); - - // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_resample_destroy(objs->amod_resample_mics_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - acon_hops_destroy(objs->acon_hops_mics_rs_object); - - // +------------------------------------------------------+ - // | STFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_stft_destroy(objs->amod_stft_mics_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - acon_spectra_destroy(objs->acon_spectra_mics_object); - - // +------------------------------------------------------+ - // | Noise | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_noise_destroy(objs->amod_noise_mics_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - acon_powers_destroy(objs->acon_powers_mics_object); - - // +------------------------------------------------------+ - // | SSL | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_ssl_destroy(objs->amod_ssl_object); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - asnk_pots_destroy(objs->asnk_pots_ssl_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - acon_pots_destroy(objs->acon_pots_ssl_object); - - // +------------------------------------------------------+ - // | Target | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Injector | - // +--------------------------------------------------+ - - ainj_targets_destroy(objs->ainj_targets_sst_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - acon_targets_destroy(objs->acon_targets_sst_object); - - // +------------------------------------------------------+ - // | SST | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_sst_destroy(objs->amod_sst_object); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - asnk_tracks_destroy(objs->asnk_tracks_sst_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - acon_tracks_destroy(objs->acon_tracks_sst_object); - - // +------------------------------------------------------+ - // | SSS | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_sss_destroy(objs->amod_sss_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - acon_spectra_destroy(objs->acon_spectra_seps_object); - acon_spectra_destroy(objs->acon_spectra_pfs_object); - - // +------------------------------------------------------+ - // | ISTFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_istft_destroy(objs->amod_istft_seps_object); - amod_istft_destroy(objs->amod_istft_pfs_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - acon_hops_destroy(objs->acon_hops_seps_object); - acon_hops_destroy(objs->acon_hops_pfs_object); - - // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_resample_destroy(objs->amod_resample_seps_object); - amod_resample_destroy(objs->amod_resample_pfs_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - acon_hops_destroy(objs->acon_hops_seps_rs_object); - acon_hops_destroy(objs->acon_hops_pfs_rs_object); - - // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_volume_destroy(objs->amod_volume_seps_object); - amod_volume_destroy(objs->amod_volume_pfs_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - acon_hops_destroy(objs->acon_hops_seps_vol_object); - acon_hops_destroy(objs->acon_hops_pfs_vol_object); - - // +--------------------------------------------------+ - // | Sink | - // +--------------------------------------------------+ - - asnk_hops_destroy(objs->asnk_hops_seps_vol_object); - asnk_hops_destroy(objs->asnk_hops_pfs_vol_object); - - // +------------------------------------------------------+ - // | Classify | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_classify_destroy(objs->amod_classify_object); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - acon_categories_destroy(objs->acon_categories_object); - - // +--------------------------------------------------+ - // | Sink | - // +--------------------------------------------------+ - - asnk_categories_destroy(objs->asnk_categories_object); - - free((void *) objs); - - } \ No newline at end of file diff --git a/demo/odascore/objects.h b/demo/odascore/objects.h deleted file mode 100644 index dbb3abf..0000000 --- a/demo/odascore/objects.h +++ /dev/null @@ -1,130 +0,0 @@ -#ifndef __DEMO_OBJECTS -#define __DEMO_OBJECTS - - #include "configs.h" - - #include - #include - #include - - typedef struct objects { - - src_hops_obj * src_hops_mics_object; - con_hops_obj * con_hops_mics_raw_object; - - mod_mapping_obj * mod_mapping_mics_object; - con_hops_obj * con_hops_mics_map_object; - - mod_resample_obj * mod_resample_mics_object; - con_hops_obj * con_hops_mics_rs_object; - - mod_stft_obj * mod_stft_mics_object; - con_spectra_obj * con_spectra_mics_object; - - mod_noise_obj * mod_noise_mics_object; - con_powers_obj * con_powers_mics_object; - - mod_ssl_obj * mod_ssl_object; - snk_pots_obj * snk_pots_ssl_object; - con_pots_obj * con_pots_ssl_object; - - inj_targets_obj * inj_targets_sst_object; - con_targets_obj * con_targets_sst_object; - - mod_sst_obj * mod_sst_object; - snk_tracks_obj * snk_tracks_sst_object; - con_tracks_obj * con_tracks_sst_object; - - mod_sss_obj * mod_sss_object; - con_spectra_obj * con_spectra_seps_object; - con_spectra_obj * con_spectra_pfs_object; - - mod_istft_obj * mod_istft_seps_object; - mod_istft_obj * mod_istft_pfs_object; - con_hops_obj * con_hops_seps_object; - con_hops_obj * con_hops_pfs_object; - - mod_resample_obj * mod_resample_seps_object; - mod_resample_obj * mod_resample_pfs_object; - con_hops_obj * con_hops_seps_rs_object; - con_hops_obj * con_hops_pfs_rs_object; - - mod_volume_obj * mod_volume_seps_object; - mod_volume_obj * mod_volume_pfs_object; - con_hops_obj * con_hops_seps_vol_object; - con_hops_obj * con_hops_pfs_vol_object; - snk_hops_obj * snk_hops_seps_vol_object; - snk_hops_obj * snk_hops_pfs_vol_object; - - mod_classify_obj * mod_classify_object; - con_categories_obj * con_categories_object; - snk_categories_obj * snk_categories_object; - - } objects; - - typedef struct aobjects { - - unsigned int nMessages; - - asrc_hops_obj * asrc_hops_mics_object; - acon_hops_obj * acon_hops_mics_raw_object; - - amod_mapping_obj * amod_mapping_mics_object; - acon_hops_obj * acon_hops_mics_map_object; - - amod_resample_obj * amod_resample_mics_object; - acon_hops_obj * acon_hops_mics_rs_object; - - amod_stft_obj * amod_stft_mics_object; - acon_spectra_obj * acon_spectra_mics_object; - - amod_noise_obj * amod_noise_mics_object; - acon_powers_obj * acon_powers_mics_object; - - amod_ssl_obj * amod_ssl_object; - asnk_pots_obj * asnk_pots_ssl_object; - acon_pots_obj * acon_pots_ssl_object; - - ainj_targets_obj * ainj_targets_sst_object; - acon_targets_obj * acon_targets_sst_object; - - amod_sst_obj * amod_sst_object; - asnk_tracks_obj * asnk_tracks_sst_object; - acon_tracks_obj * acon_tracks_sst_object; - - amod_sss_obj * amod_sss_object; - acon_spectra_obj * acon_spectra_seps_object; - acon_spectra_obj * acon_spectra_pfs_object; - - amod_istft_obj * amod_istft_seps_object; - amod_istft_obj * amod_istft_pfs_object; - acon_hops_obj * acon_hops_seps_object; - acon_hops_obj * acon_hops_pfs_object; - - amod_resample_obj * amod_resample_seps_object; - amod_resample_obj * amod_resample_pfs_object; - acon_hops_obj * acon_hops_seps_rs_object; - acon_hops_obj * acon_hops_pfs_rs_object; - - amod_volume_obj * amod_volume_seps_object; - amod_volume_obj * amod_volume_pfs_object; - acon_hops_obj * acon_hops_seps_vol_object; - acon_hops_obj * acon_hops_pfs_vol_object; - asnk_hops_obj * asnk_hops_seps_vol_object; - asnk_hops_obj * asnk_hops_pfs_vol_object; - - amod_classify_obj * amod_classify_object; - acon_categories_obj * acon_categories_object; - asnk_categories_obj * asnk_categories_object; - - } aobjects; - - objects * objects_construct(const configs * cfgs); - - void objects_destroy(objects * objs); - - aobjects * aobjects_construct(const configs * cfgs); - - void aobjects_destroy(aobjects * objs); - -#endif \ No newline at end of file diff --git a/demo/odascore/parameters.c b/demo/odascore/parameters.c deleted file mode 100644 index eb0777a..0000000 --- a/demo/odascore/parameters.c +++ /dev/null @@ -1,2076 +0,0 @@ - - #include "parameters.h" - - int parameters_lookup_int(const char * file, const char * path) { - - config_t cfg; - config_setting_t * setting; - int rtnValue; - - config_init(&cfg); - - if(!config_read_file(&cfg, file)) - { - - printf("%s:%d - %s\n", config_error_file(&cfg), config_error_line(&cfg), config_error_text(&cfg)); - config_destroy(&cfg); - - exit(EXIT_FAILURE); - - } - - if ((setting = config_lookup(&cfg, path)) == NULL) { - - printf("Cannot find path \"%s\" in config file \"%s\"\n",path,file); - - exit(EXIT_FAILURE); - - } - - rtnValue = config_setting_get_int(setting); - - config_destroy(&cfg); - - return rtnValue; - - } - - float parameters_lookup_float(const char * file, const char * path) { - - config_t cfg; - config_setting_t * setting; - float rtnValue; - - config_init(&cfg); - - if(!config_read_file(&cfg, file)) - { - - printf("%s:%d - %s\n", config_error_file(&cfg), config_error_line(&cfg), config_error_text(&cfg)); - config_destroy(&cfg); - - exit(EXIT_FAILURE); - - } - - if ((setting = config_lookup(&cfg, path)) == NULL) { - - printf("Cannot find path \"%s\" in config file \"%s\"\n",path,file); - - exit(EXIT_FAILURE); - - } - - rtnValue = (float) config_setting_get_float(setting); - - config_destroy(&cfg); - - return rtnValue; - - } - - char * parameters_lookup_string(const char * file, const char * path) { - - config_t cfg; - config_setting_t * setting; - const char * tmpStr; - char * rtnStr; - - config_init(&cfg); - - if(!config_read_file(&cfg, file)) - { - - printf("%s:%d - %s\n", config_error_file(&cfg), config_error_line(&cfg), config_error_text(&cfg)); - config_destroy(&cfg); - - exit(EXIT_FAILURE); - - } - - if ((setting = config_lookup(&cfg, path)) == NULL) { - - printf("Cannot find path \"%s\" in config file \"%s\"\n",path,file); - - exit(EXIT_FAILURE); - - } - - tmpStr = config_setting_get_string(setting); - - rtnStr = (char *) malloc(sizeof(char) * (strlen(tmpStr)+1)); - strcpy(rtnStr, tmpStr); - - config_destroy(&cfg); - - return rtnStr; - - } - - unsigned int parameters_count(const char * file, const char * path) { - - config_t cfg; - config_setting_t * setting; - unsigned int rtnValue; - - config_init(&cfg); - - if(!config_read_file(&cfg, file)) - { - - printf("%s:%d - %s\n", config_error_file(&cfg), config_error_line(&cfg), config_error_text(&cfg)); - config_destroy(&cfg); - - exit(EXIT_FAILURE); - - } - - if ((setting = config_lookup(&cfg, path)) == NULL) { - - printf("Cannot find path \"%s\" in config file \"%s\"\n",path,file); - - exit(EXIT_FAILURE); - - } - - rtnValue = config_setting_length(setting); - - config_destroy(&cfg); - - return rtnValue; - - } - - src_hops_cfg * parameters_src_hops_mics_config(const char * fileConfig) { - - src_hops_cfg * cfg; - char * tmpStr1; - char * tmpStr2; - unsigned int tmpInt1; - unsigned int tmpInt2; - - cfg = src_hops_cfg_construct(); - - // +----------------------------------------------------------+ - // | Format | - // +----------------------------------------------------------+ - - tmpInt1 = parameters_lookup_int(fileConfig, "raw.nBits"); - - if ((tmpInt1 == 8) || (tmpInt1 == 16) || (tmpInt1 == 24) || (tmpInt1 == 32)) { - cfg->format = format_construct_binary_int(tmpInt1); - } - else { - printf("raw.nBits: Invalid number of bits\n"); - exit(EXIT_FAILURE); - } - - // +----------------------------------------------------------+ - // | Interface | - // +----------------------------------------------------------+ - - tmpStr1 = parameters_lookup_string(fileConfig, "raw.interface.type"); - - if (strcmp(tmpStr1, "file") == 0) { - - tmpStr2 = parameters_lookup_string(fileConfig, "raw.interface.path"); - - cfg->interface = interface_construct_file(tmpStr2); - - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "socket") == 0) { - - tmpStr2 = parameters_lookup_string(fileConfig, "raw.interface.ip"); - tmpInt1 = parameters_lookup_int(fileConfig, "raw.interface.port"); - - cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); - - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "soundcard") == 0) { - - tmpInt1 = parameters_lookup_int(fileConfig, "raw.interface.card"); - tmpInt2 = parameters_lookup_int(fileConfig, "raw.interface.device"); - - cfg->interface = interface_construct_soundcard(tmpInt1, tmpInt2); - - } - else if (strcmp(tmpStr1, "soundcard_name") == 0) { - - tmpStr2 = parameters_lookup_string(fileConfig, "raw.interface.devicename"); - - cfg->interface = interface_construct_soundcard_by_name(tmpStr2); - - } - else { - printf("raw.interface.type: Invalid type\n"); - exit(EXIT_FAILURE); - } - - free((void *) tmpStr1); - - return cfg; - - } - - msg_hops_cfg * parameters_msg_hops_mics_raw_config(const char * fileConfig) { - - msg_hops_cfg * cfg; - - cfg = msg_hops_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "raw.fS"); - - // +----------------------------------------------------------+ - // | Hop size | - // +----------------------------------------------------------+ - - cfg->hopSize = parameters_lookup_int(fileConfig, "raw.hopSize"); - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - cfg->nChannels = parameters_lookup_int(fileConfig, "raw.nChannels"); - - return cfg; - - } - - - mod_mapping_cfg * parameters_mod_mapping_mics_config(const char * fileConfig) { - - mod_mapping_cfg * cfg; - unsigned int nLinks; - unsigned int iLink; - char * tmpStr1; - - cfg = mod_mapping_cfg_construct(); - - // +----------------------------------------------------------+ - // | Links | - // +----------------------------------------------------------+ - - nLinks = parameters_count(fileConfig, "mapping.map"); - cfg->links = links_construct_zero(nLinks); - - for (iLink = 0; iLink < nLinks; iLink++) { - - tmpStr1 = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpStr1, "mapping.map.[%u]", iLink); - cfg->links->array[iLink] = parameters_lookup_int(fileConfig, tmpStr1); - free((void *) tmpStr1); - - } - - return cfg; - - } - - msg_hops_cfg * parameters_msg_hops_mics_map_config(const char * fileConfig) { - - msg_hops_cfg * cfg; - - cfg = msg_hops_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "raw.fS"); - - // +----------------------------------------------------------+ - // | Hop size | - // +----------------------------------------------------------+ - - cfg->hopSize = parameters_lookup_int(fileConfig, "raw.hopSize"); - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - cfg->nChannels = parameters_count(fileConfig, "mapping.map"); - - return cfg; - - } - - mod_resample_cfg * parameters_mod_resample_mics_config(const char * fileConfig) { - - mod_resample_cfg * cfg; - - unsigned int tmpInt1; - unsigned int tmpInt2; - - cfg = mod_resample_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rates | - // +----------------------------------------------------------+ - - tmpInt1 = parameters_lookup_int(fileConfig, "raw.fS"); - tmpInt2 = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - if (tmpInt1 < tmpInt2) { - printf("general.samplerate.mu: This sample rate must be smaller or equal to raw.fS"); - exit(EXIT_FAILURE); - } - - cfg->fSin = tmpInt1; - cfg->fSout = tmpInt2; - - return cfg; - - } - - msg_hops_cfg * parameters_msg_hops_mics_rs_config(const char * fileConfig) { - - msg_hops_cfg * cfg; - - cfg = msg_hops_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Hop size | - // +----------------------------------------------------------+ - - cfg->hopSize = parameters_lookup_int(fileConfig, "general.size.hopSize"); - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - cfg->nChannels = parameters_count(fileConfig, "mapping.map"); - - return cfg; - - } - - mod_stft_cfg * parameters_mod_stft_mics_config(const char * fileConfig) { - - mod_stft_cfg * cfg; - - cfg = mod_stft_cfg_construct(); - - return cfg; - - } - - msg_spectra_cfg * parameters_msg_spectra_mics_config(const char * fileConfig) { - - msg_spectra_cfg * cfg; - - unsigned int halfFrameSize; - unsigned int nChannels; - unsigned int fS; - - cfg = msg_spectra_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Hop size | - // +----------------------------------------------------------+ - - cfg->halfFrameSize = parameters_lookup_int(fileConfig, "general.size.frameSize") / 2 + 1; - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - cfg->nChannels = parameters_count(fileConfig, "mapping.map"); - - return cfg; - - } - - mod_noise_cfg * parameters_mod_noise_mics_config(const char * fileConfig) { - - mod_noise_cfg * cfg; - - cfg = mod_noise_cfg_construct(); - - // +----------------------------------------------------------+ - // | Hanning window size | - // +----------------------------------------------------------+ - - cfg->bSize = parameters_lookup_int(fileConfig, "sne.b"); - - // +----------------------------------------------------------+ - // | alphaS | - // +----------------------------------------------------------+ - - cfg->alphaS = parameters_lookup_float(fileConfig, "sne.alphaS"); - - // +----------------------------------------------------------+ - // | Number of frames | - // +----------------------------------------------------------+ - - cfg->L = parameters_lookup_int(fileConfig, "sne.L"); - - // +----------------------------------------------------------+ - // | delta | - // +----------------------------------------------------------+ - - cfg->delta = parameters_lookup_float(fileConfig, "sne.delta"); - - // +----------------------------------------------------------+ - // | alphaD | - // +----------------------------------------------------------+ - - cfg->alphaD = parameters_lookup_float(fileConfig, "sne.alphaD"); - - return cfg; - - } - - msg_powers_cfg * parameters_msg_powers_mics_config(const char * fileConfig) { - - msg_powers_cfg * cfg; - - unsigned int halfFrameSize; - unsigned int nChannels; - unsigned int fS; - - cfg = msg_powers_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Hop size | - // +----------------------------------------------------------+ - - cfg->halfFrameSize = parameters_lookup_int(fileConfig, "general.size.frameSize") / 2 + 1; - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - cfg->nChannels = parameters_count(fileConfig, "mapping.map"); - - return cfg; - - } - - mod_ssl_cfg * parameters_mod_ssl_config(const char * fileConfig) { - - mod_ssl_cfg * cfg; - - unsigned int nChannels; - unsigned int nFilters; - unsigned int iChannel; - unsigned int iFilter; - unsigned int iSample; - unsigned int iLevel; - - char * tmpLabel; - char * tmpString; - - cfg = mod_ssl_cfg_construct(); - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - nChannels = parameters_count(fileConfig, "general.mics"); - - cfg->mics = mics_construct_zero(nChannels); - - for (iChannel = 0; iChannel < nChannels; iChannel++) { - - // +--------------------------------------------------+ - // | Mu | - // +--------------------------------------------------+ - - for (iSample = 0; iSample < 3; iSample++) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "general.mics.[%u].mu.[%u]", iChannel, iSample); - cfg->mics->mu[iChannel * 3 + iSample] = parameters_lookup_float(fileConfig, tmpLabel); - free((void *) tmpLabel); - - } - - // +--------------------------------------------------+ - // | Sigma2 | - // +--------------------------------------------------+ - - for (iSample = 0; iSample < 9; iSample++) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "general.mics.[%u].sigma2.[%u]", iChannel, iSample); - cfg->mics->sigma2[iChannel * 9 + iSample] = parameters_lookup_float(fileConfig, tmpLabel); - free((void *) tmpLabel); - - } - - // +--------------------------------------------------+ - // | Direction | - // +--------------------------------------------------+ - - for (iSample = 0; iSample < 3; iSample++) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "general.mics.[%u].direction.[%u]", iChannel, iSample); - cfg->mics->direction[iChannel * 3 + iSample] = parameters_lookup_float(fileConfig, tmpLabel); - free((void *) tmpLabel); - - } - - // +--------------------------------------------------+ - // | Angle | - // +--------------------------------------------------+ - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "general.mics.[%u].angle.[%u]", iChannel, 0); - cfg->mics->thetaAllPass[iChannel] = parameters_lookup_float(fileConfig, tmpLabel); - free((void *) tmpLabel); - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "general.mics.[%u].angle.[%u]", iChannel, 1); - cfg->mics->thetaNoPass[iChannel] = parameters_lookup_float(fileConfig, tmpLabel); - free((void *) tmpLabel); - - } - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->samplerate = samplerate_construct_zero(); - - cfg->samplerate->mu = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - cfg->samplerate->sigma2 = parameters_lookup_float(fileConfig, "general.samplerate.sigma2"); - - // +----------------------------------------------------------+ - // | Sound speed | - // +----------------------------------------------------------+ - - cfg->soundspeed = soundspeed_construct_zero(); - - cfg->soundspeed->mu = parameters_lookup_float(fileConfig, "general.speedofsound.mu"); - cfg->soundspeed->sigma2 = parameters_lookup_float(fileConfig, "general.speedofsound.sigma2"); - - // +----------------------------------------------------------+ - // | Interpolation | - // +----------------------------------------------------------+ - - cfg->interpRate = parameters_lookup_int(fileConfig, "ssl.interpRate"); - - // +----------------------------------------------------------+ - // | Epsilon | - // +----------------------------------------------------------+ - - cfg->epsilon = parameters_lookup_float(fileConfig, "general.epsilon"); - - // +----------------------------------------------------------+ - // | Levels | - // +----------------------------------------------------------+ - - cfg->nLevels = parameters_count(fileConfig, "ssl.scans"); - - cfg->levels = (unsigned int *) malloc(sizeof(unsigned int) * cfg->nLevels); - cfg->deltas = (signed int *) malloc(sizeof(signed int) * cfg->nLevels); - - for (iLevel = 0; iLevel < cfg->nLevels; iLevel++) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "ssl.scans.[%u].level", iLevel); - cfg->levels[iLevel] = parameters_lookup_int(fileConfig, tmpLabel); - free((void *) tmpLabel); - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "ssl.scans.[%u].delta", iLevel); - cfg->deltas[iLevel] = parameters_lookup_int(fileConfig, tmpLabel); - free((void *) tmpLabel); - - } - - // +----------------------------------------------------------+ - // | Matches | - // +----------------------------------------------------------+ - - cfg->nMatches = parameters_lookup_int(fileConfig, "ssl.nMatches"); - - // +----------------------------------------------------------+ - // | Minimum probability | - // +----------------------------------------------------------+ - - cfg->probMin = parameters_lookup_float(fileConfig, "ssl.probMin"); - - // +----------------------------------------------------------+ - // | Number of refined levels | - // +----------------------------------------------------------+ - - cfg->nRefinedLevels = parameters_lookup_int(fileConfig, "ssl.nRefinedLevels"); - - // +----------------------------------------------------------+ - // | Number of thetas | - // +----------------------------------------------------------+ - - cfg->nThetas = parameters_lookup_int(fileConfig, "general.nThetas"); - - // +----------------------------------------------------------+ - // | Number of thetas | - // +----------------------------------------------------------+ - - cfg->gainMin = parameters_lookup_float(fileConfig, "general.gainMin"); - - // +----------------------------------------------------------+ - // | Spatial filter | - // +----------------------------------------------------------+ - - nFilters = parameters_count(fileConfig, "general.spatialfilters"); - - cfg->spatialfilters = spatialfilters_construct_zero(nFilters); - - for (iFilter = 0; iFilter < nFilters; iFilter++) { - - // +--------------------------------------------------+ - // | Direction | - // +--------------------------------------------------+ - - for (iSample = 0; iSample < 3; iSample++) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "general.spatialfilters.[%u].direction.[%u]", iFilter, iSample); - cfg->spatialfilters->direction[iFilter * 3 + iSample] = parameters_lookup_float(fileConfig, tmpLabel); - free((void *) tmpLabel); - - } - - // +--------------------------------------------------+ - // | thetaAllPass | - // +--------------------------------------------------+ - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "general.spatialfilters.[%u].angle.[0]", iFilter); - cfg->spatialfilters->thetaAllPass[iFilter] = parameters_lookup_float(fileConfig, tmpLabel); - free((void *) tmpLabel); - - // +--------------------------------------------------+ - // | thetaNoPass | - // +--------------------------------------------------+ - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "general.spatialfilters.[%u].angle.[1]", iFilter); - cfg->spatialfilters->thetaNoPass[iFilter] = parameters_lookup_float(fileConfig, tmpLabel); - free((void *) tmpLabel); - - } - - return cfg; - - } - - msg_pots_cfg * parameters_msg_pots_ssl_config(const char * fileConfig) { - - msg_pots_cfg * cfg; - - cfg = msg_pots_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Number of potential sources | - // +----------------------------------------------------------+ - - cfg->nPots = parameters_lookup_int(fileConfig, "ssl.nPots"); - - return cfg; - - } - - snk_pots_cfg * parameters_snk_pots_ssl_config(const char * fileConfig) { - - snk_pots_cfg * cfg; - char * tmpStr1; - char * tmpStr2; - char * tmpLabel; - unsigned int tmpInt1; - unsigned int tmpInt2; - - cfg = snk_pots_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Format | - // +----------------------------------------------------------+ - - tmpStr1 = parameters_lookup_string(fileConfig, "ssl.potential.format"); - - if (strcmp(tmpStr1, "json") == 0) { cfg->format = format_construct_text_json(); } - else if (strcmp(tmpStr1, "binary") == 0) { cfg->format = format_construct_binary_float(); } - else if (strcmp(tmpStr1, "undefined") == 0) { cfg->format = format_construct_undefined(); } - else { printf("ssl.potential.format: Invalid format\n"); exit(EXIT_FAILURE); } - - free((void *) tmpStr1); - - // +----------------------------------------------------------+ - // | Interface | - // +----------------------------------------------------------+ - - tmpStr1 = parameters_lookup_string(fileConfig, "ssl.potential.interface.type"); - - if (strcmp(tmpStr1, "blackhole") == 0) { - - cfg->interface = interface_construct_blackhole(); - - } - else if (strcmp(tmpStr1, "file") == 0) { - - tmpStr2 = parameters_lookup_string(fileConfig, "ssl.potential.interface.path"); - cfg->interface = interface_construct_file(tmpStr2); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "socket") == 0) { - - tmpStr2 = parameters_lookup_string(fileConfig, "ssl.potential.interface.ip"); - tmpInt1 = parameters_lookup_int(fileConfig, "ssl.potential.interface.port"); - - cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "terminal") == 0) { - - cfg->interface = interface_construct_terminal(); - - } - else { - - printf("ssl.potential.interface.type: Invalid type\n"); - exit(EXIT_FAILURE); - - } - - free((void *) tmpStr1); - - return cfg; - - } - - inj_targets_cfg * parameters_inj_targets_sst_config(const char * fileConfig) { - - inj_targets_cfg * cfg; - unsigned int iTarget; - unsigned int nTargets; - float x, y, z; - char * tmpStr1; - char * tmpStr2; - - cfg = inj_targets_cfg_construct(); - - // +----------------------------------------------------------+ - // | Number of targets | - // +----------------------------------------------------------+ - - nTargets = parameters_count(fileConfig, "sst.target"); - - cfg->nTargets = nTargets; - - // +----------------------------------------------------------+ - // | Targets | - // +----------------------------------------------------------+ - - cfg->targets = targets_construct_zero(nTargets); - - for (iTarget = 0; iTarget < nTargets; iTarget++) { - - tmpStr1 = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpStr1, "sst.target.[%u].tag",iTarget); - tmpStr2 = parameters_lookup_string(fileConfig, tmpStr1); - free((void *) tmpStr1); - - tmpStr1 = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpStr1, "sst.target.[%u].x",iTarget); - x = parameters_lookup_float(fileConfig, tmpStr1); - free((void *) tmpStr1); - - tmpStr1 = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpStr1, "sst.target.[%u].y",iTarget); - y = parameters_lookup_float(fileConfig, tmpStr1); - free((void *) tmpStr1); - - tmpStr1 = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpStr1, "sst.target.[%u].z",iTarget); - z = parameters_lookup_float(fileConfig, tmpStr1); - free((void *) tmpStr1); - - strcpy(cfg->targets->tags[iTarget],tmpStr2); - cfg->targets->array[iTarget *3 + 0] = x; - cfg->targets->array[iTarget *3 + 1] = y; - cfg->targets->array[iTarget *3 + 2] = z; - - free((void *) tmpStr2); - - } - - return cfg; - - } - - msg_targets_cfg * parameters_msg_targets_sst_config(const char * fileConfig) { - - msg_targets_cfg * cfg; - unsigned int nTargets; - - cfg = msg_targets_cfg_construct(); - - // +----------------------------------------------------------+ - // | Number of targets | - // +----------------------------------------------------------+ - - nTargets = parameters_count(fileConfig, "sst.target"); - - cfg->nTargets = nTargets; - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - return cfg; - - } - - mod_sst_cfg * parameters_mod_sst_config(const char * fileConfig) { - - mod_sst_cfg * cfg; - - unsigned int nGaussians; - unsigned int iGaussian; - float weight; - float mu; - float sigma; - - unsigned int iTrack; - char * tmpStr1; - - cfg = mod_sst_cfg_construct(); - - // +----------------------------------------------------------+ - // | Mode | - // +----------------------------------------------------------+ - - tmpStr1 = parameters_lookup_string(fileConfig, "sst.mode"); - - if (strcmp(tmpStr1, "kalman") == 0) { - cfg->mode = 'k'; - } - else if (strcmp(tmpStr1, "particle") == 0) { - cfg->mode = 'p'; - } - else { - printf("sst.mode: Invalid filter type.\n"); - exit(EXIT_FAILURE); - } - - free((void *) tmpStr1); - - // +----------------------------------------------------------+ - // | Add | - // +----------------------------------------------------------+ - - tmpStr1 = parameters_lookup_string(fileConfig, "sst.add"); - - if (strcmp(tmpStr1, "dynamic") == 0) { - cfg->add = 'd'; - } - else if (strcmp(tmpStr1, "static") == 0) { - cfg->add = 's'; - } - else { - printf("sst.add: Invalid add type.\n"); - exit(EXIT_FAILURE); - } - - free((void *) tmpStr1); - - // +----------------------------------------------------------+ - // | nTracksMax | - // +----------------------------------------------------------+ - - cfg->nTracksMax = parameters_count(fileConfig, "sst.N_inactive"); - - // +----------------------------------------------------------+ - // | hopSize | - // +----------------------------------------------------------+ - - cfg->hopSize = parameters_lookup_int(fileConfig, "general.size.hopSize"); - - // +----------------------------------------------------------+ - // | Kalman | - // +----------------------------------------------------------+ - - cfg->sigmaQ = parameters_lookup_float(fileConfig, "sst.kalman.sigmaQ"); - - // +----------------------------------------------------------+ - // | Particles | - // +----------------------------------------------------------+ - - cfg->nParticles = parameters_lookup_int(fileConfig, "sst.particle.nParticles"); - cfg->st_alpha = parameters_lookup_float(fileConfig, "sst.particle.st_alpha"); - cfg->st_beta = parameters_lookup_float(fileConfig, "sst.particle.st_beta"); - cfg->st_ratio = parameters_lookup_float(fileConfig, "sst.particle.st_ratio"); - cfg->ve_alpha = parameters_lookup_float(fileConfig, "sst.particle.ve_alpha"); - cfg->ve_beta = parameters_lookup_float(fileConfig, "sst.particle.ve_beta"); - cfg->ve_ratio = parameters_lookup_float(fileConfig, "sst.particle.ve_ratio"); - cfg->ac_alpha = parameters_lookup_float(fileConfig, "sst.particle.ac_alpha"); - cfg->ac_beta = parameters_lookup_float(fileConfig, "sst.particle.ac_beta"); - cfg->ac_ratio = parameters_lookup_float(fileConfig, "sst.particle.ac_ratio"); - cfg->Nmin = parameters_lookup_float(fileConfig, "sst.particle.Nmin"); - - // +----------------------------------------------------------+ - // | Epsilon | - // +----------------------------------------------------------+ - - cfg->epsilon = parameters_lookup_float(fileConfig, "general.epsilon"); - - // +----------------------------------------------------------+ - // | SigmaR | - // +----------------------------------------------------------+ - - cfg->sigmaR_active = sqrtf(parameters_lookup_float(fileConfig, "sst.sigmaR2_active")); - cfg->sigmaR_prob = sqrtf(parameters_lookup_float(fileConfig, "sst.sigmaR2_prob")); - cfg->sigmaR_target = sqrtf(parameters_lookup_float(fileConfig, "sst.sigmaR2_target")); - - // +----------------------------------------------------------+ - // | GMM Active | - // +----------------------------------------------------------+ - - nGaussians = parameters_count(fileConfig, "sst.active"); - - cfg->active_gmm = gaussians_1d_construct_null(nGaussians); - - for (iGaussian = 0; iGaussian < nGaussians; iGaussian++) { - - tmpStr1 = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpStr1, "sst.active.[%u].weight",iGaussian); - weight = parameters_lookup_float(fileConfig, tmpStr1); - free((void *) tmpStr1); - - tmpStr1 = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpStr1, "sst.active.[%u].mu",iGaussian); - mu = parameters_lookup_float(fileConfig, tmpStr1); - free((void *) tmpStr1); - - tmpStr1 = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpStr1, "sst.active.[%u].sigma2",iGaussian); - sigma = sqrtf(parameters_lookup_float(fileConfig, tmpStr1)); - free((void *) tmpStr1); - - cfg->active_gmm->array[iGaussian] = gaussian_1d_construct_weightmusigma(weight, mu, sigma); - } - - // +----------------------------------------------------------+ - // | GMM Inactive | - // +----------------------------------------------------------+ - - nGaussians = parameters_count(fileConfig, "sst.inactive"); - - cfg->inactive_gmm = gaussians_1d_construct_null(nGaussians); - - for (iGaussian = 0; iGaussian < nGaussians; iGaussian++) { - - tmpStr1 = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpStr1, "sst.inactive.[%u].weight",iGaussian); - weight = parameters_lookup_float(fileConfig, tmpStr1); - free((void *) tmpStr1); - - tmpStr1 = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpStr1, "sst.inactive.[%u].mu",iGaussian); - mu = parameters_lookup_float(fileConfig, tmpStr1); - free((void *) tmpStr1); - - tmpStr1 = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpStr1, "sst.inactive.[%u].sigma2",iGaussian); - sigma = sqrtf(parameters_lookup_float(fileConfig, tmpStr1)); - free((void *) tmpStr1); - - cfg->inactive_gmm->array[iGaussian] = gaussian_1d_construct_weightmusigma(weight, mu, sigma); - } - - // +----------------------------------------------------------+ - // | Pfalse, Pnew and Ptrack | - // +----------------------------------------------------------+ - - cfg->Pfalse = parameters_lookup_float(fileConfig, "sst.Pfalse"); - cfg->Pnew = parameters_lookup_float(fileConfig, "sst.Pnew"); - cfg->Ptrack = parameters_lookup_float(fileConfig, "sst.Ptrack"); - - // +----------------------------------------------------------+ - // | New | - // +----------------------------------------------------------+ - - cfg->theta_new = parameters_lookup_float(fileConfig, "sst.theta_new"); - - // +----------------------------------------------------------+ - // | Prob | - // +----------------------------------------------------------+ - - cfg->theta_prob = parameters_lookup_float(fileConfig, "sst.theta_prob"); - cfg->N_prob = parameters_lookup_int(fileConfig, "sst.N_prob"); - - // +----------------------------------------------------------+ - // | Inactive | - // +----------------------------------------------------------+ - - cfg->theta_inactive = parameters_lookup_float(fileConfig, "sst.theta_inactive"); - cfg->N_inactive = (unsigned int *) malloc(sizeof(unsigned int) * cfg->nTracksMax); - - for (iTrack = 0; iTrack < cfg->nTracksMax; iTrack++) { - - tmpStr1 = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpStr1, "sst.N_inactive.[%u]", iTrack); - cfg->N_inactive[iTrack] = parameters_lookup_int(fileConfig, tmpStr1); - free((void *) tmpStr1); - - } - - return cfg; - - } - - msg_tracks_cfg * parameters_msg_tracks_sst_config(const char * fileConfig) { - - msg_tracks_cfg * cfg; - - cfg = msg_tracks_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Number of tracked sources | - // +----------------------------------------------------------+ - - cfg->nTracks = parameters_count(fileConfig, "sst.N_inactive"); - - return cfg; - - } - - snk_tracks_cfg * parameters_snk_tracks_sst_config(const char * fileConfig) { - - snk_tracks_cfg * cfg; - char * tmpStr1; - char * tmpStr2; - char * tmpLabel; - unsigned int tmpInt1; - unsigned int tmpInt2; - - cfg = snk_tracks_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Format | - // +----------------------------------------------------------+ - - tmpStr1 = parameters_lookup_string(fileConfig, "sst.tracked.format"); - - if (strcmp(tmpStr1, "json") == 0) { cfg->format = format_construct_text_json(); } - else if (strcmp(tmpStr1, "binary") == 0) { cfg->format = format_construct_binary_float(); } - else if (strcmp(tmpStr1, "undefined") == 0) { cfg->format = format_construct_undefined(); } - else { printf("sst.tracked.format: Invalid format\n"); exit(EXIT_FAILURE); } - - free((void *) tmpStr1); - - // +----------------------------------------------------------+ - // | Interface | - // +----------------------------------------------------------+ - - tmpStr1 = parameters_lookup_string(fileConfig, "sst.tracked.interface.type"); - - if (strcmp(tmpStr1, "blackhole") == 0) { - - cfg->interface = interface_construct_blackhole(); - - } - else if (strcmp(tmpStr1, "file") == 0) { - - tmpStr2 = parameters_lookup_string(fileConfig, "sst.tracked.interface.path"); - cfg->interface = interface_construct_file(tmpStr2); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "socket") == 0) { - - tmpStr2 = parameters_lookup_string(fileConfig, "sst.tracked.interface.ip"); - tmpInt1 = parameters_lookup_int(fileConfig, "sst.tracked.interface.port"); - - cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "terminal") == 0) { - - cfg->interface = interface_construct_terminal(); - - } - else { - - printf("sst.tracked.interface.type: Invalid type\n"); - exit(EXIT_FAILURE); - - } - - free((void *) tmpStr1); - - return cfg; - - - } - - mod_sss_cfg * parameters_mod_sss_config(const char * fileConfig) { - - mod_sss_cfg * cfg; - - unsigned int nChannels; - unsigned int iChannel; - unsigned int iSample; - - char * tmpStr1; - char * tmpLabel; - - cfg = mod_sss_cfg_construct(); - - // +----------------------------------------------------------+ - // | Mode | - // +----------------------------------------------------------+ - - tmpStr1 = parameters_lookup_string(fileConfig, "sss.mode_sep"); - - if (strcmp(tmpStr1, "dds") == 0) { - cfg->mode_sep = 'd'; - } - else if (strcmp(tmpStr1, "dgss") == 0) { - cfg->mode_sep = 'g'; - } - else if (strcmp(tmpStr1, "dmvdr") == 0) { - cfg->mode_sep = 'm'; - } - else { - printf("sss.mode_sep: Invalid separation method.\n"); - exit(EXIT_FAILURE); - } - - free((void *) tmpStr1); - - tmpStr1 = parameters_lookup_string(fileConfig, "sss.mode_pf"); - - if (strcmp(tmpStr1, "ms") == 0) { - cfg->mode_pf = 'm'; - } - else if (strcmp(tmpStr1, "ss") == 0) { - cfg->mode_pf = 's'; - } - else { - printf("sss.mode_pf: Invalid post-filtering method.\n"); - exit(EXIT_FAILURE); - } - - free((void *) tmpStr1); - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - nChannels = parameters_count(fileConfig, "general.mics"); - - cfg->mics = mics_construct_zero(nChannels); - - for (iChannel = 0; iChannel < nChannels; iChannel++) { - - // +--------------------------------------------------+ - // | Mu | - // +--------------------------------------------------+ - - for (iSample = 0; iSample < 3; iSample++) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "general.mics.[%u].mu.[%u]", iChannel, iSample); - cfg->mics->mu[iChannel * 3 + iSample] = parameters_lookup_float(fileConfig, tmpLabel); - free((void *) tmpLabel); - - } - - // +--------------------------------------------------+ - // | Sigma2 | - // +--------------------------------------------------+ - - for (iSample = 0; iSample < 9; iSample++) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "general.mics.[%u].sigma2.[%u]", iChannel, iSample); - cfg->mics->sigma2[iChannel * 9 + iSample] = parameters_lookup_float(fileConfig, tmpLabel); - free((void *) tmpLabel); - - } - - // +--------------------------------------------------+ - // | Direction | - // +--------------------------------------------------+ - - for (iSample = 0; iSample < 3; iSample++) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "general.mics.[%u].direction.[%u]", iChannel, iSample); - cfg->mics->direction[iChannel * 3 + iSample] = parameters_lookup_float(fileConfig, tmpLabel); - free((void *) tmpLabel); - - } - - // +--------------------------------------------------+ - // | Angle | - // +--------------------------------------------------+ - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "general.mics.[%u].angle.[%u]", iChannel, 0); - cfg->mics->thetaAllPass[iChannel] = parameters_lookup_float(fileConfig, tmpLabel); - free((void *) tmpLabel); - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "general.mics.[%u].angle.[%u]", iChannel, 1); - cfg->mics->thetaNoPass[iChannel] = parameters_lookup_float(fileConfig, tmpLabel); - free((void *) tmpLabel); - - } - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->samplerate = samplerate_construct_zero(); - - cfg->samplerate->mu = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - cfg->samplerate->sigma2 = parameters_lookup_float(fileConfig, "general.samplerate.sigma2"); - - // +----------------------------------------------------------+ - // | Sound speed | - // +----------------------------------------------------------+ - - cfg->soundspeed = soundspeed_construct_zero(); - - cfg->soundspeed->mu = parameters_lookup_float(fileConfig, "general.speedofsound.mu"); - cfg->soundspeed->sigma2 = parameters_lookup_float(fileConfig, "general.speedofsound.sigma2"); - - // +----------------------------------------------------------+ - // | Number of thetas | - // +----------------------------------------------------------+ - - cfg->nThetas = parameters_lookup_int(fileConfig, "general.nThetas"); - - // +----------------------------------------------------------+ - // | Number of thetas | - // +----------------------------------------------------------+ - - cfg->gainMin = parameters_lookup_float(fileConfig, "general.gainMin"); - - // +----------------------------------------------------------+ - // | Epsilon | - // +----------------------------------------------------------+ - - cfg->epsilon = parameters_lookup_float(fileConfig, "general.epsilon"); - - // +----------------------------------------------------------+ - // | Mu | - // +----------------------------------------------------------+ - - cfg->sep_gss_mu = parameters_lookup_float(fileConfig, "sss.dgss.mu"); - - // +----------------------------------------------------------+ - // | Lambda | - // +----------------------------------------------------------+ - - cfg->sep_gss_lambda = parameters_lookup_float(fileConfig, "sss.dgss.lambda"); - - // +----------------------------------------------------------+ - // | Hanning window size | - // +----------------------------------------------------------+ - - cfg->pf_ms_bSize = parameters_lookup_int(fileConfig, "sne.b"); - - // +----------------------------------------------------------+ - // | alphaS | - // +----------------------------------------------------------+ - - cfg->pf_ms_alphaS = parameters_lookup_float(fileConfig, "sne.alphaS"); - - // +----------------------------------------------------------+ - // | Number of frames | - // +----------------------------------------------------------+ - - cfg->pf_ms_L = parameters_lookup_int(fileConfig, "sne.L"); - - // +----------------------------------------------------------+ - // | delta | - // +----------------------------------------------------------+ - - cfg->pf_ms_delta = parameters_lookup_float(fileConfig, "sne.delta"); - - // +----------------------------------------------------------+ - // | alphaD | - // +----------------------------------------------------------+ - - cfg->pf_ms_alphaD = parameters_lookup_float(fileConfig, "sne.alphaD"); - - // +----------------------------------------------------------+ - // | eta | - // +----------------------------------------------------------+ - - cfg->pf_ms_eta = parameters_lookup_float(fileConfig, "sss.ms.eta"); - - // +----------------------------------------------------------+ - // | alphaZ | - // +----------------------------------------------------------+ - - cfg->pf_ms_alphaZ = parameters_lookup_float(fileConfig, "sss.ms.alphaZ"); - - // +----------------------------------------------------------+ - // | alphaPmin | - // +----------------------------------------------------------+ - - cfg->pf_ms_alphaPmin = parameters_lookup_float(fileConfig, "sss.ms.alphaPmin"); - - // +----------------------------------------------------------+ - // | thetaWin | - // +----------------------------------------------------------+ - - cfg->pf_ms_thetaWin = parameters_lookup_float(fileConfig, "sss.ms.thetaWin"); - - // +----------------------------------------------------------+ - // | alphaWin | - // +----------------------------------------------------------+ - - cfg->pf_ms_alphaWin = parameters_lookup_float(fileConfig, "sss.ms.alphaWin"); - - // +----------------------------------------------------------+ - // | maxAbsenceProb | - // +----------------------------------------------------------+ - - cfg->pf_ms_maxAbsenceProb = parameters_lookup_float(fileConfig, "sss.ms.maxAbsenceProb"); - - // +----------------------------------------------------------+ - // | Gmin | - // +----------------------------------------------------------+ - - cfg->pf_ms_Gmin = parameters_lookup_float(fileConfig, "sss.ms.Gmin"); - - // +----------------------------------------------------------+ - // | winSizeLocal | - // +----------------------------------------------------------+ - - cfg->pf_ms_winSizeLocal = parameters_lookup_int(fileConfig, "sss.ms.winSizeLocal"); - - // +----------------------------------------------------------+ - // | winSizeGlobal | - // +----------------------------------------------------------+ - - cfg->pf_ms_winSizeGlobal = parameters_lookup_int(fileConfig, "sss.ms.winSizeGlobal"); - - // +----------------------------------------------------------+ - // | winSizeFrame | - // +----------------------------------------------------------+ - - cfg->pf_ms_winSizeFrame = parameters_lookup_int(fileConfig, "sss.ms.winSizeFrame"); - - // +----------------------------------------------------------+ - // | Gmin | - // +----------------------------------------------------------+ - - cfg->pf_ss_Gmin = parameters_lookup_float(fileConfig, "sss.ss.Gmin"); - - // +----------------------------------------------------------+ - // | Gmid | - // +----------------------------------------------------------+ - - cfg->pf_ss_Gmid = parameters_lookup_float(fileConfig, "sss.ss.Gmid"); - - // +----------------------------------------------------------+ - // | Gslope | - // +----------------------------------------------------------+ - - cfg->pf_ss_Gslope = parameters_lookup_float(fileConfig, "sss.ss.Gslope"); - - return cfg; - - } - - msg_spectra_cfg * parameters_msg_spectra_seps_config(const char * fileConfig) { - - msg_spectra_cfg * cfg; - - unsigned int halfFrameSize; - unsigned int nChannels; - unsigned int fS; - - cfg = msg_spectra_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Half frame size | - // +----------------------------------------------------------+ - - cfg->halfFrameSize = parameters_lookup_int(fileConfig, "general.size.frameSize") / 2 + 1; - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); - - return cfg; - - } - - msg_spectra_cfg * parameters_msg_spectra_pfs_config(const char * fileConfig) { - - msg_spectra_cfg * cfg; - - unsigned int halfFrameSize; - unsigned int nChannels; - unsigned int fS; - - cfg = msg_spectra_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Half frame size | - // +----------------------------------------------------------+ - - cfg->halfFrameSize = parameters_lookup_int(fileConfig, "general.size.frameSize") / 2 + 1; - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); - - return cfg; - - } - - mod_istft_cfg * parameters_mod_istft_seps_config(const char * fileConfig) { - - mod_istft_cfg * cfg; - - cfg = mod_istft_cfg_construct(); - - return cfg; - - } - - mod_istft_cfg * parameters_mod_istft_pfs_config(const char * fileConfig) { - - mod_istft_cfg * cfg; - - cfg = mod_istft_cfg_construct(); - - return cfg; - - } - - msg_hops_cfg * parameters_msg_hops_seps_config(const char * fileConfig) { - - msg_hops_cfg * cfg; - - cfg = msg_hops_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Hop size | - // +----------------------------------------------------------+ - - cfg->hopSize = parameters_lookup_int(fileConfig, "general.size.hopSize"); - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); - - return cfg; - - } - - msg_hops_cfg * parameters_msg_hops_pfs_config(const char * fileConfig) { - - msg_hops_cfg * cfg; - - cfg = msg_hops_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Hop size | - // +----------------------------------------------------------+ - - cfg->hopSize = parameters_lookup_int(fileConfig, "general.size.hopSize"); - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); - - return cfg; - - } - - mod_resample_cfg * parameters_mod_resample_seps_config(const char * fileConfig) { - - mod_resample_cfg * cfg; - - unsigned int tmpInt1; - unsigned int tmpInt2; - - cfg = mod_resample_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rates | - // +----------------------------------------------------------+ - - tmpInt1 = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - tmpInt2 = parameters_lookup_int(fileConfig, "sss.separated.fS"); - - cfg->fSin = tmpInt1; - cfg->fSout = tmpInt2; - - return cfg; - - } - - mod_resample_cfg * parameters_mod_resample_pfs_config(const char * fileConfig) { - - mod_resample_cfg * cfg; - - unsigned int tmpInt1; - unsigned int tmpInt2; - - cfg = mod_resample_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rates | - // +----------------------------------------------------------+ - - tmpInt1 = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - tmpInt2 = parameters_lookup_int(fileConfig, "sss.postfiltered.fS"); - - cfg->fSin = tmpInt1; - cfg->fSout = tmpInt2; - - return cfg; - - } - - msg_hops_cfg * parameters_msg_hops_seps_rs_config(const char * fileConfig) { - - msg_hops_cfg * cfg; - - cfg = msg_hops_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "sss.separated.fS"); - - // +----------------------------------------------------------+ - // | Hop size | - // +----------------------------------------------------------+ - - cfg->hopSize = parameters_lookup_int(fileConfig, "sss.separated.hopSize"); - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); - - return cfg; - - } - - msg_hops_cfg * parameters_msg_hops_pfs_rs_config(const char * fileConfig) { - - msg_hops_cfg * cfg; - - cfg = msg_hops_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "sss.postfiltered.fS"); - - // +----------------------------------------------------------+ - // | Hop size | - // +----------------------------------------------------------+ - - cfg->hopSize = parameters_lookup_int(fileConfig, "sss.postfiltered.hopSize"); - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); - - return cfg; - - } - - mod_volume_cfg * parameters_mod_volume_seps_config(const char * fileConfig) { - - mod_volume_cfg * cfg; - - cfg = mod_volume_cfg_construct(); - - // +----------------------------------------------------------+ - // | Gain | - // +----------------------------------------------------------+ - - cfg->gain = parameters_lookup_float(fileConfig, "sss.gain_sep"); - - return cfg; - - } - - mod_volume_cfg * parameters_mod_volume_pfs_config(const char * fileConfig) { - - mod_volume_cfg * cfg; - - cfg = mod_volume_cfg_construct(); - - // +----------------------------------------------------------+ - // | Gain | - // +----------------------------------------------------------+ - - cfg->gain = parameters_lookup_float(fileConfig, "sss.gain_pf"); - - return cfg; - - } - - msg_hops_cfg * parameters_msg_hops_seps_vol_config(const char * fileConfig) { - - msg_hops_cfg * cfg; - - cfg = msg_hops_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "sss.separated.fS"); - - // +----------------------------------------------------------+ - // | Hop size | - // +----------------------------------------------------------+ - - cfg->hopSize = parameters_lookup_int(fileConfig, "sss.separated.hopSize"); - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); - - return cfg; - - } - - msg_hops_cfg * parameters_msg_hops_pfs_vol_config(const char * fileConfig) { - - msg_hops_cfg * cfg; - - cfg = msg_hops_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "sss.postfiltered.fS"); - - // +----------------------------------------------------------+ - // | Hop size | - // +----------------------------------------------------------+ - - cfg->hopSize = parameters_lookup_int(fileConfig, "sss.postfiltered.hopSize"); - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); - - return cfg; - - } - - snk_hops_cfg * parameters_snk_hops_seps_vol_config(const char * fileConfig) { - - snk_hops_cfg * cfg; - unsigned int tmpInt1; - char * tmpStr1; - char * tmpStr2; - - cfg = snk_hops_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "sss.separated.fS"); - - - // +----------------------------------------------------------+ - // | Format | - // +----------------------------------------------------------+ - - tmpInt1 = parameters_lookup_int(fileConfig, "sss.separated.nBits"); - - if ((tmpInt1 == 8) || (tmpInt1 == 16) || (tmpInt1 == 24) || (tmpInt1 == 32)) { - cfg->format = format_construct_binary_int(tmpInt1); - } - else { - printf("raw.nBits: Invalid number of bits\n"); - exit(EXIT_FAILURE); - } - - // +----------------------------------------------------------+ - // | Interface | - // +----------------------------------------------------------+ - - tmpStr1 = parameters_lookup_string(fileConfig, "sss.separated.interface.type"); - - if (strcmp(tmpStr1, "blackhole") == 0) { - - cfg->interface = interface_construct_blackhole(); - cfg->format = format_construct_undefined(); - - } - else if (strcmp(tmpStr1, "file") == 0) { - - tmpStr2 = parameters_lookup_string(fileConfig, "sss.separated.interface.path"); - cfg->interface = interface_construct_file(tmpStr2); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "socket") == 0) { - - tmpStr2 = parameters_lookup_string(fileConfig, "sss.separated.interface.ip"); - tmpInt1 = parameters_lookup_int(fileConfig, "sss.separated.interface.port"); - - cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "terminal") == 0) { - - cfg->interface = interface_construct_terminal(); - - } - else { - - printf("sss.separated.interface.type: Invalid type\n"); - exit(EXIT_FAILURE); - - } - - free((void *) tmpStr1); - - return cfg; - - } - - snk_hops_cfg * parameters_snk_hops_pfs_vol_config(const char * fileConfig) { - - snk_hops_cfg * cfg; - unsigned int tmpInt1; - char * tmpStr1; - char * tmpStr2; - - cfg = snk_hops_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "sss.postfiltered.fS"); - - // +----------------------------------------------------------+ - // | Format | - // +----------------------------------------------------------+ - - tmpInt1 = parameters_lookup_int(fileConfig, "sss.postfiltered.nBits"); - - if ((tmpInt1 == 8) || (tmpInt1 == 16) || (tmpInt1 == 24) || (tmpInt1 == 32)) { - cfg->format = format_construct_binary_int(tmpInt1); - } - else { - printf("raw.nBits: Invalid number of bits\n"); - exit(EXIT_FAILURE); - } - - // +----------------------------------------------------------+ - // | Type | - // +----------------------------------------------------------+ - - tmpStr1 = parameters_lookup_string(fileConfig, "sss.postfiltered.interface.type"); - - if (strcmp(tmpStr1, "blackhole") == 0) { - - cfg->interface = interface_construct_blackhole(); - cfg->format = format_construct_undefined(); - - } - else if (strcmp(tmpStr1, "file") == 0) { - - tmpStr2 = parameters_lookup_string(fileConfig, "sss.postfiltered.interface.path"); - cfg->interface = interface_construct_file(tmpStr2); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "socket") == 0) { - - tmpStr2 = parameters_lookup_string(fileConfig, "sss.postfiltered.interface.ip"); - tmpInt1 = parameters_lookup_int(fileConfig, "sss.postfiltered.interface.port"); - - cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "terminal") == 0) { - - cfg->interface = interface_construct_terminal(); - - } - else { - - printf("sss.postfiltered.interface.type: Invalid type\n"); - exit(EXIT_FAILURE); - - } - - free((void *) tmpStr1); - - return cfg; - - } - - mod_classify_cfg * parameters_mod_classify_config(const char * fileConfig) { - - mod_classify_cfg * cfg; - - cfg = mod_classify_cfg_construct(); - - // +----------------------------------------------------------+ - // | Frame size | - // +----------------------------------------------------------+ - - cfg->frameSize = parameters_lookup_int(fileConfig, "classify.frameSize"); - - // +----------------------------------------------------------+ - // | Window size | - // +----------------------------------------------------------+ - - cfg->winSize = parameters_lookup_int(fileConfig, "classify.winSize"); - - // +----------------------------------------------------------+ - // | tauMin | - // +----------------------------------------------------------+ - - cfg->tauMin = parameters_lookup_int(fileConfig, "classify.tauMin"); - - // +----------------------------------------------------------+ - // | tauMax | - // +----------------------------------------------------------+ - - cfg->tauMax = parameters_lookup_int(fileConfig, "classify.tauMax"); - - // +----------------------------------------------------------+ - // | deltaTauMax | - // +----------------------------------------------------------+ - - cfg->deltaTauMax = parameters_lookup_int(fileConfig, "classify.deltaTauMax"); - - // +----------------------------------------------------------+ - // | alpha | - // +----------------------------------------------------------+ - - cfg->alpha = parameters_lookup_float(fileConfig, "classify.alpha"); - - // +----------------------------------------------------------+ - // | gamma | - // +----------------------------------------------------------+ - - cfg->gamma = parameters_lookup_float(fileConfig, "classify.gamma"); - - // +----------------------------------------------------------+ - // | phiMin | - // +----------------------------------------------------------+ - - cfg->phiMin = parameters_lookup_float(fileConfig, "classify.phiMin"); - - // +----------------------------------------------------------+ - // | r0 | - // +----------------------------------------------------------+ - - cfg->r0 = parameters_lookup_float(fileConfig, "classify.r0"); - - return cfg; - - } - - msg_categories_cfg * parameters_msg_categories_config(const char * fileConfig) { - - msg_categories_cfg * cfg; - - cfg = msg_categories_cfg_construct(); - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - return cfg; - - } - - snk_categories_cfg * parameters_snk_categories_config(const char * fileConfig) { - - snk_categories_cfg * cfg; - unsigned int tmpInt1; - char * tmpStr1; - char * tmpStr2; - - cfg = snk_categories_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Format | - // +----------------------------------------------------------+ - - tmpStr1 = parameters_lookup_string(fileConfig, "classify.category.format"); - - if (strcmp(tmpStr1, "json") == 0) { cfg->format = format_construct_text_json(); } - else if (strcmp(tmpStr1, "undefined") == 0) { cfg->format = format_construct_undefined(); } - else { printf("classify.category.format: Invalid format\n"); exit(EXIT_FAILURE); } - - free((void *) tmpStr1); - - // +----------------------------------------------------------+ - // | Type | - // +----------------------------------------------------------+ - - tmpStr1 = parameters_lookup_string(fileConfig, "classify.category.interface.type"); - - if (strcmp(tmpStr1, "blackhole") == 0) { - - cfg->interface = interface_construct_blackhole(); - - } - else if (strcmp(tmpStr1, "file") == 0) { - - tmpStr2 = parameters_lookup_string(fileConfig, "classify.category.interface.path"); - cfg->interface = interface_construct_file(tmpStr2); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "socket") == 0) { - - tmpStr2 = parameters_lookup_string(fileConfig, "classify.category.interface.ip"); - tmpInt1 = parameters_lookup_int(fileConfig, "classify.category.interface.port"); - - cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "terminal") == 0) { - - cfg->interface = interface_construct_terminal(); - - } - else { - - printf("classify.category.interface.type: Invalid type\n"); - exit(EXIT_FAILURE); - - } - - free((void *) tmpStr1); - - return cfg; - - } \ No newline at end of file diff --git a/demo/odascore/parameters.h b/demo/odascore/parameters.h deleted file mode 100644 index 10daacd..0000000 --- a/demo/odascore/parameters.h +++ /dev/null @@ -1,104 +0,0 @@ -#ifndef __DEMO_PARAMETERS -#define __DEMO_PARAMETERS - - #include - #include - - int parameters_lookup_int(const char * file, const char * path); - - float parameters_lookup_float(const char * file, const char * path); - - char * parameters_lookup_string(const char * file, const char * path); - - unsigned int parameters_count(const char * file, const char * path); - - - src_hops_cfg * parameters_src_hops_mics_config(const char * fileConfig); - - msg_hops_cfg * parameters_msg_hops_mics_raw_config(const char * fileConfig); - - - mod_mapping_cfg * parameters_mod_mapping_mics_config(const char * fileConfig); - - msg_hops_cfg * parameters_msg_hops_mics_map_config(const char * fileConfig); - - - mod_resample_cfg * parameters_mod_resample_mics_config(const char * fileConfig); - - msg_hops_cfg * parameters_msg_hops_mics_rs_config(const char * fileConfig); - - - mod_stft_cfg * parameters_mod_stft_mics_config(const char * fileConfig); - - msg_spectra_cfg * parameters_msg_spectra_mics_config(const char * fileConfig); - - - mod_noise_cfg * parameters_mod_noise_mics_config(const char * fileConfig); - - msg_powers_cfg * parameters_msg_powers_mics_config(const char * fileConfig); - - - mod_ssl_cfg * parameters_mod_ssl_config(const char * fileConfig); - - msg_pots_cfg * parameters_msg_pots_ssl_config(const char * fileConfig); - - snk_pots_cfg * parameters_snk_pots_ssl_config(const char * fileConfig); - - - inj_targets_cfg * parameters_inj_targets_sst_config(const char * fileConfig); - - msg_targets_cfg * parameters_msg_targets_sst_config(const char * fileConfig); - - - mod_sst_cfg * parameters_mod_sst_config(const char * fileConfig); - - msg_tracks_cfg * parameters_msg_tracks_sst_config(const char * fileConfig); - - snk_tracks_cfg * parameters_snk_tracks_sst_config(const char * fileConfig); - - - mod_sss_cfg * parameters_mod_sss_config(const char * fileConfig); - - msg_spectra_cfg * parameters_msg_spectra_seps_config(const char * fileConfig); - - msg_spectra_cfg * parameters_msg_spectra_pfs_config(const char * fileConfig); - - - mod_istft_cfg * parameters_mod_istft_seps_config(const char * fileConfig); - - mod_istft_cfg * parameters_mod_istft_pfs_config(const char * fileConfig); - - msg_hops_cfg * parameters_msg_hops_seps_config(const char * fileConfig); - - msg_hops_cfg * parameters_msg_hops_pfs_config(const char * fileConfig); - - - mod_resample_cfg * parameters_mod_resample_seps_config(const char * fileConfig); - - mod_resample_cfg * parameters_mod_resample_pfs_config(const char * fileConfig); - - msg_hops_cfg * parameters_msg_hops_seps_rs_config(const char * fileConfig); - - msg_hops_cfg * parameters_msg_hops_pfs_rs_config(const char * fileConfig); - - - mod_volume_cfg * parameters_mod_volume_seps_config(const char * fileConfig); - - mod_volume_cfg * parameters_mod_volume_pfs_config(const char * fileConfig); - - msg_hops_cfg * parameters_msg_hops_seps_vol_config(const char * fileConfig); - - msg_hops_cfg * parameters_msg_hops_pfs_vol_config(const char * fileConfig); - - snk_hops_cfg * parameters_snk_hops_seps_vol_config(const char * fileConfig); - - snk_hops_cfg * parameters_snk_hops_pfs_vol_config(const char * fileConfig); - - - mod_classify_cfg * parameters_mod_classify_config(const char * fileConfig); - - msg_categories_cfg * parameters_msg_categories_config(const char * fileConfig); - - snk_categories_cfg * parameters_snk_categories_config(const char * fileConfig); - -#endif \ No newline at end of file diff --git a/demo/odascore/profiler.c b/demo/odascore/profiler.c deleted file mode 100644 index 14ee21a..0000000 --- a/demo/odascore/profiler.c +++ /dev/null @@ -1,177 +0,0 @@ - - #include "profiler.h" - - profiler * profiler_construct(void) { - - profiler * prf; - - prf = (profiler *) malloc(sizeof(profiler)); - - prf->duration = 0.0f; - - prf->src_hops_mics_prf = 0.0f; - prf->con_hops_mics_raw_prf = 0.0f; - - prf->mod_mapping_mics_prf = 0.0f; - prf->con_hops_mics_map_prf = 0.0f; - - prf->mod_resample_mics_prf = 0.0f; - prf->con_hops_mics_rs_prf = 0.0f; - - prf->mod_stft_mics_prf = 0.0f; - prf->con_spectra_mics_prf = 0.0f; - - prf->mod_noise_mics_prf = 0.0f; - prf->con_powers_mics_prf = 0.0f; - - prf->mod_ssl_prf = 0.0f; - prf->con_pots_ssl_prf = 0.0f; - prf->snk_pots_ssl_prf = 0.0f; - - prf->inj_targets_sst_prf = 0.0f; - prf->con_targets_sst_prf = 0.0f; - - prf->mod_sst_prf = 0.0f; - prf->con_tracks_sst_prf = 0.0f; - prf->snk_tracks_sst_prf = 0.0f; - - prf->mod_sss_prf = 0.0f; - prf->con_spectra_seps_prf = 0.0f; - prf->con_spectra_pfs_prf = 0.0f; - - prf->mod_istft_seps_prf = 0.0f;; - prf->mod_istft_pfs_prf = 0.0f;; - prf->con_hops_seps_prf = 0.0f; - prf->con_hops_pfs_prf = 0.0f; - - prf->mod_resample_seps_prf = 0.0f; - prf->mod_resample_pfs_prf = 0.0f; - prf->con_hops_seps_rs_prf = 0.0f; - prf->con_hops_pfs_rs_prf = 0.0f; - - prf->mod_volume_seps_prf = 0.0f; - prf->mod_volume_pfs_prf = 0.0f; - prf->con_hops_seps_vol_prf = 0.0f; - prf->con_hops_pfs_vol_prf = 0.0f; - prf->snk_hops_seps_vol_prf = 0.0f; - prf->snk_hops_pfs_vol_prf = 0.0f; - - prf->mod_classify_prf = 0.0f; - prf->con_categories_prf = 0.0f; - prf->snk_categories_prf = 0.0f; - - return prf; - - } - - void profiler_destroy(profiler * prf) { - - free((void *) prf); - - } - - void profiler_printf(const profiler * prf) { - - float source, sink, module, injector, connector; - float total; - - source = prf->src_hops_mics_prf; - - sink = prf->snk_pots_ssl_prf + - prf->snk_tracks_sst_prf + - prf->snk_hops_seps_vol_prf + - prf->snk_hops_pfs_vol_prf + - prf->snk_categories_prf; - - module = prf->mod_mapping_mics_prf + - prf->mod_resample_mics_prf + - prf->mod_stft_mics_prf + - prf->mod_noise_mics_prf + - prf->mod_ssl_prf + - prf->mod_sst_prf + - prf->mod_sss_prf + - prf->mod_istft_seps_prf + - prf->mod_istft_pfs_prf + - prf->mod_resample_seps_prf + - prf->mod_resample_pfs_prf + - prf->mod_volume_seps_prf + - prf->mod_volume_pfs_prf + - prf->mod_classify_prf; - - injector = prf->inj_targets_sst_prf; - - connector = prf->con_hops_mics_raw_prf + - prf->con_hops_mics_map_prf + - prf->con_hops_mics_rs_prf + - prf->con_spectra_mics_prf + - prf->con_powers_mics_prf + - prf->con_pots_ssl_prf + - prf->con_targets_sst_prf + - prf->con_tracks_sst_prf + - prf->con_spectra_seps_prf + - prf->con_spectra_pfs_prf + - prf->con_hops_seps_prf + - prf->con_hops_pfs_prf + - prf->con_hops_seps_rs_prf + - prf->con_hops_pfs_rs_prf + - prf->con_hops_seps_vol_prf + - prf->con_hops_pfs_vol_prf + - prf->con_categories_prf; - - total = source + sink + module + connector; - - printf("+--------------------------------------------+\n"); - printf("| Profiler summary |\n"); - printf("+--------------------------------------------+\n"); - printf("| + Raw |\n"); - printf("| - Source.......... %07.3f (%06.2f%%) |\n",prf->src_hops_mics_prf,roundf(10000.0f * prf->src_hops_mics_prf / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_hops_mics_raw_prf,roundf(10000.0f * prf->con_hops_mics_raw_prf / prf->duration) / 100.0f); - printf("| + Mapping |\n"); - printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_mapping_mics_prf,roundf(10000.0f * prf->mod_mapping_mics_prf / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_hops_mics_map_prf,roundf(10000.0f * prf->con_hops_mics_map_prf / prf->duration) / 100.0f); - printf("| + Resample |\n"); - printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_resample_mics_prf,roundf(10000.0f * prf->mod_resample_mics_prf / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_hops_mics_rs_prf,roundf(10000.0f * prf->con_hops_mics_rs_prf / prf->duration) / 100.0f); - printf("| + STFT |\n"); - printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_stft_mics_prf,roundf(10000.0f * prf->mod_stft_mics_prf / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_spectra_mics_prf,roundf(10000.0f * prf->con_spectra_mics_prf / prf->duration) / 100.0f); - printf("| + Noise |\n"); - printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_noise_mics_prf,roundf(10000.0f * prf->mod_noise_mics_prf / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_powers_mics_prf,roundf(10000.0f * prf->con_powers_mics_prf / prf->duration) / 100.0f); - printf("| + SSL |\n"); - printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_ssl_prf,roundf(10000.0f * prf->mod_ssl_prf / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_pots_ssl_prf,roundf(10000.0f * prf->con_pots_ssl_prf / prf->duration) / 100.0f); - printf("| - Sink............ %07.3f (%06.2f%%) |\n",prf->snk_pots_ssl_prf,roundf(10000.0f * prf->snk_pots_ssl_prf / prf->duration) / 100.0f); - printf("| + Target |\n"); - printf("| - Injector........ %07.3f (%06.2f%%) |\n",prf->inj_targets_sst_prf,roundf(10000.0f * prf->inj_targets_sst_prf / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_targets_sst_prf,roundf(10000.0f * prf->con_targets_sst_prf / prf->duration) / 100.0f); - printf("| + SST |\n"); - printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_sst_prf,roundf(10000.0f * prf->mod_sst_prf / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_tracks_sst_prf,roundf(10000.0f * prf->con_tracks_sst_prf / prf->duration) / 100.0f); - printf("| - Sink............ %07.3f (%06.2f%%) |\n",prf->snk_tracks_sst_prf,roundf(10000.0f * prf->snk_tracks_sst_prf / prf->duration) / 100.0f); - printf("| + SSS |\n"); - printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_sss_prf,roundf(10000.0f * prf->mod_sss_prf / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",(prf->con_spectra_seps_prf+prf->con_spectra_pfs_prf),roundf(10000.0f * ((prf->con_spectra_seps_prf+prf->con_spectra_pfs_prf) / prf->duration) / 100.0f)); - printf("| + ISTFT |\n"); - printf("| - Module.......... %07.3f (%06.2f%%) |\n",(prf->mod_istft_seps_prf+prf->mod_istft_pfs_prf),roundf(10000.0f * (prf->mod_istft_seps_prf+prf->mod_istft_pfs_prf) / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",(prf->con_hops_seps_prf+prf->con_hops_pfs_prf),roundf(10000.0f * (prf->con_hops_seps_prf+prf->con_hops_pfs_prf) / prf->duration) / 100.0f); - printf("| + Resample |\n"); - printf("| - Module.......... %07.3f (%06.2f%%) |\n",(prf->mod_resample_seps_prf+prf->mod_resample_pfs_prf),roundf(10000.0f * (prf->mod_resample_seps_prf+prf->mod_resample_pfs_prf) / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",(prf->con_hops_seps_rs_prf+prf->con_hops_pfs_rs_prf),roundf(10000.0f * (prf->con_hops_seps_rs_prf+prf->con_hops_pfs_rs_prf) / prf->duration) / 100.0f); - printf("| + Volume |\n"); - printf("| - Module.......... %07.3f (%06.2f%%) |\n",(prf->mod_volume_seps_prf+prf->mod_volume_pfs_prf),roundf(10000.0f * (prf->mod_volume_seps_prf+prf->mod_volume_pfs_prf) / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",(prf->con_hops_seps_vol_prf+prf->con_hops_pfs_vol_prf),roundf(10000.0f * (prf->con_hops_seps_vol_prf+prf->con_hops_pfs_vol_prf) / prf->duration) / 100.0f); - printf("| - Sink............ %07.3f (%06.2f%%) |\n",(prf->snk_hops_seps_vol_prf+prf->snk_hops_pfs_vol_prf),roundf(10000.0f * (prf->snk_hops_seps_vol_prf+prf->snk_hops_pfs_vol_prf) / prf->duration) / 100.0f); - printf("| + Classify |\n"); - printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_classify_prf,roundf(10000.0f * prf->mod_classify_prf / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_categories_prf,roundf(10000.0f * prf->con_categories_prf / prf->duration) / 100.0f); - printf("| - Sink............ %07.3f (%06.2f%%) |\n",prf->snk_categories_prf,roundf(10000.0f * prf->snk_categories_prf / prf->duration) / 100.0f); - printf("+--------------------------------------------+\n"); - printf("| + TOTAL.............. %07.3f (%06.2f%%) |\n",total,roundf(10000.0f * total / prf->duration) / 100.0f); - printf("| - Module.......... %07.3f (%06.2f%%) |\n",module,roundf(10000.0f * module / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",connector,roundf(10000.0f * connector / prf->duration) / 100.0f); - printf("| - Source.......... %07.3f (%06.2f%%) |\n",source,roundf(10000.0f * source / prf->duration) / 100.0f); - printf("| - Sink............ %07.3f (%06.2f%%) |\n",sink,roundf(10000.0f * sink / prf->duration) / 100.0f); - printf("+--------------------------------------------+\n"); - - } \ No newline at end of file diff --git a/demo/odascore/profiler.h b/demo/odascore/profiler.h deleted file mode 100644 index bf803be..0000000 --- a/demo/odascore/profiler.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef __DEMO_PROFILER -#define __DEMO_PROFILER - - #include - #include - #include - - typedef struct profiler { - - float duration; - - float src_hops_mics_prf; - float con_hops_mics_raw_prf; - - float mod_mapping_mics_prf; - float con_hops_mics_map_prf; - - float mod_resample_mics_prf; - float con_hops_mics_rs_prf; - - float mod_stft_mics_prf; - float con_spectra_mics_prf; - - float mod_noise_mics_prf; - float con_powers_mics_prf; - - float mod_ssl_prf; - float con_pots_ssl_prf; - float snk_pots_ssl_prf; - - float inj_targets_sst_prf; - float con_targets_sst_prf; - - float mod_sst_prf; - float con_tracks_sst_prf; - float snk_tracks_sst_prf; - - float mod_sss_prf; - float con_spectra_seps_prf; - float con_spectra_pfs_prf; - - float mod_istft_seps_prf; - float mod_istft_pfs_prf; - float con_hops_seps_prf; - float con_hops_pfs_prf; - - float mod_resample_seps_prf; - float mod_resample_pfs_prf; - float con_hops_seps_rs_prf; - float con_hops_pfs_rs_prf; - - float mod_volume_seps_prf; - float mod_volume_pfs_prf; - float con_hops_seps_vol_prf; - float con_hops_pfs_vol_prf; - float snk_hops_seps_vol_prf; - float snk_hops_pfs_vol_prf; - - float mod_classify_prf; - float con_categories_prf; - float snk_categories_prf; - - } profiler; - - profiler * profiler_construct(void); - - void profiler_destroy(profiler * prf); - - void profiler_printf(const profiler * prf); - -#endif \ No newline at end of file diff --git a/demo/odascore/threads.c b/demo/odascore/threads.c deleted file mode 100644 index 7bde48e..0000000 --- a/demo/odascore/threads.c +++ /dev/null @@ -1,1086 +0,0 @@ - - #include "threads.h" - - void threads_multiple_start(aobjects * aobjs) { - - unsigned int iSink; - - // +----------------------------------------------------------+ - // | Raw | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Source | - // +------------------------------------------------------+ - - thread_start(aobjs->asrc_hops_mics_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_start(aobjs->acon_hops_mics_raw_object->thread); - - // +----------------------------------------------------------+ - // | Mapping | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_start(aobjs->amod_mapping_mics_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_start(aobjs->acon_hops_mics_map_object->thread); - - // +----------------------------------------------------------+ - // | Resample | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_start(aobjs->amod_resample_mics_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_start(aobjs->acon_hops_mics_rs_object->thread); - - // +----------------------------------------------------------+ - // | STFT | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_start(aobjs->amod_stft_mics_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_start(aobjs->acon_spectra_mics_object->thread); - - // +----------------------------------------------------------+ - // | STFT | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_start(aobjs->amod_noise_mics_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_start(aobjs->acon_powers_mics_object->thread); - - // +----------------------------------------------------------+ - // | SSL | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_start(aobjs->amod_ssl_object->thread); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - thread_start(aobjs->asnk_pots_ssl_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_start(aobjs->acon_pots_ssl_object->thread); - - // +----------------------------------------------------------+ - // | Targets | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Injector | - // +------------------------------------------------------+ - - thread_start(aobjs->ainj_targets_sst_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_start(aobjs->acon_targets_sst_object->thread); - - // +----------------------------------------------------------+ - // | SST | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_start(aobjs->amod_sst_object->thread); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - thread_start(aobjs->asnk_tracks_sst_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_start(aobjs->acon_tracks_sst_object->thread); - - // +----------------------------------------------------------+ - // | SSS | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_start(aobjs->amod_sss_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_start(aobjs->acon_spectra_seps_object->thread); - thread_start(aobjs->acon_spectra_pfs_object->thread); - - // +----------------------------------------------------------+ - // | ISTFT | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_start(aobjs->amod_istft_seps_object->thread); - thread_start(aobjs->amod_istft_pfs_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_start(aobjs->acon_hops_seps_object->thread); - thread_start(aobjs->acon_hops_pfs_object->thread); - - // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - thread_start(aobjs->amod_resample_seps_object->thread); - thread_start(aobjs->amod_resample_pfs_object->thread); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - thread_start(aobjs->acon_hops_seps_rs_object->thread); - thread_start(aobjs->acon_hops_pfs_rs_object->thread); - - // +------------------------------------------------------+ - // | Volume | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - thread_start(aobjs->amod_volume_seps_object->thread); - thread_start(aobjs->amod_volume_pfs_object->thread); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - thread_start(aobjs->asnk_hops_seps_vol_object->thread); - thread_start(aobjs->asnk_hops_pfs_vol_object->thread); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - thread_start(aobjs->acon_hops_seps_vol_object->thread); - thread_start(aobjs->acon_hops_pfs_vol_object->thread); - - // +------------------------------------------------------+ - // | Classify | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - thread_start(aobjs->amod_classify_object->thread); - - // +--------------------------------------------------+ - // | Sink | - // +--------------------------------------------------+ - - thread_start(aobjs->asnk_categories_object->thread); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - thread_start(aobjs->acon_categories_object->thread); - - } - - void threads_multiple_stop(aobjects * aobjs) { - - // +----------------------------------------------------------+ - // | Raw | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Source | - // +------------------------------------------------------+ - - thread_stop(aobjs->asrc_hops_mics_object->thread); - - // Stops the source that generate frames to process. - // This will generate a "zero" message that will stop - // all following threads. - - } - - void threads_multiple_join(aobjects * aobjs) { - - unsigned int iSink; - - // +----------------------------------------------------------+ - // | Raw | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Source | - // +------------------------------------------------------+ - - thread_join(aobjs->asrc_hops_mics_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_join(aobjs->acon_hops_mics_raw_object->thread); - - // +----------------------------------------------------------+ - // | Mapping | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_join(aobjs->amod_mapping_mics_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_join(aobjs->acon_hops_mics_map_object->thread); - - // +----------------------------------------------------------+ - // | Resample | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_join(aobjs->amod_resample_mics_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_join(aobjs->acon_hops_mics_rs_object->thread); - - // +----------------------------------------------------------+ - // | STFT | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_join(aobjs->amod_stft_mics_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_join(aobjs->acon_spectra_mics_object->thread); - - // +----------------------------------------------------------+ - // | Noise | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_join(aobjs->amod_noise_mics_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_join(aobjs->acon_powers_mics_object->thread); - - // +----------------------------------------------------------+ - // | SSL | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_join(aobjs->amod_ssl_object->thread); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - thread_join(aobjs->asnk_pots_ssl_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_join(aobjs->acon_pots_ssl_object->thread); - - // +----------------------------------------------------------+ - // | Targets | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Injector | - // +------------------------------------------------------+ - - thread_join(aobjs->ainj_targets_sst_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_join(aobjs->acon_targets_sst_object->thread); - - // +----------------------------------------------------------+ - // | SST | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_join(aobjs->amod_sst_object->thread); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - thread_join(aobjs->asnk_tracks_sst_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_join(aobjs->acon_tracks_sst_object->thread); - - // +----------------------------------------------------------+ - // | SSS | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_join(aobjs->amod_sss_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_join(aobjs->acon_spectra_seps_object->thread); - thread_join(aobjs->acon_spectra_pfs_object->thread); - - // +----------------------------------------------------------+ - // | ISTFT | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_join(aobjs->amod_istft_seps_object->thread); - thread_join(aobjs->amod_istft_pfs_object->thread); - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_join(aobjs->acon_hops_seps_object->thread); - thread_join(aobjs->acon_hops_pfs_object->thread); - - // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - thread_join(aobjs->amod_resample_seps_object->thread); - thread_join(aobjs->amod_resample_pfs_object->thread); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - thread_join(aobjs->acon_hops_seps_rs_object->thread); - thread_join(aobjs->acon_hops_pfs_rs_object->thread); - - // +------------------------------------------------------+ - // | Volume | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - thread_join(aobjs->amod_volume_seps_object->thread); - thread_join(aobjs->amod_volume_pfs_object->thread); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - thread_join(aobjs->asnk_hops_seps_vol_object->thread); - thread_join(aobjs->asnk_hops_pfs_vol_object->thread); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - thread_join(aobjs->acon_hops_seps_vol_object->thread); - thread_join(aobjs->acon_hops_pfs_vol_object->thread); - - // +------------------------------------------------------+ - // | Classify | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - thread_join(aobjs->amod_classify_object->thread); - - // +--------------------------------------------------+ - // | Sink | - // +--------------------------------------------------+ - - thread_join(aobjs->asnk_categories_object->thread); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - thread_join(aobjs->acon_categories_object->thread); - - } - - void threads_single_open(objects * objs) { - - unsigned int iSink; - - // +----------------------------------------------------------+ - // | Raw | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Source | - // +------------------------------------------------------+ - - src_hops_open(objs->src_hops_mics_object); - - // +----------------------------------------------------------+ - // | SSL | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - snk_pots_open(objs->snk_pots_ssl_object); - - // +----------------------------------------------------------+ - // | SST | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - snk_tracks_open(objs->snk_tracks_sst_object); - - // +----------------------------------------------------------+ - // | Volume | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - snk_hops_open(objs->snk_hops_seps_vol_object); - snk_hops_open(objs->snk_hops_pfs_vol_object); - - // +----------------------------------------------------------+ - // | Classify | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - snk_categories_open(objs->snk_categories_object); - - } - - void threads_single_close(objects * objs) { - - unsigned int iSink; - - // +----------------------------------------------------------+ - // | Raw | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Source | - // +------------------------------------------------------+ - - src_hops_close(objs->src_hops_mics_object); - - // +----------------------------------------------------------+ - // | SSL | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - snk_pots_close(objs->snk_pots_ssl_object); - - // +----------------------------------------------------------+ - // | SST | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - snk_tracks_close(objs->snk_tracks_sst_object); - - // +----------------------------------------------------------+ - // | Volume | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - snk_hops_close(objs->snk_hops_seps_vol_object); - snk_hops_close(objs->snk_hops_pfs_vol_object); - - // +----------------------------------------------------------+ - // | Classify | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - snk_categories_close(objs->snk_categories_object); - - } - - int threads_single_process(objects * objs, profiler * prf) { - - int rtnValue; - int rtnResample; - unsigned int iSink; - - clock_t begin, end; - - prf->duration += ((float) (objs->src_hops_mics_object->hopSize)) / ((float) (objs->src_hops_mics_object->fS)); - - // +----------------------------------------------------------+ - // | SECTION I | - // +----------------------------------------------------------- - - // +------------------------------------------------------+ - // | Raw | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Source | - // +--------------------------------------------------+ - - begin = clock(); - rtnValue = src_hops_process(objs->src_hops_mics_object); - end = clock(); - prf->src_hops_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - begin = clock(); - con_hops_process(objs->con_hops_mics_raw_object); - end = clock(); - prf->con_hops_mics_raw_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +------------------------------------------------------+ - // | Mapping | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - begin = clock(); - mod_mapping_process(objs->mod_mapping_mics_object); - end = clock(); - prf->mod_mapping_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - begin = clock(); - con_hops_process(objs->con_hops_mics_map_object); - end = clock(); - prf->con_hops_mics_map_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - begin = clock(); - mod_resample_process_push(objs->mod_resample_mics_object); - end = clock(); - prf->mod_resample_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +----------------------------------------------------------+ - // | SECTION II | - // +----------------------------------------------------------- - - // Loop through section II as long as there are frames to process from the resample module - while(1) { - - // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - begin = clock(); - rtnResample = mod_resample_process_pop(objs->mod_resample_mics_object); - end = clock(); - prf->mod_resample_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // If there is no frames to process, stop - if (rtnResample == -1) { - break; - } - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - begin = clock(); - con_hops_process(objs->con_hops_mics_rs_object); - end = clock(); - prf->con_hops_mics_rs_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +------------------------------------------------------+ - // | STFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - begin = clock(); - mod_stft_process(objs->mod_stft_mics_object); - end = clock(); - prf->mod_stft_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - begin = clock(); - con_spectra_process(objs->con_spectra_mics_object); - end = clock(); - prf->con_spectra_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +------------------------------------------------------+ - // | Noise | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - begin = clock(); - mod_noise_process(objs->mod_noise_mics_object); - end = clock(); - prf->mod_noise_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - begin = clock(); - con_powers_process(objs->con_powers_mics_object); - end = clock(); - prf->con_powers_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +------------------------------------------------------+ - // | SSL | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - begin = clock(); - mod_ssl_process(objs->mod_ssl_object); - end = clock(); - prf->mod_ssl_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - begin = clock(); - con_pots_process(objs->con_pots_ssl_object); - end = clock(); - prf->con_pots_ssl_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - begin = clock(); - snk_pots_process(objs->snk_pots_ssl_object); - end = clock(); - prf->snk_pots_ssl_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +------------------------------------------------------+ - // | Targets | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Injector | - // +--------------------------------------------------+ - - begin = clock(); - inj_targets_process(objs->inj_targets_sst_object); - end = clock(); - prf->inj_targets_sst_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - begin = clock(); - con_targets_process(objs->con_targets_sst_object); - end = clock(); - prf->con_targets_sst_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +------------------------------------------------------+ - // | SST | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - begin = clock(); - mod_sst_process(objs->mod_sst_object); - end = clock(); - prf->mod_sst_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - begin = clock(); - con_tracks_process(objs->con_tracks_sst_object); - end = clock(); - prf->con_tracks_sst_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - begin = clock(); - snk_tracks_process(objs->snk_tracks_sst_object); - end = clock(); - prf->snk_tracks_sst_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +------------------------------------------------------+ - // | SSS | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - begin = clock(); - mod_sss_process(objs->mod_sss_object); - end = clock(); - prf->mod_sss_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - begin = clock(); - con_spectra_process(objs->con_spectra_seps_object); - end = clock(); - prf->con_spectra_seps_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - begin = clock(); - con_spectra_process(objs->con_spectra_pfs_object); - end = clock(); - prf->con_spectra_pfs_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +------------------------------------------------------+ - // | ISTFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - begin = clock(); - mod_istft_process(objs->mod_istft_seps_object); - end = clock(); - prf->mod_istft_seps_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - begin = clock(); - mod_istft_process(objs->mod_istft_pfs_object); - end = clock(); - prf->mod_istft_pfs_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - begin = clock(); - con_hops_process(objs->con_hops_seps_object); - end = clock(); - prf->con_hops_seps_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - begin = clock(); - con_hops_process(objs->con_hops_pfs_object); - end = clock(); - prf->con_hops_pfs_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - begin = clock(); - mod_resample_process_push(objs->mod_resample_seps_object); - end = clock(); - prf->mod_resample_seps_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - begin = clock(); - mod_resample_process_push(objs->mod_resample_pfs_object); - end = clock(); - prf->mod_resample_pfs_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +------------------------------------------------------+ - // | SECTION III | - // +------------------------------------------------------+ - - while(1) { - - // +----------------------------------------------+ - // | Module | - // +----------------------------------------------+ - - begin = clock(); - rtnResample = mod_resample_process_pop(objs->mod_resample_seps_object); - end = clock(); - prf->mod_resample_seps_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // If there is no frames to process, stop - if (rtnResample == -1) { - break; - } - - // +----------------------------------------------+ - // | Connector | - // +----------------------------------------------+ - - begin = clock(); - con_hops_process(objs->con_hops_seps_rs_object); - end = clock(); - prf->con_hops_seps_rs_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +----------------------------------------------+ - // | Module | - // +----------------------------------------------+ - - begin = clock(); - mod_volume_process(objs->mod_volume_seps_object); - end = clock(); - prf->mod_volume_seps_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +----------------------------------------------+ - // | Connector | - // +----------------------------------------------+ - - begin = clock(); - con_hops_process(objs->con_hops_seps_vol_object); - end = clock(); - prf->con_hops_seps_vol_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +----------------------------------------------+ - // | Sink | - // +----------------------------------------------+ - - begin = clock(); - snk_hops_process(objs->snk_hops_seps_vol_object); - end = clock(); - prf->snk_hops_seps_vol_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - } - - - while(1) { - - // +----------------------------------------------+ - // | Module | - // +----------------------------------------------+ - - begin = clock(); - rtnResample = mod_resample_process_pop(objs->mod_resample_pfs_object); - end = clock(); - prf->mod_resample_pfs_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // If there is no frames to process, stop - if (rtnResample == -1) { - break; - } - - // +----------------------------------------------+ - // | Connector | - // +----------------------------------------------+ - - begin = clock(); - con_hops_process(objs->con_hops_pfs_rs_object); - end = clock(); - prf->con_hops_pfs_rs_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +----------------------------------------------+ - // | Module | - // +----------------------------------------------+ - - begin = clock(); - mod_volume_process(objs->mod_volume_pfs_object); - end = clock(); - prf->mod_volume_pfs_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +----------------------------------------------+ - // | Connector | - // +----------------------------------------------+ - - begin = clock(); - con_hops_process(objs->con_hops_pfs_vol_object); - end = clock(); - prf->con_hops_pfs_vol_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +----------------------------------------------+ - // | Sink | - // +----------------------------------------------+ - - begin = clock(); - snk_hops_process(objs->snk_hops_pfs_vol_object); - end = clock(); - prf->snk_hops_pfs_vol_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - } - - // +------------------------------------------------------+ - // | Classify | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - begin = clock(); - mod_classify_process(objs->mod_classify_object); - end = clock(); - prf->mod_classify_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - begin = clock(); - con_categories_process(objs->con_categories_object); - end = clock(); - prf->con_categories_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Sink | - // +--------------------------------------------------+ - - begin = clock(); - snk_categories_process(objs->snk_categories_object); - end = clock(); - prf->snk_categories_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - } - - return rtnValue; - - } \ No newline at end of file diff --git a/demo/odascore/threads.h b/demo/odascore/threads.h deleted file mode 100644 index 64a1376..0000000 --- a/demo/odascore/threads.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __DEMO_THREADS -#define __DEMO_THREADS - - #include "objects.h" - #include "profiler.h" - - #include - - #include - - void threads_multiple_start(aobjects * aobjs); - - void threads_multiple_stop(aobjects * aobjs); - - void threads_multiple_join(aobjects * aobjs); - - void threads_single_open(objects * objs); - - void threads_single_close(objects * objs); - - int threads_single_process(objects * objs, profiler * prf); - -#endif \ No newline at end of file diff --git a/demo/odaslive/configs.c b/demo/odaslive/configs.c new file mode 100644 index 0000000..e92f8a7 --- /dev/null +++ b/demo/odaslive/configs.c @@ -0,0 +1,502 @@ + + #include "configs.h" + + configs * configs_construct(const char * file_config) { + + configs * cfgs; + unsigned int iSink; + + cfgs = (configs *) malloc(sizeof(configs)); + + // +----------------------------------------------------------+ + // | Raw | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Source | + // +------------------------------------------------------+ + + cfgs->src_hops_mics_config = parameters_src_hops_mics_config(file_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + cfgs->msg_hops_mics_raw_config = parameters_msg_hops_mics_raw_config(file_config); + + // +----------------------------------------------------------+ + // | Mapping | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + cfgs->mod_mapping_mics_config = parameters_mod_mapping_mics_config(file_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + cfgs->msg_hops_mics_map_config = parameters_msg_hops_mics_map_config(file_config); + + + // +----------------------------------------------------------+ + // | Resample | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + cfgs->mod_resample_mics_config = parameters_mod_resample_mics_config(file_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + cfgs->msg_hops_mics_rs_config = parameters_msg_hops_mics_rs_config(file_config); + + // +----------------------------------------------------------+ + // | STFT | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + cfgs->mod_stft_mics_config = parameters_mod_stft_mics_config(file_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + cfgs->msg_spectra_mics_config = parameters_msg_spectra_mics_config(file_config); + + // +----------------------------------------------------------+ + // | Noise | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + cfgs->mod_noise_mics_config = parameters_mod_noise_mics_config(file_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + cfgs->msg_powers_mics_config = parameters_msg_powers_mics_config(file_config); + + // +----------------------------------------------------------+ + // | SSL | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + cfgs->mod_ssl_config = parameters_mod_ssl_config(file_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + cfgs->msg_pots_ssl_config = parameters_msg_pots_ssl_config(file_config); + + // +------------------------------------------------------+ + // | Sinks | + // +------------------------------------------------------+ + + cfgs->snk_pots_ssl_config = parameters_snk_pots_ssl_config(file_config); + + // +----------------------------------------------------------+ + // | Target | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Injector | + // +------------------------------------------------------+ + + cfgs->inj_targets_sst_config = parameters_inj_targets_sst_config(file_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + cfgs->msg_targets_sst_config = parameters_msg_targets_sst_config(file_config); + + // +----------------------------------------------------------+ + // | SST | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + cfgs->mod_sst_config = parameters_mod_sst_config(file_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + cfgs->msg_tracks_sst_config = parameters_msg_tracks_sst_config(file_config); + + // +------------------------------------------------------+ + // | Sinks | + // +------------------------------------------------------+ + + cfgs->snk_tracks_sst_config = parameters_snk_tracks_sst_config(file_config); + + // +----------------------------------------------------------+ + // | SSS | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + cfgs->mod_sss_config = parameters_mod_sss_config(file_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + cfgs->msg_spectra_seps_config = parameters_msg_spectra_seps_config(file_config); + cfgs->msg_spectra_pfs_config = parameters_msg_spectra_pfs_config(file_config); + + // +----------------------------------------------------------+ + // | ISTFT | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + cfgs->mod_istft_seps_config = parameters_mod_istft_seps_config(file_config); + cfgs->mod_istft_pfs_config = parameters_mod_istft_pfs_config(file_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + cfgs->msg_hops_seps_config = parameters_msg_hops_seps_config(file_config); + cfgs->msg_hops_pfs_config = parameters_msg_hops_pfs_config(file_config); + + // +----------------------------------------------------------+ + // | Resample | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + cfgs->mod_resample_seps_config = parameters_mod_resample_seps_config(file_config); + cfgs->mod_resample_pfs_config = parameters_mod_resample_pfs_config(file_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + cfgs->msg_hops_seps_rs_config = parameters_msg_hops_seps_rs_config(file_config); + cfgs->msg_hops_pfs_rs_config = parameters_msg_hops_pfs_rs_config(file_config); + + // +----------------------------------------------------------+ + // | Volume | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + cfgs->mod_volume_seps_config = parameters_mod_volume_seps_config(file_config); + cfgs->mod_volume_pfs_config = parameters_mod_volume_pfs_config(file_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + cfgs->msg_hops_seps_vol_config = parameters_msg_hops_seps_vol_config(file_config); + cfgs->msg_hops_pfs_vol_config = parameters_msg_hops_pfs_vol_config(file_config); + + // +------------------------------------------------------+ + // | Sink | + // +------------------------------------------------------+ + + cfgs->snk_hops_seps_vol_config = parameters_snk_hops_seps_vol_config(file_config); + cfgs->snk_hops_pfs_vol_config = parameters_snk_hops_pfs_vol_config(file_config); + + // +----------------------------------------------------------+ + // | Classify | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + cfgs->mod_classify_config = parameters_mod_classify_config(file_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + cfgs->msg_categories_config = parameters_msg_categories_config(file_config); + + // +------------------------------------------------------+ + // | Sink | + // +------------------------------------------------------+ + + cfgs->snk_categories_config = parameters_snk_categories_config(file_config); + + return cfgs; + + } + + void configs_destroy(configs * cfgs) { + + unsigned int iSink; + + // +----------------------------------------------------------+ + // | Raw | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Source | + // +------------------------------------------------------+ + + src_hops_cfg_destroy(cfgs->src_hops_mics_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + msg_hops_cfg_destroy(cfgs->msg_hops_mics_raw_config); + + // +----------------------------------------------------------+ + // | Mapping | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + mod_mapping_cfg_destroy(cfgs->mod_mapping_mics_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + msg_hops_cfg_destroy(cfgs->msg_hops_mics_map_config); + + // +----------------------------------------------------------+ + // | Resample | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + mod_resample_cfg_destroy(cfgs->mod_resample_mics_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + msg_hops_cfg_destroy(cfgs->msg_hops_mics_rs_config); + + // +----------------------------------------------------------+ + // | STFT | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + mod_stft_cfg_destroy(cfgs->mod_stft_mics_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + msg_spectra_cfg_destroy(cfgs->msg_spectra_mics_config); + + // +----------------------------------------------------------+ + // | Noise | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + mod_noise_cfg_destroy(cfgs->mod_noise_mics_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + msg_powers_cfg_destroy(cfgs->msg_powers_mics_config); + + // +----------------------------------------------------------+ + // | SSL | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + mod_ssl_cfg_destroy(cfgs->mod_ssl_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + msg_pots_cfg_destroy(cfgs->msg_pots_ssl_config); + + // +------------------------------------------------------+ + // | Sink | + // +------------------------------------------------------+ + + snk_pots_cfg_destroy(cfgs->snk_pots_ssl_config); + + // +----------------------------------------------------------+ + // | Target | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Injector | + // +------------------------------------------------------+ + + inj_targets_cfg_destroy(cfgs->inj_targets_sst_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + msg_targets_cfg_destroy(cfgs->msg_targets_sst_config); + + // +----------------------------------------------------------+ + // | SST | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + mod_sst_cfg_destroy(cfgs->mod_sst_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + msg_tracks_cfg_destroy(cfgs->msg_tracks_sst_config); + + // +------------------------------------------------------+ + // | Sink | + // +------------------------------------------------------+ + + snk_tracks_cfg_destroy(cfgs->snk_tracks_sst_config); + + // +----------------------------------------------------------+ + // | SSS | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + mod_sss_cfg_destroy(cfgs->mod_sss_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + msg_spectra_cfg_destroy(cfgs->msg_spectra_seps_config); + msg_spectra_cfg_destroy(cfgs->msg_spectra_pfs_config); + + // +----------------------------------------------------------+ + // | ISTFT | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + mod_istft_cfg_destroy(cfgs->mod_istft_seps_config); + mod_istft_cfg_destroy(cfgs->mod_istft_pfs_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + msg_hops_cfg_destroy(cfgs->msg_hops_seps_config); + msg_hops_cfg_destroy(cfgs->msg_hops_pfs_config); + + // +----------------------------------------------------------+ + // | Resample | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + mod_resample_cfg_destroy(cfgs->mod_resample_seps_config); + mod_resample_cfg_destroy(cfgs->mod_resample_pfs_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + msg_hops_cfg_destroy(cfgs->msg_hops_seps_rs_config); + msg_hops_cfg_destroy(cfgs->msg_hops_pfs_rs_config); + + // +----------------------------------------------------------+ + // | Volume | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + mod_volume_cfg_destroy(cfgs->mod_volume_seps_config); + mod_volume_cfg_destroy(cfgs->mod_volume_pfs_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + msg_hops_cfg_destroy(cfgs->msg_hops_seps_vol_config); + msg_hops_cfg_destroy(cfgs->msg_hops_pfs_vol_config); + + // +------------------------------------------------------+ + // | Sink | + // +------------------------------------------------------+ + + snk_hops_cfg_destroy(cfgs->snk_hops_seps_vol_config); + snk_hops_cfg_destroy(cfgs->snk_hops_pfs_vol_config); + + // +----------------------------------------------------------+ + // | Classify | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + mod_classify_cfg_destroy(cfgs->mod_classify_config); + + // +------------------------------------------------------+ + // | Message | + // +------------------------------------------------------+ + + msg_categories_cfg_destroy(cfgs->msg_categories_config); + + // +------------------------------------------------------+ + // | Sink | + // +------------------------------------------------------+ + + snk_categories_cfg_destroy(cfgs->snk_categories_config); + + free((void *) cfgs); + + } diff --git a/demo/odaslive/configs.h b/demo/odaslive/configs.h new file mode 100644 index 0000000..06e5cf8 --- /dev/null +++ b/demo/odaslive/configs.h @@ -0,0 +1,68 @@ +#ifndef __DEMO_CONFIGS +#define __DEMO_CONFIGS + + #include "parameters.h" + + #include + #include + + typedef struct configs { + + src_hops_cfg * src_hops_mics_config; + msg_hops_cfg * msg_hops_mics_raw_config; + + mod_mapping_cfg * mod_mapping_mics_config; + msg_hops_cfg * msg_hops_mics_map_config; + + mod_resample_cfg * mod_resample_mics_config; + msg_hops_cfg * msg_hops_mics_rs_config; + + mod_stft_cfg * mod_stft_mics_config; + msg_spectra_cfg * msg_spectra_mics_config; + + mod_noise_cfg * mod_noise_mics_config; + msg_powers_cfg * msg_powers_mics_config; + + mod_ssl_cfg * mod_ssl_config; + msg_pots_cfg * msg_pots_ssl_config; + snk_pots_cfg * snk_pots_ssl_config; + + inj_targets_cfg * inj_targets_sst_config; + msg_targets_cfg * msg_targets_sst_config; + + mod_sst_cfg * mod_sst_config; + msg_tracks_cfg * msg_tracks_sst_config; + snk_tracks_cfg * snk_tracks_sst_config; + + mod_sss_cfg * mod_sss_config; + msg_spectra_cfg * msg_spectra_seps_config; + msg_spectra_cfg * msg_spectra_pfs_config; + + mod_istft_cfg * mod_istft_seps_config; + mod_istft_cfg * mod_istft_pfs_config; + msg_hops_cfg * msg_hops_seps_config; + msg_hops_cfg * msg_hops_pfs_config; + + mod_resample_cfg * mod_resample_seps_config; + mod_resample_cfg * mod_resample_pfs_config; + msg_hops_cfg * msg_hops_seps_rs_config; + msg_hops_cfg * msg_hops_pfs_rs_config; + + mod_volume_cfg * mod_volume_seps_config; + mod_volume_cfg * mod_volume_pfs_config; + msg_hops_cfg * msg_hops_seps_vol_config; + msg_hops_cfg * msg_hops_pfs_vol_config; + snk_hops_cfg * snk_hops_seps_vol_config; + snk_hops_cfg * snk_hops_pfs_vol_config; + + mod_classify_cfg * mod_classify_config; + msg_categories_cfg * msg_categories_config; + snk_categories_cfg * snk_categories_config; + + } configs; + + configs * configs_construct(const char * file_config); + + void configs_destroy(configs * cfgs); + +#endif \ No newline at end of file diff --git a/demo/odaslive/main.c b/demo/odaslive/main.c new file mode 100644 index 0000000..b183af3 --- /dev/null +++ b/demo/odaslive/main.c @@ -0,0 +1,292 @@ + + #include + + #include "parameters.h" + #include "configs.h" + #include "objects.h" + #include "threads.h" + #include "profiler.h" + + #include + #include + #include + + // +----------------------------------------------------------+ + // | Variables | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Type | + // +------------------------------------------------------+ + + enum processing { + processing_singlethread, + processing_multithread + } type; + + // +------------------------------------------------------+ + // | Getopt | + // +------------------------------------------------------+ + + int c; + char * file_config; + + // +------------------------------------------------------+ + // | Objects | + // +------------------------------------------------------+ + + objects * objs; + aobjects * aobjs; + + // +------------------------------------------------------+ + // | Configurations | + // +------------------------------------------------------+ + + configs * cfgs; + + // +------------------------------------------------------+ + // | Profiler | + // +------------------------------------------------------+ + + profiler * prf; + + // +------------------------------------------------------+ + // | Flag | + // +------------------------------------------------------+ + + char stopProcess; + + // +----------------------------------------------------------+ + // | Signal handler | + // +----------------------------------------------------------+ + + void sighandler(int signum) { + + if (type == processing_singlethread) { + stopProcess = 1; + } + if (type == processing_multithread) { + threads_multiple_stop(aobjs); + } + + } + + // +----------------------------------------------------------+ + // | Main routine | + // +----------------------------------------------------------+ + + int main(int argc, char * argv[]) { + + // +------------------------------------------------------+ + // | Arguments | + // +------------------------------------------------------+ + + file_config = (char *) NULL; + char verbose = 0x00; + + type = processing_multithread; + + while ((c = getopt(argc,argv, "c:hsv")) != -1) { + + switch(c) { + + case 'c': + + file_config = (char *) malloc(sizeof(char) * (strlen(optarg)+1)); + strcpy(file_config, optarg); + + break; + + case 'h': + + printf("+----------------------------------------------------+\n"); + printf("| ODAS (Open embeddeD Audition System) |\n"); + printf("+----------------------------------------------------+\n"); + printf("| Author: Francois Grondin |\n"); + printf("| Email: francois.grondin2@usherbrooke.ca |\n"); + printf("| Website: introlab.3it.usherbrooke.ca |\n"); + printf("| Repository: github.com/introlab/odas |\n"); + printf("| Version: 1.0 |\n"); + printf("+----------------------------------------------------+\n"); + printf("| -c Configuration file (.cfg) |\n"); + printf("| -h Help |\n"); + printf("| -s Process sequentially (no multithread) |\n"); + printf("| -v Verbose |\n"); + printf("+----------------------------------------------------+\n"); + + exit(EXIT_SUCCESS); + + break; + + case 's': + + type = processing_singlethread; + + break; + + case 'v': + + verbose = 0x01; + + break; + + } + + } + + if (file_config == NULL) { + printf("Missing configuration file.\n"); + exit(EXIT_FAILURE); + } + + // +------------------------------------------------------+ + // | Copyright | + // +------------------------------------------------------+ + + if (verbose == 0x01) { + + printf("+--------------------------------------------+\n"); + printf("| ODAS (Open embeddeD Audition System) |\n"); + printf("+--------------------------------------------+\n"); + printf("| Author: Francois Grondin |\n"); + printf("| Email: francois.grondin2@usherbrooke.ca |\n"); + printf("| Website: introlab.3it.usherbrooke.ca |\n"); + printf("| Version: 1.0 |\n"); + printf("+--------------------------------------------+\n"); + + } + + // +------------------------------------------------------+ + // | Single thread | + // +------------------------------------------------------+ + + if (type == processing_singlethread) { + + // +--------------------------------------------------+ + // | Profiler | + // +--------------------------------------------------+ + + prf = profiler_construct(); + + // +--------------------------------------------------+ + // | Configure | + // +--------------------------------------------------+ + + if (verbose == 0x01) printf("| + Initializing configurations...... "); fflush(stdout); + + cfgs = configs_construct(file_config); + + if (verbose == 0x01) printf("[Done] |\n"); + + // +--------------------------------------------------+ + // | Construct | + // +--------------------------------------------------+ + + if (verbose == 0x01) printf("| + Initializing objects............. "); fflush(stdout); + + objs = objects_construct(cfgs); + + if (verbose == 0x01) printf("[Done] |\n"); + + // +--------------------------------------------------+ + // | Processing | + // +--------------------------------------------------+ + + if (verbose == 0x01) printf("| + Processing....................... "); fflush(stdout); + + threads_single_open(objs); + stopProcess = 0; + while((threads_single_process(objs, prf) == 0) && (stopProcess == 0)); + threads_single_close(objs); + + if (verbose == 0x01) printf("[Done] |\n"); + + // +--------------------------------------------------+ + // | Free memory | + // +--------------------------------------------------+ + + if (verbose == 0x01) printf("| + Free memory...................... "); fflush(stdout); + + objects_destroy(objs); + configs_destroy(cfgs); + free((void *) file_config); + + if (verbose == 0x01) printf("[Done] |\n"); + + // +--------------------------------------------------+ + // | Results | + // +--------------------------------------------------+ + + if (verbose == 0x01) profiler_printf(prf); + + profiler_destroy(prf); + + } + + // +------------------------------------------------------+ + // | Multiple threads | + // +------------------------------------------------------+ + + if (type == processing_multithread) { + + // +--------------------------------------------------+ + // | Configure | + // +--------------------------------------------------+ + + if (verbose == 0x01) printf("| + Initializing configurations...... "); fflush(stdout); + + cfgs = configs_construct(file_config); + + if (verbose == 0x01) printf("[Done] |\n"); + + // +--------------------------------------------------+ + // | Construct | + // +--------------------------------------------------+ + + if (verbose == 0x01) printf("| + Initializing objects............. "); fflush(stdout); + + aobjs = aobjects_construct(cfgs); + + if (verbose == 0x01) printf("[Done] |\n"); + + // +--------------------------------------------------+ + // | Launch threads | + // +--------------------------------------------------+ + + signal(SIGINT, sighandler); + + if (verbose == 0x01) printf("| + Launch threads................... "); fflush(stdout); + + threads_multiple_start(aobjs); + + if (verbose == 0x01) printf("[Done] |\n"); + + // +--------------------------------------------------+ + // | Wait | + // +--------------------------------------------------+ + + if (verbose == 0x01) printf("| + Threads running.................. "); fflush(stdout); + + threads_multiple_join(aobjs); + + if (verbose == 0x01) printf("[Done] |\n"); + + // +--------------------------------------------------+ + // | Free memory | + // +--------------------------------------------------+ + + if (verbose == 0x01) printf("| + Free memory...................... "); fflush(stdout); + + aobjects_destroy(aobjs); + configs_destroy(cfgs); + free((void *) file_config); + + if (verbose == 0x01) printf("[Done] |\n"); + + if (verbose == 0x01) printf("+--------------------------------------------+\n"); + + } + + return 0; + + } diff --git a/demo/odaslive/objects.c b/demo/odaslive/objects.c new file mode 100644 index 0000000..c7fecba --- /dev/null +++ b/demo/odaslive/objects.c @@ -0,0 +1,1626 @@ + + #include "objects.h" + + objects * objects_construct(const configs * cfgs) { + + objects * objs; + unsigned int iSink; + + objs = (objects *) malloc(sizeof(objects)); + + // +----------------------------------------------------------+ + // | Construct | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Raw | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Source | + // +--------------------------------------------------+ + + objs->src_hops_mics_object = src_hops_construct(cfgs->src_hops_mics_config, + cfgs->msg_hops_mics_raw_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->con_hops_mics_raw_object = con_hops_construct(1, cfgs->msg_hops_mics_raw_config); + + // +------------------------------------------------------+ + // | Mapping | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->mod_mapping_mics_object = mod_mapping_construct(cfgs->mod_mapping_mics_config, + cfgs->msg_hops_mics_map_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->con_hops_mics_map_object = con_hops_construct(1, cfgs->msg_hops_mics_map_config); + + // +------------------------------------------------------+ + // | Resample | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->mod_resample_mics_object = mod_resample_construct(cfgs->mod_resample_mics_config, + cfgs->msg_hops_mics_map_config, + cfgs->msg_hops_mics_rs_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->con_hops_mics_rs_object = con_hops_construct(2, cfgs->msg_hops_mics_rs_config); + + // +------------------------------------------------------+ + // | STFT | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->mod_stft_mics_object = mod_stft_construct(cfgs->mod_stft_mics_config, + cfgs->msg_hops_mics_rs_config, + cfgs->msg_spectra_mics_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->con_spectra_mics_object = con_spectra_construct(3, cfgs->msg_spectra_mics_config); + + // +------------------------------------------------------+ + // | Noise | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->mod_noise_mics_object = mod_noise_construct(cfgs->mod_noise_mics_config, + cfgs->msg_spectra_mics_config, + cfgs->msg_powers_mics_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->con_powers_mics_object = con_powers_construct(1, cfgs->msg_powers_mics_config); + + // +------------------------------------------------------+ + // | SSL | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->mod_ssl_object = mod_ssl_construct(cfgs->mod_ssl_config, + cfgs->msg_spectra_mics_config, + cfgs->msg_pots_ssl_config); + + // +--------------------------------------------------+ + // | Sinks | + // +--------------------------------------------------+ + + objs->snk_pots_ssl_object = snk_pots_construct(cfgs->snk_pots_ssl_config, + cfgs->msg_pots_ssl_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->con_pots_ssl_object = con_pots_construct(2, cfgs->msg_pots_ssl_config); + + // +------------------------------------------------------+ + // | Target | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Injector | + // +--------------------------------------------------+ + + objs->inj_targets_sst_object = inj_targets_construct(cfgs->inj_targets_sst_config, + cfgs->msg_hops_mics_rs_config, + cfgs->msg_targets_sst_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->con_targets_sst_object = con_targets_construct(1, cfgs->msg_targets_sst_config); + + // +------------------------------------------------------+ + // | SST | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->mod_sst_object = mod_sst_construct(cfgs->mod_sst_config, + cfgs->mod_ssl_config, + cfgs->msg_pots_ssl_config, + cfgs->msg_targets_sst_config, + cfgs->msg_tracks_sst_config); + + // +--------------------------------------------------+ + // | Sinks | + // +--------------------------------------------------+ + + objs->snk_tracks_sst_object = snk_tracks_construct(cfgs->snk_tracks_sst_config, + cfgs->msg_tracks_sst_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->con_tracks_sst_object = con_tracks_construct(3, cfgs->msg_tracks_sst_config); + + // +------------------------------------------------------+ + // | SSS | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->mod_sss_object = mod_sss_construct(cfgs->mod_sss_config, + cfgs->msg_tracks_sst_config, + cfgs->msg_spectra_mics_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->con_spectra_seps_object = con_spectra_construct(1, cfgs->msg_spectra_seps_config); + objs->con_spectra_pfs_object = con_spectra_construct(1, cfgs->msg_spectra_pfs_config); + + // +------------------------------------------------------+ + // | ISTFT | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->mod_istft_seps_object = mod_istft_construct(cfgs->mod_istft_seps_config, + cfgs->msg_spectra_seps_config, + cfgs->msg_hops_seps_config); + + objs->mod_istft_pfs_object = mod_istft_construct(cfgs->mod_istft_pfs_config, + cfgs->msg_spectra_pfs_config, + cfgs->msg_hops_pfs_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->con_hops_seps_object = con_hops_construct(2, cfgs->msg_hops_seps_config); + objs->con_hops_pfs_object = con_hops_construct(1, cfgs->msg_hops_pfs_config); + + // +------------------------------------------------------+ + // | Resample | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->mod_resample_seps_object = mod_resample_construct(cfgs->mod_resample_seps_config, + cfgs->msg_hops_seps_config, + cfgs->msg_hops_seps_rs_config); + + objs->mod_resample_pfs_object = mod_resample_construct(cfgs->mod_resample_pfs_config, + cfgs->msg_hops_pfs_config, + cfgs->msg_hops_pfs_rs_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->con_hops_seps_rs_object = con_hops_construct(1, cfgs->msg_hops_seps_rs_config); + objs->con_hops_pfs_rs_object = con_hops_construct(1, cfgs->msg_hops_pfs_rs_config); + + // +------------------------------------------------------+ + // | Volume | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->mod_volume_seps_object = mod_volume_construct(cfgs->mod_volume_seps_config, + cfgs->msg_hops_seps_vol_config); + + objs->mod_volume_pfs_object = mod_volume_construct(cfgs->mod_volume_pfs_config, + cfgs->msg_hops_pfs_vol_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->con_hops_seps_vol_object = con_hops_construct(1, cfgs->msg_hops_seps_vol_config); + objs->con_hops_pfs_vol_object = con_hops_construct(1, cfgs->msg_hops_pfs_vol_config); + + // +--------------------------------------------------+ + // | Sink | + // +--------------------------------------------------+ + + objs->snk_hops_seps_vol_object = snk_hops_construct(cfgs->snk_hops_seps_vol_config, + cfgs->msg_hops_seps_vol_config); + + objs->snk_hops_pfs_vol_object = snk_hops_construct(cfgs->snk_hops_pfs_vol_config, + cfgs->msg_hops_pfs_vol_config); + + // +------------------------------------------------------+ + // | Classify | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->mod_classify_object = mod_classify_construct(cfgs->mod_classify_config, + cfgs->msg_hops_seps_config, + cfgs->msg_tracks_sst_config, + cfgs->msg_categories_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->con_categories_object = con_categories_construct(1, cfgs->msg_categories_config); + + // +--------------------------------------------------+ + // | Sink | + // +--------------------------------------------------+ + + objs->snk_categories_object = snk_categories_construct(cfgs->snk_categories_config, + cfgs->msg_categories_config); + + // +----------------------------------------------------------+ + // | Connect | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Raw | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Source | + // +--------------------------------------------------+ + + src_hops_connect(objs->src_hops_mics_object, + objs->con_hops_mics_raw_object->in); + + // +------------------------------------------------------+ + // | Mapping | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_mapping_connect(objs->mod_mapping_mics_object, + objs->con_hops_mics_raw_object->outs[0], + objs->con_hops_mics_map_object->in); + + // +------------------------------------------------------+ + // | Resample | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_resample_connect(objs->mod_resample_mics_object, + objs->con_hops_mics_map_object->outs[0], + objs->con_hops_mics_rs_object->in); + + // +------------------------------------------------------+ + // | STFT | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_stft_connect(objs->mod_stft_mics_object, + objs->con_hops_mics_rs_object->outs[0], + objs->con_spectra_mics_object->in); + + // +------------------------------------------------------+ + // | Noise | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_noise_connect(objs->mod_noise_mics_object, + objs->con_spectra_mics_object->outs[0], + objs->con_powers_mics_object->in); + + // +------------------------------------------------------+ + // | SSL | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_ssl_connect(objs->mod_ssl_object, + objs->con_spectra_mics_object->outs[1], + objs->con_pots_ssl_object->in); + + // +--------------------------------------------------+ + // | Sinks | + // +--------------------------------------------------+ + + snk_pots_connect(objs->snk_pots_ssl_object, + objs->con_pots_ssl_object->outs[1]); + + // +------------------------------------------------------+ + // | Target | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Injector | + // +--------------------------------------------------+ + + inj_targets_connect(objs->inj_targets_sst_object, + objs->con_hops_mics_rs_object->outs[1], + objs->con_targets_sst_object->in); + + // +------------------------------------------------------+ + // | SST | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_sst_connect(objs->mod_sst_object, + objs->con_pots_ssl_object->outs[0], + objs->con_targets_sst_object->outs[0], + objs->con_tracks_sst_object->in); + + // +--------------------------------------------------+ + // | Sinks | + // +--------------------------------------------------+ + + snk_tracks_connect(objs->snk_tracks_sst_object, + objs->con_tracks_sst_object->outs[2]); + + // +------------------------------------------------------+ + // | SSS | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_sss_connect(objs->mod_sss_object, + objs->con_spectra_mics_object->outs[2], + objs->con_powers_mics_object->outs[0], + objs->con_tracks_sst_object->outs[0], + objs->con_spectra_seps_object->in, + objs->con_spectra_pfs_object->in); + + // +------------------------------------------------------+ + // | ISTFT | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_istft_connect(objs->mod_istft_seps_object, + objs->con_spectra_seps_object->outs[0], + objs->con_hops_seps_object->in); + + mod_istft_connect(objs->mod_istft_pfs_object, + objs->con_spectra_pfs_object->outs[0], + objs->con_hops_pfs_object->in); + + // +------------------------------------------------------+ + // | Resample | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_resample_connect(objs->mod_resample_seps_object, + objs->con_hops_seps_object->outs[0], + objs->con_hops_seps_rs_object->in); + + mod_resample_connect(objs->mod_resample_pfs_object, + objs->con_hops_pfs_object->outs[0], + objs->con_hops_pfs_rs_object->in); + + // +------------------------------------------------------+ + // | Volume | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_volume_connect(objs->mod_volume_seps_object, + objs->con_hops_seps_rs_object->outs[0], + objs->con_hops_seps_vol_object->in); + + mod_volume_connect(objs->mod_volume_pfs_object, + objs->con_hops_pfs_rs_object->outs[0], + objs->con_hops_pfs_vol_object->in); + + // +--------------------------------------------------+ + // | Sink | + // +--------------------------------------------------+ + + snk_hops_connect(objs->snk_hops_seps_vol_object, + objs->con_hops_seps_vol_object->outs[0]); + + snk_hops_connect(objs->snk_hops_pfs_vol_object, + objs->con_hops_pfs_vol_object->outs[0]); + + // +------------------------------------------------------+ + // | Classify | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_classify_connect(objs->mod_classify_object, + objs->con_hops_seps_object->outs[1], + objs->con_tracks_sst_object->outs[1], + objs->con_categories_object->in); + + // +--------------------------------------------------+ + // | Sink | + // +--------------------------------------------------+ + + snk_categories_connect(objs->snk_categories_object, + objs->con_categories_object->outs[0]); + + // +----------------------------------------------------------+ + // | Enable modules | + // +----------------------------------------------------------+ + + mod_mapping_enable(objs->mod_mapping_mics_object); + mod_resample_enable(objs->mod_resample_mics_object); + mod_stft_enable(objs->mod_stft_mics_object); + + if (cfgs->snk_pots_ssl_config->interface->type != interface_blackhole) { + + mod_ssl_enable(objs->mod_ssl_object); + + } + + if (cfgs->snk_tracks_sst_config->interface->type != interface_blackhole) { + + mod_ssl_enable(objs->mod_ssl_object); + mod_sst_enable(objs->mod_sst_object); + + } + + if (cfgs->snk_hops_seps_vol_config->interface->type != interface_blackhole) { + + mod_ssl_enable(objs->mod_ssl_object); + mod_sst_enable(objs->mod_sst_object); + mod_noise_enable(objs->mod_noise_mics_object); + mod_sss_enable(objs->mod_sss_object); + mod_istft_enable(objs->mod_istft_seps_object); + mod_resample_enable(objs->mod_resample_seps_object); + mod_volume_enable(objs->mod_volume_seps_object); + + } + + if (cfgs->snk_hops_pfs_vol_config->interface->type != interface_blackhole) { + + mod_ssl_enable(objs->mod_ssl_object); + mod_sst_enable(objs->mod_sst_object); + mod_noise_enable(objs->mod_noise_mics_object); + mod_sss_enable(objs->mod_sss_object); + mod_istft_enable(objs->mod_istft_pfs_object); + mod_resample_enable(objs->mod_resample_pfs_object); + mod_volume_enable(objs->mod_volume_pfs_object); + + } + + if (cfgs->snk_categories_config->interface->type != interface_blackhole) { + + mod_ssl_enable(objs->mod_ssl_object); + mod_sst_enable(objs->mod_sst_object); + mod_noise_enable(objs->mod_noise_mics_object); + mod_sss_enable(objs->mod_sss_object); + mod_istft_enable(objs->mod_istft_seps_object); + mod_classify_enable(objs->mod_classify_object); + + } + + return objs; + + } + + void objects_destroy(objects * objs) { + + unsigned int iSink; + + // +----------------------------------------------------------+ + // | Destroy | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Raw | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Source | + // +--------------------------------------------------+ + + src_hops_destroy(objs->src_hops_mics_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + con_hops_destroy(objs->con_hops_mics_raw_object); + + // +------------------------------------------------------+ + // | Mapping | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_mapping_destroy(objs->mod_mapping_mics_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + con_hops_destroy(objs->con_hops_mics_map_object); + + // +------------------------------------------------------+ + // | Resample | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_resample_destroy(objs->mod_resample_mics_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + con_hops_destroy(objs->con_hops_mics_rs_object); + + // +------------------------------------------------------+ + // | STFT | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_stft_destroy(objs->mod_stft_mics_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + con_spectra_destroy(objs->con_spectra_mics_object); + + // +------------------------------------------------------+ + // | Noise | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_noise_destroy(objs->mod_noise_mics_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + con_powers_destroy(objs->con_powers_mics_object); + + // +------------------------------------------------------+ + // | SSL | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_ssl_destroy(objs->mod_ssl_object); + + // +--------------------------------------------------+ + // | Sinks | + // +--------------------------------------------------+ + + snk_pots_destroy(objs->snk_pots_ssl_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + con_pots_destroy(objs->con_pots_ssl_object); + + // +------------------------------------------------------+ + // | Target | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Injector | + // +--------------------------------------------------+ + + inj_targets_destroy(objs->inj_targets_sst_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + con_targets_destroy(objs->con_targets_sst_object); + + // +------------------------------------------------------+ + // | SST | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_sst_destroy(objs->mod_sst_object); + + // +--------------------------------------------------+ + // | Sinks | + // +--------------------------------------------------+ + + snk_tracks_destroy(objs->snk_tracks_sst_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + con_tracks_destroy(objs->con_tracks_sst_object); + + // +------------------------------------------------------+ + // | SSS | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_sss_destroy(objs->mod_sss_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + con_spectra_destroy(objs->con_spectra_seps_object); + con_spectra_destroy(objs->con_spectra_pfs_object); + + // +------------------------------------------------------+ + // | ISTFT | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_istft_destroy(objs->mod_istft_seps_object); + mod_istft_destroy(objs->mod_istft_pfs_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + con_hops_destroy(objs->con_hops_seps_object); + con_hops_destroy(objs->con_hops_pfs_object); + + // +------------------------------------------------------+ + // | Resample | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_resample_destroy(objs->mod_resample_seps_object); + mod_resample_destroy(objs->mod_resample_pfs_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + con_hops_destroy(objs->con_hops_seps_rs_object); + con_hops_destroy(objs->con_hops_pfs_rs_object); + + // +------------------------------------------------------+ + // | Volume | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_volume_destroy(objs->mod_volume_seps_object); + mod_volume_destroy(objs->mod_volume_pfs_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + con_hops_destroy(objs->con_hops_seps_vol_object); + con_hops_destroy(objs->con_hops_pfs_vol_object); + + // +--------------------------------------------------+ + // | Sink | + // +--------------------------------------------------+ + + snk_hops_destroy(objs->snk_hops_seps_vol_object); + snk_hops_destroy(objs->snk_hops_pfs_vol_object); + + // +------------------------------------------------------+ + // | Classify | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + mod_classify_destroy(objs->mod_classify_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + con_categories_destroy(objs->con_categories_object); + + // +--------------------------------------------------+ + // | Sink | + // +--------------------------------------------------+ + + snk_categories_destroy(objs->snk_categories_object); + + free((void *) objs); + + } + + aobjects * aobjects_construct(const configs * cfgs) { + + aobjects * objs; + unsigned int iSink; + + objs = (aobjects *) malloc(sizeof(aobjects)); + + objs->nMessages = 100; + + // +----------------------------------------------------------+ + // | Construct | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Raw | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Source | + // +--------------------------------------------------+ + + objs->asrc_hops_mics_object = asrc_hops_construct(cfgs->src_hops_mics_config, + cfgs->msg_hops_mics_raw_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->acon_hops_mics_raw_object = acon_hops_construct(1, objs->nMessages, cfgs->msg_hops_mics_raw_config); + + // +------------------------------------------------------+ + // | Mapping | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->amod_mapping_mics_object = amod_mapping_construct(cfgs->mod_mapping_mics_config, + cfgs->msg_hops_mics_map_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->acon_hops_mics_map_object = acon_hops_construct(1, objs->nMessages, cfgs->msg_hops_mics_map_config); + + // +------------------------------------------------------+ + // | Resample | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->amod_resample_mics_object = amod_resample_construct(cfgs->mod_resample_mics_config, + cfgs->msg_hops_mics_map_config, + cfgs->msg_hops_mics_rs_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->acon_hops_mics_rs_object = acon_hops_construct(2, objs->nMessages, cfgs->msg_hops_mics_rs_config); + + // +------------------------------------------------------+ + // | STFT | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->amod_stft_mics_object = amod_stft_construct(cfgs->mod_stft_mics_config, + cfgs->msg_hops_mics_rs_config, + cfgs->msg_spectra_mics_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->acon_spectra_mics_object = acon_spectra_construct(3, objs->nMessages, cfgs->msg_spectra_mics_config); + + // +------------------------------------------------------+ + // | Noise | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->amod_noise_mics_object = amod_noise_construct(cfgs->mod_noise_mics_config, + cfgs->msg_spectra_mics_config, + cfgs->msg_powers_mics_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->acon_powers_mics_object = acon_powers_construct(1, objs->nMessages, cfgs->msg_powers_mics_config); + + // +------------------------------------------------------+ + // | SSL | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->amod_ssl_object = amod_ssl_construct(cfgs->mod_ssl_config, + cfgs->msg_spectra_mics_config, + cfgs->msg_pots_ssl_config); + + // +--------------------------------------------------+ + // | Sinks | + // +--------------------------------------------------+ + + objs->asnk_pots_ssl_object = asnk_pots_construct(cfgs->snk_pots_ssl_config, + cfgs->msg_pots_ssl_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->acon_pots_ssl_object = acon_pots_construct(2, objs->nMessages, cfgs->msg_pots_ssl_config); + + // +------------------------------------------------------+ + // | Target | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Injector | + // +--------------------------------------------------+ + + objs->ainj_targets_sst_object = ainj_targets_construct(cfgs->inj_targets_sst_config, + cfgs->msg_hops_mics_rs_config, + cfgs->msg_targets_sst_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->acon_targets_sst_object = acon_targets_construct(1, objs->nMessages, cfgs->msg_targets_sst_config); + + // +------------------------------------------------------+ + // | SST | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->amod_sst_object = amod_sst_construct(cfgs->mod_sst_config, + cfgs->mod_ssl_config, + cfgs->msg_pots_ssl_config, + cfgs->msg_targets_sst_config, + cfgs->msg_tracks_sst_config); + + // +--------------------------------------------------+ + // | Sinks | + // +--------------------------------------------------+ + + objs->asnk_tracks_sst_object = asnk_tracks_construct(cfgs->snk_tracks_sst_config, + cfgs->msg_tracks_sst_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->acon_tracks_sst_object = acon_tracks_construct(3, objs->nMessages, cfgs->msg_tracks_sst_config); + + // +------------------------------------------------------+ + // | SSS | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->amod_sss_object = amod_sss_construct(cfgs->mod_sss_config, + cfgs->msg_tracks_sst_config, + cfgs->msg_spectra_mics_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->acon_spectra_seps_object = acon_spectra_construct(1, objs->nMessages, cfgs->msg_spectra_seps_config); + objs->acon_spectra_pfs_object = acon_spectra_construct(1, objs->nMessages, cfgs->msg_spectra_pfs_config); + + // +------------------------------------------------------+ + // | ISTFT | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->amod_istft_seps_object = amod_istft_construct(cfgs->mod_istft_seps_config, + cfgs->msg_spectra_seps_config, + cfgs->msg_hops_seps_config); + + objs->amod_istft_pfs_object = amod_istft_construct(cfgs->mod_istft_pfs_config, + cfgs->msg_spectra_pfs_config, + cfgs->msg_hops_pfs_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->acon_hops_seps_object = acon_hops_construct(2, objs->nMessages, cfgs->msg_hops_seps_config); + objs->acon_hops_pfs_object = acon_hops_construct(1, objs->nMessages, cfgs->msg_hops_pfs_config); + + // +------------------------------------------------------+ + // | Resample | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->amod_resample_seps_object = amod_resample_construct(cfgs->mod_resample_seps_config, + cfgs->msg_hops_seps_config, + cfgs->msg_hops_seps_rs_config); + + objs->amod_resample_pfs_object = amod_resample_construct(cfgs->mod_resample_pfs_config, + cfgs->msg_hops_pfs_config, + cfgs->msg_hops_pfs_rs_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->acon_hops_seps_rs_object = acon_hops_construct(1, objs->nMessages, cfgs->msg_hops_seps_rs_config); + + objs->acon_hops_pfs_rs_object = acon_hops_construct(1, objs->nMessages, cfgs->msg_hops_pfs_rs_config); + + // +------------------------------------------------------+ + // | Volume | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->amod_volume_seps_object = amod_volume_construct(cfgs->mod_volume_seps_config, + cfgs->msg_hops_seps_vol_config); + + objs->amod_volume_pfs_object = amod_volume_construct(cfgs->mod_volume_pfs_config, + cfgs->msg_hops_pfs_vol_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->acon_hops_seps_vol_object = acon_hops_construct(1, objs->nMessages, cfgs->msg_hops_seps_vol_config); + + objs->acon_hops_pfs_vol_object = acon_hops_construct(1, objs->nMessages, cfgs->msg_hops_pfs_vol_config); + + // +--------------------------------------------------+ + // | Sink | + // +--------------------------------------------------+ + + objs->asnk_hops_seps_vol_object = asnk_hops_construct(cfgs->snk_hops_seps_vol_config, + cfgs->msg_hops_seps_vol_config); + + objs->asnk_hops_pfs_vol_object = asnk_hops_construct(cfgs->snk_hops_pfs_vol_config, + cfgs->msg_hops_pfs_vol_config); + + // +------------------------------------------------------+ + // | Classify | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + objs->amod_classify_object = amod_classify_construct(cfgs->mod_classify_config, + cfgs->msg_hops_seps_config, + cfgs->msg_tracks_sst_config, + cfgs->msg_categories_config); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + objs->acon_categories_object = acon_categories_construct(1, objs->nMessages, cfgs->msg_categories_config); + + // +--------------------------------------------------+ + // | Sink | + // +--------------------------------------------------+ + + objs->asnk_categories_object = asnk_categories_construct(cfgs->snk_categories_config, + cfgs->msg_categories_config); + + // +----------------------------------------------------------+ + // | Connect | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Raw | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Source | + // +--------------------------------------------------+ + + asrc_hops_connect(objs->asrc_hops_mics_object, + objs->acon_hops_mics_raw_object->in); + + // +------------------------------------------------------+ + // | Mapping | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_mapping_connect(objs->amod_mapping_mics_object, + objs->acon_hops_mics_raw_object->outs[0], + objs->acon_hops_mics_map_object->in); + + // +------------------------------------------------------+ + // | Resample | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_resample_connect(objs->amod_resample_mics_object, + objs->acon_hops_mics_map_object->outs[0], + objs->acon_hops_mics_rs_object->in); + + // +------------------------------------------------------+ + // | STFT | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_stft_connect(objs->amod_stft_mics_object, + objs->acon_hops_mics_rs_object->outs[0], + objs->acon_spectra_mics_object->in); + + // +------------------------------------------------------+ + // | Noise | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_noise_connect(objs->amod_noise_mics_object, + objs->acon_spectra_mics_object->outs[0], + objs->acon_powers_mics_object->in); + + // +------------------------------------------------------+ + // | SSL | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_ssl_connect(objs->amod_ssl_object, + objs->acon_spectra_mics_object->outs[1], + objs->acon_pots_ssl_object->in); + + // +--------------------------------------------------+ + // | Sinks | + // +--------------------------------------------------+ + + asnk_pots_connect(objs->asnk_pots_ssl_object, + objs->acon_pots_ssl_object->outs[1]); + + // +------------------------------------------------------+ + // | Target | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Injector | + // +--------------------------------------------------+ + + ainj_targets_connect(objs->ainj_targets_sst_object, + objs->acon_hops_mics_rs_object->outs[1], + objs->acon_targets_sst_object->in); + + // +------------------------------------------------------+ + // | SST | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_sst_connect(objs->amod_sst_object, + objs->acon_pots_ssl_object->outs[0], + objs->acon_targets_sst_object->outs[0], + objs->acon_tracks_sst_object->in); + + // +--------------------------------------------------+ + // | Sinks | + // +--------------------------------------------------+ + + asnk_tracks_connect(objs->asnk_tracks_sst_object, + objs->acon_tracks_sst_object->outs[2]); + + // +------------------------------------------------------+ + // | SSS | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_sss_connect(objs->amod_sss_object, + objs->acon_spectra_mics_object->outs[2], + objs->acon_powers_mics_object->outs[0], + objs->acon_tracks_sst_object->outs[0], + objs->acon_spectra_seps_object->in, + objs->acon_spectra_pfs_object->in); + + // +------------------------------------------------------+ + // | ISTFT | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_istft_connect(objs->amod_istft_seps_object, + objs->acon_spectra_seps_object->outs[0], + objs->acon_hops_seps_object->in); + + amod_istft_connect(objs->amod_istft_pfs_object, + objs->acon_spectra_pfs_object->outs[0], + objs->acon_hops_pfs_object->in); + + // +------------------------------------------------------+ + // | Resample | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_resample_connect(objs->amod_resample_seps_object, + objs->acon_hops_seps_object->outs[0], + objs->acon_hops_seps_rs_object->in); + + amod_resample_connect(objs->amod_resample_pfs_object, + objs->acon_hops_pfs_object->outs[0], + objs->acon_hops_pfs_rs_object->in); + + // +------------------------------------------------------+ + // | Volume | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_volume_connect(objs->amod_volume_seps_object, + objs->acon_hops_seps_rs_object->outs[0], + objs->acon_hops_seps_vol_object->in); + + amod_volume_connect(objs->amod_volume_pfs_object, + objs->acon_hops_pfs_rs_object->outs[0], + objs->acon_hops_pfs_vol_object->in); + + // +--------------------------------------------------+ + // | Sink | + // +--------------------------------------------------+ + + asnk_hops_connect(objs->asnk_hops_seps_vol_object, + objs->acon_hops_seps_vol_object->outs[0]); + + asnk_hops_connect(objs->asnk_hops_pfs_vol_object, + objs->acon_hops_pfs_vol_object->outs[0]); + + // +------------------------------------------------------+ + // | Classify | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_classify_connect(objs->amod_classify_object, + objs->acon_hops_seps_object->outs[1], + objs->acon_tracks_sst_object->outs[1], + objs->acon_categories_object->in); + + // +--------------------------------------------------+ + // | Sink | + // +--------------------------------------------------+ + + asnk_categories_connect(objs->asnk_categories_object, + objs->acon_categories_object->outs[0]); + + // +----------------------------------------------------------+ + // | Enable modules | + // +----------------------------------------------------------+ + + amod_mapping_enable(objs->amod_mapping_mics_object); + amod_resample_enable(objs->amod_resample_mics_object); + amod_stft_enable(objs->amod_stft_mics_object); + + if (cfgs->snk_pots_ssl_config->interface->type != interface_blackhole) { + + amod_ssl_enable(objs->amod_ssl_object); + + } + + if (cfgs->snk_tracks_sst_config->interface->type != interface_blackhole) { + + amod_ssl_enable(objs->amod_ssl_object); + amod_sst_enable(objs->amod_sst_object); + + } + + if (cfgs->snk_hops_seps_vol_config->interface->type != interface_blackhole) { + + amod_ssl_enable(objs->amod_ssl_object); + amod_sst_enable(objs->amod_sst_object); + amod_noise_enable(objs->amod_noise_mics_object); + amod_sss_enable(objs->amod_sss_object); + amod_istft_enable(objs->amod_istft_seps_object); + amod_resample_enable(objs->amod_resample_seps_object); + amod_volume_enable(objs->amod_volume_seps_object); + + } + + if (cfgs->snk_hops_pfs_vol_config->interface->type != interface_blackhole) { + + amod_ssl_enable(objs->amod_ssl_object); + amod_sst_enable(objs->amod_sst_object); + amod_noise_enable(objs->amod_noise_mics_object); + amod_sss_enable(objs->amod_sss_object); + amod_istft_enable(objs->amod_istft_pfs_object); + amod_resample_enable(objs->amod_resample_pfs_object); + amod_volume_enable(objs->amod_volume_pfs_object); + + } + + if (cfgs->snk_categories_config->interface->type != interface_blackhole) { + + amod_ssl_enable(objs->amod_ssl_object); + amod_sst_enable(objs->amod_sst_object); + amod_noise_enable(objs->amod_noise_mics_object); + amod_sss_enable(objs->amod_sss_object); + amod_istft_enable(objs->amod_istft_seps_object); + amod_classify_enable(objs->amod_classify_object); + + } + + return objs; + + } + + void aobjects_destroy(aobjects * objs) { + + unsigned int iSink; + + // +----------------------------------------------------------+ + // | Destroy | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Raw | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Source | + // +--------------------------------------------------+ + + asrc_hops_destroy(objs->asrc_hops_mics_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + acon_hops_destroy(objs->acon_hops_mics_raw_object); + + // +------------------------------------------------------+ + // | Mapping | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_mapping_destroy(objs->amod_mapping_mics_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + acon_hops_destroy(objs->acon_hops_mics_map_object); + + // +------------------------------------------------------+ + // | Resample | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_resample_destroy(objs->amod_resample_mics_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + acon_hops_destroy(objs->acon_hops_mics_rs_object); + + // +------------------------------------------------------+ + // | STFT | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_stft_destroy(objs->amod_stft_mics_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + acon_spectra_destroy(objs->acon_spectra_mics_object); + + // +------------------------------------------------------+ + // | Noise | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_noise_destroy(objs->amod_noise_mics_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + acon_powers_destroy(objs->acon_powers_mics_object); + + // +------------------------------------------------------+ + // | SSL | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_ssl_destroy(objs->amod_ssl_object); + + // +--------------------------------------------------+ + // | Sinks | + // +--------------------------------------------------+ + + asnk_pots_destroy(objs->asnk_pots_ssl_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + acon_pots_destroy(objs->acon_pots_ssl_object); + + // +------------------------------------------------------+ + // | Target | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Injector | + // +--------------------------------------------------+ + + ainj_targets_destroy(objs->ainj_targets_sst_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + acon_targets_destroy(objs->acon_targets_sst_object); + + // +------------------------------------------------------+ + // | SST | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_sst_destroy(objs->amod_sst_object); + + // +--------------------------------------------------+ + // | Sinks | + // +--------------------------------------------------+ + + asnk_tracks_destroy(objs->asnk_tracks_sst_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + acon_tracks_destroy(objs->acon_tracks_sst_object); + + // +------------------------------------------------------+ + // | SSS | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_sss_destroy(objs->amod_sss_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + acon_spectra_destroy(objs->acon_spectra_seps_object); + acon_spectra_destroy(objs->acon_spectra_pfs_object); + + // +------------------------------------------------------+ + // | ISTFT | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_istft_destroy(objs->amod_istft_seps_object); + amod_istft_destroy(objs->amod_istft_pfs_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + acon_hops_destroy(objs->acon_hops_seps_object); + acon_hops_destroy(objs->acon_hops_pfs_object); + + // +------------------------------------------------------+ + // | Resample | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_resample_destroy(objs->amod_resample_seps_object); + amod_resample_destroy(objs->amod_resample_pfs_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + acon_hops_destroy(objs->acon_hops_seps_rs_object); + acon_hops_destroy(objs->acon_hops_pfs_rs_object); + + // +------------------------------------------------------+ + // | Resample | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_volume_destroy(objs->amod_volume_seps_object); + amod_volume_destroy(objs->amod_volume_pfs_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + acon_hops_destroy(objs->acon_hops_seps_vol_object); + acon_hops_destroy(objs->acon_hops_pfs_vol_object); + + // +--------------------------------------------------+ + // | Sink | + // +--------------------------------------------------+ + + asnk_hops_destroy(objs->asnk_hops_seps_vol_object); + asnk_hops_destroy(objs->asnk_hops_pfs_vol_object); + + // +------------------------------------------------------+ + // | Classify | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + amod_classify_destroy(objs->amod_classify_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + acon_categories_destroy(objs->acon_categories_object); + + // +--------------------------------------------------+ + // | Sink | + // +--------------------------------------------------+ + + asnk_categories_destroy(objs->asnk_categories_object); + + free((void *) objs); + + } \ No newline at end of file diff --git a/demo/odaslive/objects.h b/demo/odaslive/objects.h new file mode 100644 index 0000000..dbb3abf --- /dev/null +++ b/demo/odaslive/objects.h @@ -0,0 +1,130 @@ +#ifndef __DEMO_OBJECTS +#define __DEMO_OBJECTS + + #include "configs.h" + + #include + #include + #include + + typedef struct objects { + + src_hops_obj * src_hops_mics_object; + con_hops_obj * con_hops_mics_raw_object; + + mod_mapping_obj * mod_mapping_mics_object; + con_hops_obj * con_hops_mics_map_object; + + mod_resample_obj * mod_resample_mics_object; + con_hops_obj * con_hops_mics_rs_object; + + mod_stft_obj * mod_stft_mics_object; + con_spectra_obj * con_spectra_mics_object; + + mod_noise_obj * mod_noise_mics_object; + con_powers_obj * con_powers_mics_object; + + mod_ssl_obj * mod_ssl_object; + snk_pots_obj * snk_pots_ssl_object; + con_pots_obj * con_pots_ssl_object; + + inj_targets_obj * inj_targets_sst_object; + con_targets_obj * con_targets_sst_object; + + mod_sst_obj * mod_sst_object; + snk_tracks_obj * snk_tracks_sst_object; + con_tracks_obj * con_tracks_sst_object; + + mod_sss_obj * mod_sss_object; + con_spectra_obj * con_spectra_seps_object; + con_spectra_obj * con_spectra_pfs_object; + + mod_istft_obj * mod_istft_seps_object; + mod_istft_obj * mod_istft_pfs_object; + con_hops_obj * con_hops_seps_object; + con_hops_obj * con_hops_pfs_object; + + mod_resample_obj * mod_resample_seps_object; + mod_resample_obj * mod_resample_pfs_object; + con_hops_obj * con_hops_seps_rs_object; + con_hops_obj * con_hops_pfs_rs_object; + + mod_volume_obj * mod_volume_seps_object; + mod_volume_obj * mod_volume_pfs_object; + con_hops_obj * con_hops_seps_vol_object; + con_hops_obj * con_hops_pfs_vol_object; + snk_hops_obj * snk_hops_seps_vol_object; + snk_hops_obj * snk_hops_pfs_vol_object; + + mod_classify_obj * mod_classify_object; + con_categories_obj * con_categories_object; + snk_categories_obj * snk_categories_object; + + } objects; + + typedef struct aobjects { + + unsigned int nMessages; + + asrc_hops_obj * asrc_hops_mics_object; + acon_hops_obj * acon_hops_mics_raw_object; + + amod_mapping_obj * amod_mapping_mics_object; + acon_hops_obj * acon_hops_mics_map_object; + + amod_resample_obj * amod_resample_mics_object; + acon_hops_obj * acon_hops_mics_rs_object; + + amod_stft_obj * amod_stft_mics_object; + acon_spectra_obj * acon_spectra_mics_object; + + amod_noise_obj * amod_noise_mics_object; + acon_powers_obj * acon_powers_mics_object; + + amod_ssl_obj * amod_ssl_object; + asnk_pots_obj * asnk_pots_ssl_object; + acon_pots_obj * acon_pots_ssl_object; + + ainj_targets_obj * ainj_targets_sst_object; + acon_targets_obj * acon_targets_sst_object; + + amod_sst_obj * amod_sst_object; + asnk_tracks_obj * asnk_tracks_sst_object; + acon_tracks_obj * acon_tracks_sst_object; + + amod_sss_obj * amod_sss_object; + acon_spectra_obj * acon_spectra_seps_object; + acon_spectra_obj * acon_spectra_pfs_object; + + amod_istft_obj * amod_istft_seps_object; + amod_istft_obj * amod_istft_pfs_object; + acon_hops_obj * acon_hops_seps_object; + acon_hops_obj * acon_hops_pfs_object; + + amod_resample_obj * amod_resample_seps_object; + amod_resample_obj * amod_resample_pfs_object; + acon_hops_obj * acon_hops_seps_rs_object; + acon_hops_obj * acon_hops_pfs_rs_object; + + amod_volume_obj * amod_volume_seps_object; + amod_volume_obj * amod_volume_pfs_object; + acon_hops_obj * acon_hops_seps_vol_object; + acon_hops_obj * acon_hops_pfs_vol_object; + asnk_hops_obj * asnk_hops_seps_vol_object; + asnk_hops_obj * asnk_hops_pfs_vol_object; + + amod_classify_obj * amod_classify_object; + acon_categories_obj * acon_categories_object; + asnk_categories_obj * asnk_categories_object; + + } aobjects; + + objects * objects_construct(const configs * cfgs); + + void objects_destroy(objects * objs); + + aobjects * aobjects_construct(const configs * cfgs); + + void aobjects_destroy(aobjects * objs); + +#endif \ No newline at end of file diff --git a/demo/odaslive/parameters.c b/demo/odaslive/parameters.c new file mode 100644 index 0000000..eb0777a --- /dev/null +++ b/demo/odaslive/parameters.c @@ -0,0 +1,2076 @@ + + #include "parameters.h" + + int parameters_lookup_int(const char * file, const char * path) { + + config_t cfg; + config_setting_t * setting; + int rtnValue; + + config_init(&cfg); + + if(!config_read_file(&cfg, file)) + { + + printf("%s:%d - %s\n", config_error_file(&cfg), config_error_line(&cfg), config_error_text(&cfg)); + config_destroy(&cfg); + + exit(EXIT_FAILURE); + + } + + if ((setting = config_lookup(&cfg, path)) == NULL) { + + printf("Cannot find path \"%s\" in config file \"%s\"\n",path,file); + + exit(EXIT_FAILURE); + + } + + rtnValue = config_setting_get_int(setting); + + config_destroy(&cfg); + + return rtnValue; + + } + + float parameters_lookup_float(const char * file, const char * path) { + + config_t cfg; + config_setting_t * setting; + float rtnValue; + + config_init(&cfg); + + if(!config_read_file(&cfg, file)) + { + + printf("%s:%d - %s\n", config_error_file(&cfg), config_error_line(&cfg), config_error_text(&cfg)); + config_destroy(&cfg); + + exit(EXIT_FAILURE); + + } + + if ((setting = config_lookup(&cfg, path)) == NULL) { + + printf("Cannot find path \"%s\" in config file \"%s\"\n",path,file); + + exit(EXIT_FAILURE); + + } + + rtnValue = (float) config_setting_get_float(setting); + + config_destroy(&cfg); + + return rtnValue; + + } + + char * parameters_lookup_string(const char * file, const char * path) { + + config_t cfg; + config_setting_t * setting; + const char * tmpStr; + char * rtnStr; + + config_init(&cfg); + + if(!config_read_file(&cfg, file)) + { + + printf("%s:%d - %s\n", config_error_file(&cfg), config_error_line(&cfg), config_error_text(&cfg)); + config_destroy(&cfg); + + exit(EXIT_FAILURE); + + } + + if ((setting = config_lookup(&cfg, path)) == NULL) { + + printf("Cannot find path \"%s\" in config file \"%s\"\n",path,file); + + exit(EXIT_FAILURE); + + } + + tmpStr = config_setting_get_string(setting); + + rtnStr = (char *) malloc(sizeof(char) * (strlen(tmpStr)+1)); + strcpy(rtnStr, tmpStr); + + config_destroy(&cfg); + + return rtnStr; + + } + + unsigned int parameters_count(const char * file, const char * path) { + + config_t cfg; + config_setting_t * setting; + unsigned int rtnValue; + + config_init(&cfg); + + if(!config_read_file(&cfg, file)) + { + + printf("%s:%d - %s\n", config_error_file(&cfg), config_error_line(&cfg), config_error_text(&cfg)); + config_destroy(&cfg); + + exit(EXIT_FAILURE); + + } + + if ((setting = config_lookup(&cfg, path)) == NULL) { + + printf("Cannot find path \"%s\" in config file \"%s\"\n",path,file); + + exit(EXIT_FAILURE); + + } + + rtnValue = config_setting_length(setting); + + config_destroy(&cfg); + + return rtnValue; + + } + + src_hops_cfg * parameters_src_hops_mics_config(const char * fileConfig) { + + src_hops_cfg * cfg; + char * tmpStr1; + char * tmpStr2; + unsigned int tmpInt1; + unsigned int tmpInt2; + + cfg = src_hops_cfg_construct(); + + // +----------------------------------------------------------+ + // | Format | + // +----------------------------------------------------------+ + + tmpInt1 = parameters_lookup_int(fileConfig, "raw.nBits"); + + if ((tmpInt1 == 8) || (tmpInt1 == 16) || (tmpInt1 == 24) || (tmpInt1 == 32)) { + cfg->format = format_construct_binary_int(tmpInt1); + } + else { + printf("raw.nBits: Invalid number of bits\n"); + exit(EXIT_FAILURE); + } + + // +----------------------------------------------------------+ + // | Interface | + // +----------------------------------------------------------+ + + tmpStr1 = parameters_lookup_string(fileConfig, "raw.interface.type"); + + if (strcmp(tmpStr1, "file") == 0) { + + tmpStr2 = parameters_lookup_string(fileConfig, "raw.interface.path"); + + cfg->interface = interface_construct_file(tmpStr2); + + free((void *) tmpStr2); + + } + else if (strcmp(tmpStr1, "socket") == 0) { + + tmpStr2 = parameters_lookup_string(fileConfig, "raw.interface.ip"); + tmpInt1 = parameters_lookup_int(fileConfig, "raw.interface.port"); + + cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); + + free((void *) tmpStr2); + + } + else if (strcmp(tmpStr1, "soundcard") == 0) { + + tmpInt1 = parameters_lookup_int(fileConfig, "raw.interface.card"); + tmpInt2 = parameters_lookup_int(fileConfig, "raw.interface.device"); + + cfg->interface = interface_construct_soundcard(tmpInt1, tmpInt2); + + } + else if (strcmp(tmpStr1, "soundcard_name") == 0) { + + tmpStr2 = parameters_lookup_string(fileConfig, "raw.interface.devicename"); + + cfg->interface = interface_construct_soundcard_by_name(tmpStr2); + + } + else { + printf("raw.interface.type: Invalid type\n"); + exit(EXIT_FAILURE); + } + + free((void *) tmpStr1); + + return cfg; + + } + + msg_hops_cfg * parameters_msg_hops_mics_raw_config(const char * fileConfig) { + + msg_hops_cfg * cfg; + + cfg = msg_hops_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "raw.fS"); + + // +----------------------------------------------------------+ + // | Hop size | + // +----------------------------------------------------------+ + + cfg->hopSize = parameters_lookup_int(fileConfig, "raw.hopSize"); + + // +----------------------------------------------------------+ + // | Number of channels | + // +----------------------------------------------------------+ + + cfg->nChannels = parameters_lookup_int(fileConfig, "raw.nChannels"); + + return cfg; + + } + + + mod_mapping_cfg * parameters_mod_mapping_mics_config(const char * fileConfig) { + + mod_mapping_cfg * cfg; + unsigned int nLinks; + unsigned int iLink; + char * tmpStr1; + + cfg = mod_mapping_cfg_construct(); + + // +----------------------------------------------------------+ + // | Links | + // +----------------------------------------------------------+ + + nLinks = parameters_count(fileConfig, "mapping.map"); + cfg->links = links_construct_zero(nLinks); + + for (iLink = 0; iLink < nLinks; iLink++) { + + tmpStr1 = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpStr1, "mapping.map.[%u]", iLink); + cfg->links->array[iLink] = parameters_lookup_int(fileConfig, tmpStr1); + free((void *) tmpStr1); + + } + + return cfg; + + } + + msg_hops_cfg * parameters_msg_hops_mics_map_config(const char * fileConfig) { + + msg_hops_cfg * cfg; + + cfg = msg_hops_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "raw.fS"); + + // +----------------------------------------------------------+ + // | Hop size | + // +----------------------------------------------------------+ + + cfg->hopSize = parameters_lookup_int(fileConfig, "raw.hopSize"); + + // +----------------------------------------------------------+ + // | Number of channels | + // +----------------------------------------------------------+ + + cfg->nChannels = parameters_count(fileConfig, "mapping.map"); + + return cfg; + + } + + mod_resample_cfg * parameters_mod_resample_mics_config(const char * fileConfig) { + + mod_resample_cfg * cfg; + + unsigned int tmpInt1; + unsigned int tmpInt2; + + cfg = mod_resample_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rates | + // +----------------------------------------------------------+ + + tmpInt1 = parameters_lookup_int(fileConfig, "raw.fS"); + tmpInt2 = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + + if (tmpInt1 < tmpInt2) { + printf("general.samplerate.mu: This sample rate must be smaller or equal to raw.fS"); + exit(EXIT_FAILURE); + } + + cfg->fSin = tmpInt1; + cfg->fSout = tmpInt2; + + return cfg; + + } + + msg_hops_cfg * parameters_msg_hops_mics_rs_config(const char * fileConfig) { + + msg_hops_cfg * cfg; + + cfg = msg_hops_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + + // +----------------------------------------------------------+ + // | Hop size | + // +----------------------------------------------------------+ + + cfg->hopSize = parameters_lookup_int(fileConfig, "general.size.hopSize"); + + // +----------------------------------------------------------+ + // | Number of channels | + // +----------------------------------------------------------+ + + cfg->nChannels = parameters_count(fileConfig, "mapping.map"); + + return cfg; + + } + + mod_stft_cfg * parameters_mod_stft_mics_config(const char * fileConfig) { + + mod_stft_cfg * cfg; + + cfg = mod_stft_cfg_construct(); + + return cfg; + + } + + msg_spectra_cfg * parameters_msg_spectra_mics_config(const char * fileConfig) { + + msg_spectra_cfg * cfg; + + unsigned int halfFrameSize; + unsigned int nChannels; + unsigned int fS; + + cfg = msg_spectra_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + + // +----------------------------------------------------------+ + // | Hop size | + // +----------------------------------------------------------+ + + cfg->halfFrameSize = parameters_lookup_int(fileConfig, "general.size.frameSize") / 2 + 1; + + // +----------------------------------------------------------+ + // | Number of channels | + // +----------------------------------------------------------+ + + cfg->nChannels = parameters_count(fileConfig, "mapping.map"); + + return cfg; + + } + + mod_noise_cfg * parameters_mod_noise_mics_config(const char * fileConfig) { + + mod_noise_cfg * cfg; + + cfg = mod_noise_cfg_construct(); + + // +----------------------------------------------------------+ + // | Hanning window size | + // +----------------------------------------------------------+ + + cfg->bSize = parameters_lookup_int(fileConfig, "sne.b"); + + // +----------------------------------------------------------+ + // | alphaS | + // +----------------------------------------------------------+ + + cfg->alphaS = parameters_lookup_float(fileConfig, "sne.alphaS"); + + // +----------------------------------------------------------+ + // | Number of frames | + // +----------------------------------------------------------+ + + cfg->L = parameters_lookup_int(fileConfig, "sne.L"); + + // +----------------------------------------------------------+ + // | delta | + // +----------------------------------------------------------+ + + cfg->delta = parameters_lookup_float(fileConfig, "sne.delta"); + + // +----------------------------------------------------------+ + // | alphaD | + // +----------------------------------------------------------+ + + cfg->alphaD = parameters_lookup_float(fileConfig, "sne.alphaD"); + + return cfg; + + } + + msg_powers_cfg * parameters_msg_powers_mics_config(const char * fileConfig) { + + msg_powers_cfg * cfg; + + unsigned int halfFrameSize; + unsigned int nChannels; + unsigned int fS; + + cfg = msg_powers_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + + // +----------------------------------------------------------+ + // | Hop size | + // +----------------------------------------------------------+ + + cfg->halfFrameSize = parameters_lookup_int(fileConfig, "general.size.frameSize") / 2 + 1; + + // +----------------------------------------------------------+ + // | Number of channels | + // +----------------------------------------------------------+ + + cfg->nChannels = parameters_count(fileConfig, "mapping.map"); + + return cfg; + + } + + mod_ssl_cfg * parameters_mod_ssl_config(const char * fileConfig) { + + mod_ssl_cfg * cfg; + + unsigned int nChannels; + unsigned int nFilters; + unsigned int iChannel; + unsigned int iFilter; + unsigned int iSample; + unsigned int iLevel; + + char * tmpLabel; + char * tmpString; + + cfg = mod_ssl_cfg_construct(); + + // +----------------------------------------------------------+ + // | Number of channels | + // +----------------------------------------------------------+ + + nChannels = parameters_count(fileConfig, "general.mics"); + + cfg->mics = mics_construct_zero(nChannels); + + for (iChannel = 0; iChannel < nChannels; iChannel++) { + + // +--------------------------------------------------+ + // | Mu | + // +--------------------------------------------------+ + + for (iSample = 0; iSample < 3; iSample++) { + + tmpLabel = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpLabel, "general.mics.[%u].mu.[%u]", iChannel, iSample); + cfg->mics->mu[iChannel * 3 + iSample] = parameters_lookup_float(fileConfig, tmpLabel); + free((void *) tmpLabel); + + } + + // +--------------------------------------------------+ + // | Sigma2 | + // +--------------------------------------------------+ + + for (iSample = 0; iSample < 9; iSample++) { + + tmpLabel = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpLabel, "general.mics.[%u].sigma2.[%u]", iChannel, iSample); + cfg->mics->sigma2[iChannel * 9 + iSample] = parameters_lookup_float(fileConfig, tmpLabel); + free((void *) tmpLabel); + + } + + // +--------------------------------------------------+ + // | Direction | + // +--------------------------------------------------+ + + for (iSample = 0; iSample < 3; iSample++) { + + tmpLabel = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpLabel, "general.mics.[%u].direction.[%u]", iChannel, iSample); + cfg->mics->direction[iChannel * 3 + iSample] = parameters_lookup_float(fileConfig, tmpLabel); + free((void *) tmpLabel); + + } + + // +--------------------------------------------------+ + // | Angle | + // +--------------------------------------------------+ + + tmpLabel = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpLabel, "general.mics.[%u].angle.[%u]", iChannel, 0); + cfg->mics->thetaAllPass[iChannel] = parameters_lookup_float(fileConfig, tmpLabel); + free((void *) tmpLabel); + + tmpLabel = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpLabel, "general.mics.[%u].angle.[%u]", iChannel, 1); + cfg->mics->thetaNoPass[iChannel] = parameters_lookup_float(fileConfig, tmpLabel); + free((void *) tmpLabel); + + } + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->samplerate = samplerate_construct_zero(); + + cfg->samplerate->mu = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + cfg->samplerate->sigma2 = parameters_lookup_float(fileConfig, "general.samplerate.sigma2"); + + // +----------------------------------------------------------+ + // | Sound speed | + // +----------------------------------------------------------+ + + cfg->soundspeed = soundspeed_construct_zero(); + + cfg->soundspeed->mu = parameters_lookup_float(fileConfig, "general.speedofsound.mu"); + cfg->soundspeed->sigma2 = parameters_lookup_float(fileConfig, "general.speedofsound.sigma2"); + + // +----------------------------------------------------------+ + // | Interpolation | + // +----------------------------------------------------------+ + + cfg->interpRate = parameters_lookup_int(fileConfig, "ssl.interpRate"); + + // +----------------------------------------------------------+ + // | Epsilon | + // +----------------------------------------------------------+ + + cfg->epsilon = parameters_lookup_float(fileConfig, "general.epsilon"); + + // +----------------------------------------------------------+ + // | Levels | + // +----------------------------------------------------------+ + + cfg->nLevels = parameters_count(fileConfig, "ssl.scans"); + + cfg->levels = (unsigned int *) malloc(sizeof(unsigned int) * cfg->nLevels); + cfg->deltas = (signed int *) malloc(sizeof(signed int) * cfg->nLevels); + + for (iLevel = 0; iLevel < cfg->nLevels; iLevel++) { + + tmpLabel = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpLabel, "ssl.scans.[%u].level", iLevel); + cfg->levels[iLevel] = parameters_lookup_int(fileConfig, tmpLabel); + free((void *) tmpLabel); + + tmpLabel = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpLabel, "ssl.scans.[%u].delta", iLevel); + cfg->deltas[iLevel] = parameters_lookup_int(fileConfig, tmpLabel); + free((void *) tmpLabel); + + } + + // +----------------------------------------------------------+ + // | Matches | + // +----------------------------------------------------------+ + + cfg->nMatches = parameters_lookup_int(fileConfig, "ssl.nMatches"); + + // +----------------------------------------------------------+ + // | Minimum probability | + // +----------------------------------------------------------+ + + cfg->probMin = parameters_lookup_float(fileConfig, "ssl.probMin"); + + // +----------------------------------------------------------+ + // | Number of refined levels | + // +----------------------------------------------------------+ + + cfg->nRefinedLevels = parameters_lookup_int(fileConfig, "ssl.nRefinedLevels"); + + // +----------------------------------------------------------+ + // | Number of thetas | + // +----------------------------------------------------------+ + + cfg->nThetas = parameters_lookup_int(fileConfig, "general.nThetas"); + + // +----------------------------------------------------------+ + // | Number of thetas | + // +----------------------------------------------------------+ + + cfg->gainMin = parameters_lookup_float(fileConfig, "general.gainMin"); + + // +----------------------------------------------------------+ + // | Spatial filter | + // +----------------------------------------------------------+ + + nFilters = parameters_count(fileConfig, "general.spatialfilters"); + + cfg->spatialfilters = spatialfilters_construct_zero(nFilters); + + for (iFilter = 0; iFilter < nFilters; iFilter++) { + + // +--------------------------------------------------+ + // | Direction | + // +--------------------------------------------------+ + + for (iSample = 0; iSample < 3; iSample++) { + + tmpLabel = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpLabel, "general.spatialfilters.[%u].direction.[%u]", iFilter, iSample); + cfg->spatialfilters->direction[iFilter * 3 + iSample] = parameters_lookup_float(fileConfig, tmpLabel); + free((void *) tmpLabel); + + } + + // +--------------------------------------------------+ + // | thetaAllPass | + // +--------------------------------------------------+ + + tmpLabel = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpLabel, "general.spatialfilters.[%u].angle.[0]", iFilter); + cfg->spatialfilters->thetaAllPass[iFilter] = parameters_lookup_float(fileConfig, tmpLabel); + free((void *) tmpLabel); + + // +--------------------------------------------------+ + // | thetaNoPass | + // +--------------------------------------------------+ + + tmpLabel = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpLabel, "general.spatialfilters.[%u].angle.[1]", iFilter); + cfg->spatialfilters->thetaNoPass[iFilter] = parameters_lookup_float(fileConfig, tmpLabel); + free((void *) tmpLabel); + + } + + return cfg; + + } + + msg_pots_cfg * parameters_msg_pots_ssl_config(const char * fileConfig) { + + msg_pots_cfg * cfg; + + cfg = msg_pots_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + + // +----------------------------------------------------------+ + // | Number of potential sources | + // +----------------------------------------------------------+ + + cfg->nPots = parameters_lookup_int(fileConfig, "ssl.nPots"); + + return cfg; + + } + + snk_pots_cfg * parameters_snk_pots_ssl_config(const char * fileConfig) { + + snk_pots_cfg * cfg; + char * tmpStr1; + char * tmpStr2; + char * tmpLabel; + unsigned int tmpInt1; + unsigned int tmpInt2; + + cfg = snk_pots_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + + // +----------------------------------------------------------+ + // | Format | + // +----------------------------------------------------------+ + + tmpStr1 = parameters_lookup_string(fileConfig, "ssl.potential.format"); + + if (strcmp(tmpStr1, "json") == 0) { cfg->format = format_construct_text_json(); } + else if (strcmp(tmpStr1, "binary") == 0) { cfg->format = format_construct_binary_float(); } + else if (strcmp(tmpStr1, "undefined") == 0) { cfg->format = format_construct_undefined(); } + else { printf("ssl.potential.format: Invalid format\n"); exit(EXIT_FAILURE); } + + free((void *) tmpStr1); + + // +----------------------------------------------------------+ + // | Interface | + // +----------------------------------------------------------+ + + tmpStr1 = parameters_lookup_string(fileConfig, "ssl.potential.interface.type"); + + if (strcmp(tmpStr1, "blackhole") == 0) { + + cfg->interface = interface_construct_blackhole(); + + } + else if (strcmp(tmpStr1, "file") == 0) { + + tmpStr2 = parameters_lookup_string(fileConfig, "ssl.potential.interface.path"); + cfg->interface = interface_construct_file(tmpStr2); + free((void *) tmpStr2); + + } + else if (strcmp(tmpStr1, "socket") == 0) { + + tmpStr2 = parameters_lookup_string(fileConfig, "ssl.potential.interface.ip"); + tmpInt1 = parameters_lookup_int(fileConfig, "ssl.potential.interface.port"); + + cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); + free((void *) tmpStr2); + + } + else if (strcmp(tmpStr1, "terminal") == 0) { + + cfg->interface = interface_construct_terminal(); + + } + else { + + printf("ssl.potential.interface.type: Invalid type\n"); + exit(EXIT_FAILURE); + + } + + free((void *) tmpStr1); + + return cfg; + + } + + inj_targets_cfg * parameters_inj_targets_sst_config(const char * fileConfig) { + + inj_targets_cfg * cfg; + unsigned int iTarget; + unsigned int nTargets; + float x, y, z; + char * tmpStr1; + char * tmpStr2; + + cfg = inj_targets_cfg_construct(); + + // +----------------------------------------------------------+ + // | Number of targets | + // +----------------------------------------------------------+ + + nTargets = parameters_count(fileConfig, "sst.target"); + + cfg->nTargets = nTargets; + + // +----------------------------------------------------------+ + // | Targets | + // +----------------------------------------------------------+ + + cfg->targets = targets_construct_zero(nTargets); + + for (iTarget = 0; iTarget < nTargets; iTarget++) { + + tmpStr1 = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpStr1, "sst.target.[%u].tag",iTarget); + tmpStr2 = parameters_lookup_string(fileConfig, tmpStr1); + free((void *) tmpStr1); + + tmpStr1 = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpStr1, "sst.target.[%u].x",iTarget); + x = parameters_lookup_float(fileConfig, tmpStr1); + free((void *) tmpStr1); + + tmpStr1 = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpStr1, "sst.target.[%u].y",iTarget); + y = parameters_lookup_float(fileConfig, tmpStr1); + free((void *) tmpStr1); + + tmpStr1 = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpStr1, "sst.target.[%u].z",iTarget); + z = parameters_lookup_float(fileConfig, tmpStr1); + free((void *) tmpStr1); + + strcpy(cfg->targets->tags[iTarget],tmpStr2); + cfg->targets->array[iTarget *3 + 0] = x; + cfg->targets->array[iTarget *3 + 1] = y; + cfg->targets->array[iTarget *3 + 2] = z; + + free((void *) tmpStr2); + + } + + return cfg; + + } + + msg_targets_cfg * parameters_msg_targets_sst_config(const char * fileConfig) { + + msg_targets_cfg * cfg; + unsigned int nTargets; + + cfg = msg_targets_cfg_construct(); + + // +----------------------------------------------------------+ + // | Number of targets | + // +----------------------------------------------------------+ + + nTargets = parameters_count(fileConfig, "sst.target"); + + cfg->nTargets = nTargets; + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + + return cfg; + + } + + mod_sst_cfg * parameters_mod_sst_config(const char * fileConfig) { + + mod_sst_cfg * cfg; + + unsigned int nGaussians; + unsigned int iGaussian; + float weight; + float mu; + float sigma; + + unsigned int iTrack; + char * tmpStr1; + + cfg = mod_sst_cfg_construct(); + + // +----------------------------------------------------------+ + // | Mode | + // +----------------------------------------------------------+ + + tmpStr1 = parameters_lookup_string(fileConfig, "sst.mode"); + + if (strcmp(tmpStr1, "kalman") == 0) { + cfg->mode = 'k'; + } + else if (strcmp(tmpStr1, "particle") == 0) { + cfg->mode = 'p'; + } + else { + printf("sst.mode: Invalid filter type.\n"); + exit(EXIT_FAILURE); + } + + free((void *) tmpStr1); + + // +----------------------------------------------------------+ + // | Add | + // +----------------------------------------------------------+ + + tmpStr1 = parameters_lookup_string(fileConfig, "sst.add"); + + if (strcmp(tmpStr1, "dynamic") == 0) { + cfg->add = 'd'; + } + else if (strcmp(tmpStr1, "static") == 0) { + cfg->add = 's'; + } + else { + printf("sst.add: Invalid add type.\n"); + exit(EXIT_FAILURE); + } + + free((void *) tmpStr1); + + // +----------------------------------------------------------+ + // | nTracksMax | + // +----------------------------------------------------------+ + + cfg->nTracksMax = parameters_count(fileConfig, "sst.N_inactive"); + + // +----------------------------------------------------------+ + // | hopSize | + // +----------------------------------------------------------+ + + cfg->hopSize = parameters_lookup_int(fileConfig, "general.size.hopSize"); + + // +----------------------------------------------------------+ + // | Kalman | + // +----------------------------------------------------------+ + + cfg->sigmaQ = parameters_lookup_float(fileConfig, "sst.kalman.sigmaQ"); + + // +----------------------------------------------------------+ + // | Particles | + // +----------------------------------------------------------+ + + cfg->nParticles = parameters_lookup_int(fileConfig, "sst.particle.nParticles"); + cfg->st_alpha = parameters_lookup_float(fileConfig, "sst.particle.st_alpha"); + cfg->st_beta = parameters_lookup_float(fileConfig, "sst.particle.st_beta"); + cfg->st_ratio = parameters_lookup_float(fileConfig, "sst.particle.st_ratio"); + cfg->ve_alpha = parameters_lookup_float(fileConfig, "sst.particle.ve_alpha"); + cfg->ve_beta = parameters_lookup_float(fileConfig, "sst.particle.ve_beta"); + cfg->ve_ratio = parameters_lookup_float(fileConfig, "sst.particle.ve_ratio"); + cfg->ac_alpha = parameters_lookup_float(fileConfig, "sst.particle.ac_alpha"); + cfg->ac_beta = parameters_lookup_float(fileConfig, "sst.particle.ac_beta"); + cfg->ac_ratio = parameters_lookup_float(fileConfig, "sst.particle.ac_ratio"); + cfg->Nmin = parameters_lookup_float(fileConfig, "sst.particle.Nmin"); + + // +----------------------------------------------------------+ + // | Epsilon | + // +----------------------------------------------------------+ + + cfg->epsilon = parameters_lookup_float(fileConfig, "general.epsilon"); + + // +----------------------------------------------------------+ + // | SigmaR | + // +----------------------------------------------------------+ + + cfg->sigmaR_active = sqrtf(parameters_lookup_float(fileConfig, "sst.sigmaR2_active")); + cfg->sigmaR_prob = sqrtf(parameters_lookup_float(fileConfig, "sst.sigmaR2_prob")); + cfg->sigmaR_target = sqrtf(parameters_lookup_float(fileConfig, "sst.sigmaR2_target")); + + // +----------------------------------------------------------+ + // | GMM Active | + // +----------------------------------------------------------+ + + nGaussians = parameters_count(fileConfig, "sst.active"); + + cfg->active_gmm = gaussians_1d_construct_null(nGaussians); + + for (iGaussian = 0; iGaussian < nGaussians; iGaussian++) { + + tmpStr1 = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpStr1, "sst.active.[%u].weight",iGaussian); + weight = parameters_lookup_float(fileConfig, tmpStr1); + free((void *) tmpStr1); + + tmpStr1 = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpStr1, "sst.active.[%u].mu",iGaussian); + mu = parameters_lookup_float(fileConfig, tmpStr1); + free((void *) tmpStr1); + + tmpStr1 = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpStr1, "sst.active.[%u].sigma2",iGaussian); + sigma = sqrtf(parameters_lookup_float(fileConfig, tmpStr1)); + free((void *) tmpStr1); + + cfg->active_gmm->array[iGaussian] = gaussian_1d_construct_weightmusigma(weight, mu, sigma); + } + + // +----------------------------------------------------------+ + // | GMM Inactive | + // +----------------------------------------------------------+ + + nGaussians = parameters_count(fileConfig, "sst.inactive"); + + cfg->inactive_gmm = gaussians_1d_construct_null(nGaussians); + + for (iGaussian = 0; iGaussian < nGaussians; iGaussian++) { + + tmpStr1 = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpStr1, "sst.inactive.[%u].weight",iGaussian); + weight = parameters_lookup_float(fileConfig, tmpStr1); + free((void *) tmpStr1); + + tmpStr1 = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpStr1, "sst.inactive.[%u].mu",iGaussian); + mu = parameters_lookup_float(fileConfig, tmpStr1); + free((void *) tmpStr1); + + tmpStr1 = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpStr1, "sst.inactive.[%u].sigma2",iGaussian); + sigma = sqrtf(parameters_lookup_float(fileConfig, tmpStr1)); + free((void *) tmpStr1); + + cfg->inactive_gmm->array[iGaussian] = gaussian_1d_construct_weightmusigma(weight, mu, sigma); + } + + // +----------------------------------------------------------+ + // | Pfalse, Pnew and Ptrack | + // +----------------------------------------------------------+ + + cfg->Pfalse = parameters_lookup_float(fileConfig, "sst.Pfalse"); + cfg->Pnew = parameters_lookup_float(fileConfig, "sst.Pnew"); + cfg->Ptrack = parameters_lookup_float(fileConfig, "sst.Ptrack"); + + // +----------------------------------------------------------+ + // | New | + // +----------------------------------------------------------+ + + cfg->theta_new = parameters_lookup_float(fileConfig, "sst.theta_new"); + + // +----------------------------------------------------------+ + // | Prob | + // +----------------------------------------------------------+ + + cfg->theta_prob = parameters_lookup_float(fileConfig, "sst.theta_prob"); + cfg->N_prob = parameters_lookup_int(fileConfig, "sst.N_prob"); + + // +----------------------------------------------------------+ + // | Inactive | + // +----------------------------------------------------------+ + + cfg->theta_inactive = parameters_lookup_float(fileConfig, "sst.theta_inactive"); + cfg->N_inactive = (unsigned int *) malloc(sizeof(unsigned int) * cfg->nTracksMax); + + for (iTrack = 0; iTrack < cfg->nTracksMax; iTrack++) { + + tmpStr1 = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpStr1, "sst.N_inactive.[%u]", iTrack); + cfg->N_inactive[iTrack] = parameters_lookup_int(fileConfig, tmpStr1); + free((void *) tmpStr1); + + } + + return cfg; + + } + + msg_tracks_cfg * parameters_msg_tracks_sst_config(const char * fileConfig) { + + msg_tracks_cfg * cfg; + + cfg = msg_tracks_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + + // +----------------------------------------------------------+ + // | Number of tracked sources | + // +----------------------------------------------------------+ + + cfg->nTracks = parameters_count(fileConfig, "sst.N_inactive"); + + return cfg; + + } + + snk_tracks_cfg * parameters_snk_tracks_sst_config(const char * fileConfig) { + + snk_tracks_cfg * cfg; + char * tmpStr1; + char * tmpStr2; + char * tmpLabel; + unsigned int tmpInt1; + unsigned int tmpInt2; + + cfg = snk_tracks_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + + // +----------------------------------------------------------+ + // | Format | + // +----------------------------------------------------------+ + + tmpStr1 = parameters_lookup_string(fileConfig, "sst.tracked.format"); + + if (strcmp(tmpStr1, "json") == 0) { cfg->format = format_construct_text_json(); } + else if (strcmp(tmpStr1, "binary") == 0) { cfg->format = format_construct_binary_float(); } + else if (strcmp(tmpStr1, "undefined") == 0) { cfg->format = format_construct_undefined(); } + else { printf("sst.tracked.format: Invalid format\n"); exit(EXIT_FAILURE); } + + free((void *) tmpStr1); + + // +----------------------------------------------------------+ + // | Interface | + // +----------------------------------------------------------+ + + tmpStr1 = parameters_lookup_string(fileConfig, "sst.tracked.interface.type"); + + if (strcmp(tmpStr1, "blackhole") == 0) { + + cfg->interface = interface_construct_blackhole(); + + } + else if (strcmp(tmpStr1, "file") == 0) { + + tmpStr2 = parameters_lookup_string(fileConfig, "sst.tracked.interface.path"); + cfg->interface = interface_construct_file(tmpStr2); + free((void *) tmpStr2); + + } + else if (strcmp(tmpStr1, "socket") == 0) { + + tmpStr2 = parameters_lookup_string(fileConfig, "sst.tracked.interface.ip"); + tmpInt1 = parameters_lookup_int(fileConfig, "sst.tracked.interface.port"); + + cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); + free((void *) tmpStr2); + + } + else if (strcmp(tmpStr1, "terminal") == 0) { + + cfg->interface = interface_construct_terminal(); + + } + else { + + printf("sst.tracked.interface.type: Invalid type\n"); + exit(EXIT_FAILURE); + + } + + free((void *) tmpStr1); + + return cfg; + + + } + + mod_sss_cfg * parameters_mod_sss_config(const char * fileConfig) { + + mod_sss_cfg * cfg; + + unsigned int nChannels; + unsigned int iChannel; + unsigned int iSample; + + char * tmpStr1; + char * tmpLabel; + + cfg = mod_sss_cfg_construct(); + + // +----------------------------------------------------------+ + // | Mode | + // +----------------------------------------------------------+ + + tmpStr1 = parameters_lookup_string(fileConfig, "sss.mode_sep"); + + if (strcmp(tmpStr1, "dds") == 0) { + cfg->mode_sep = 'd'; + } + else if (strcmp(tmpStr1, "dgss") == 0) { + cfg->mode_sep = 'g'; + } + else if (strcmp(tmpStr1, "dmvdr") == 0) { + cfg->mode_sep = 'm'; + } + else { + printf("sss.mode_sep: Invalid separation method.\n"); + exit(EXIT_FAILURE); + } + + free((void *) tmpStr1); + + tmpStr1 = parameters_lookup_string(fileConfig, "sss.mode_pf"); + + if (strcmp(tmpStr1, "ms") == 0) { + cfg->mode_pf = 'm'; + } + else if (strcmp(tmpStr1, "ss") == 0) { + cfg->mode_pf = 's'; + } + else { + printf("sss.mode_pf: Invalid post-filtering method.\n"); + exit(EXIT_FAILURE); + } + + free((void *) tmpStr1); + + // +----------------------------------------------------------+ + // | Number of channels | + // +----------------------------------------------------------+ + + nChannels = parameters_count(fileConfig, "general.mics"); + + cfg->mics = mics_construct_zero(nChannels); + + for (iChannel = 0; iChannel < nChannels; iChannel++) { + + // +--------------------------------------------------+ + // | Mu | + // +--------------------------------------------------+ + + for (iSample = 0; iSample < 3; iSample++) { + + tmpLabel = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpLabel, "general.mics.[%u].mu.[%u]", iChannel, iSample); + cfg->mics->mu[iChannel * 3 + iSample] = parameters_lookup_float(fileConfig, tmpLabel); + free((void *) tmpLabel); + + } + + // +--------------------------------------------------+ + // | Sigma2 | + // +--------------------------------------------------+ + + for (iSample = 0; iSample < 9; iSample++) { + + tmpLabel = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpLabel, "general.mics.[%u].sigma2.[%u]", iChannel, iSample); + cfg->mics->sigma2[iChannel * 9 + iSample] = parameters_lookup_float(fileConfig, tmpLabel); + free((void *) tmpLabel); + + } + + // +--------------------------------------------------+ + // | Direction | + // +--------------------------------------------------+ + + for (iSample = 0; iSample < 3; iSample++) { + + tmpLabel = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpLabel, "general.mics.[%u].direction.[%u]", iChannel, iSample); + cfg->mics->direction[iChannel * 3 + iSample] = parameters_lookup_float(fileConfig, tmpLabel); + free((void *) tmpLabel); + + } + + // +--------------------------------------------------+ + // | Angle | + // +--------------------------------------------------+ + + tmpLabel = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpLabel, "general.mics.[%u].angle.[%u]", iChannel, 0); + cfg->mics->thetaAllPass[iChannel] = parameters_lookup_float(fileConfig, tmpLabel); + free((void *) tmpLabel); + + tmpLabel = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpLabel, "general.mics.[%u].angle.[%u]", iChannel, 1); + cfg->mics->thetaNoPass[iChannel] = parameters_lookup_float(fileConfig, tmpLabel); + free((void *) tmpLabel); + + } + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->samplerate = samplerate_construct_zero(); + + cfg->samplerate->mu = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + cfg->samplerate->sigma2 = parameters_lookup_float(fileConfig, "general.samplerate.sigma2"); + + // +----------------------------------------------------------+ + // | Sound speed | + // +----------------------------------------------------------+ + + cfg->soundspeed = soundspeed_construct_zero(); + + cfg->soundspeed->mu = parameters_lookup_float(fileConfig, "general.speedofsound.mu"); + cfg->soundspeed->sigma2 = parameters_lookup_float(fileConfig, "general.speedofsound.sigma2"); + + // +----------------------------------------------------------+ + // | Number of thetas | + // +----------------------------------------------------------+ + + cfg->nThetas = parameters_lookup_int(fileConfig, "general.nThetas"); + + // +----------------------------------------------------------+ + // | Number of thetas | + // +----------------------------------------------------------+ + + cfg->gainMin = parameters_lookup_float(fileConfig, "general.gainMin"); + + // +----------------------------------------------------------+ + // | Epsilon | + // +----------------------------------------------------------+ + + cfg->epsilon = parameters_lookup_float(fileConfig, "general.epsilon"); + + // +----------------------------------------------------------+ + // | Mu | + // +----------------------------------------------------------+ + + cfg->sep_gss_mu = parameters_lookup_float(fileConfig, "sss.dgss.mu"); + + // +----------------------------------------------------------+ + // | Lambda | + // +----------------------------------------------------------+ + + cfg->sep_gss_lambda = parameters_lookup_float(fileConfig, "sss.dgss.lambda"); + + // +----------------------------------------------------------+ + // | Hanning window size | + // +----------------------------------------------------------+ + + cfg->pf_ms_bSize = parameters_lookup_int(fileConfig, "sne.b"); + + // +----------------------------------------------------------+ + // | alphaS | + // +----------------------------------------------------------+ + + cfg->pf_ms_alphaS = parameters_lookup_float(fileConfig, "sne.alphaS"); + + // +----------------------------------------------------------+ + // | Number of frames | + // +----------------------------------------------------------+ + + cfg->pf_ms_L = parameters_lookup_int(fileConfig, "sne.L"); + + // +----------------------------------------------------------+ + // | delta | + // +----------------------------------------------------------+ + + cfg->pf_ms_delta = parameters_lookup_float(fileConfig, "sne.delta"); + + // +----------------------------------------------------------+ + // | alphaD | + // +----------------------------------------------------------+ + + cfg->pf_ms_alphaD = parameters_lookup_float(fileConfig, "sne.alphaD"); + + // +----------------------------------------------------------+ + // | eta | + // +----------------------------------------------------------+ + + cfg->pf_ms_eta = parameters_lookup_float(fileConfig, "sss.ms.eta"); + + // +----------------------------------------------------------+ + // | alphaZ | + // +----------------------------------------------------------+ + + cfg->pf_ms_alphaZ = parameters_lookup_float(fileConfig, "sss.ms.alphaZ"); + + // +----------------------------------------------------------+ + // | alphaPmin | + // +----------------------------------------------------------+ + + cfg->pf_ms_alphaPmin = parameters_lookup_float(fileConfig, "sss.ms.alphaPmin"); + + // +----------------------------------------------------------+ + // | thetaWin | + // +----------------------------------------------------------+ + + cfg->pf_ms_thetaWin = parameters_lookup_float(fileConfig, "sss.ms.thetaWin"); + + // +----------------------------------------------------------+ + // | alphaWin | + // +----------------------------------------------------------+ + + cfg->pf_ms_alphaWin = parameters_lookup_float(fileConfig, "sss.ms.alphaWin"); + + // +----------------------------------------------------------+ + // | maxAbsenceProb | + // +----------------------------------------------------------+ + + cfg->pf_ms_maxAbsenceProb = parameters_lookup_float(fileConfig, "sss.ms.maxAbsenceProb"); + + // +----------------------------------------------------------+ + // | Gmin | + // +----------------------------------------------------------+ + + cfg->pf_ms_Gmin = parameters_lookup_float(fileConfig, "sss.ms.Gmin"); + + // +----------------------------------------------------------+ + // | winSizeLocal | + // +----------------------------------------------------------+ + + cfg->pf_ms_winSizeLocal = parameters_lookup_int(fileConfig, "sss.ms.winSizeLocal"); + + // +----------------------------------------------------------+ + // | winSizeGlobal | + // +----------------------------------------------------------+ + + cfg->pf_ms_winSizeGlobal = parameters_lookup_int(fileConfig, "sss.ms.winSizeGlobal"); + + // +----------------------------------------------------------+ + // | winSizeFrame | + // +----------------------------------------------------------+ + + cfg->pf_ms_winSizeFrame = parameters_lookup_int(fileConfig, "sss.ms.winSizeFrame"); + + // +----------------------------------------------------------+ + // | Gmin | + // +----------------------------------------------------------+ + + cfg->pf_ss_Gmin = parameters_lookup_float(fileConfig, "sss.ss.Gmin"); + + // +----------------------------------------------------------+ + // | Gmid | + // +----------------------------------------------------------+ + + cfg->pf_ss_Gmid = parameters_lookup_float(fileConfig, "sss.ss.Gmid"); + + // +----------------------------------------------------------+ + // | Gslope | + // +----------------------------------------------------------+ + + cfg->pf_ss_Gslope = parameters_lookup_float(fileConfig, "sss.ss.Gslope"); + + return cfg; + + } + + msg_spectra_cfg * parameters_msg_spectra_seps_config(const char * fileConfig) { + + msg_spectra_cfg * cfg; + + unsigned int halfFrameSize; + unsigned int nChannels; + unsigned int fS; + + cfg = msg_spectra_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + + // +----------------------------------------------------------+ + // | Half frame size | + // +----------------------------------------------------------+ + + cfg->halfFrameSize = parameters_lookup_int(fileConfig, "general.size.frameSize") / 2 + 1; + + // +----------------------------------------------------------+ + // | Number of channels | + // +----------------------------------------------------------+ + + cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); + + return cfg; + + } + + msg_spectra_cfg * parameters_msg_spectra_pfs_config(const char * fileConfig) { + + msg_spectra_cfg * cfg; + + unsigned int halfFrameSize; + unsigned int nChannels; + unsigned int fS; + + cfg = msg_spectra_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + + // +----------------------------------------------------------+ + // | Half frame size | + // +----------------------------------------------------------+ + + cfg->halfFrameSize = parameters_lookup_int(fileConfig, "general.size.frameSize") / 2 + 1; + + // +----------------------------------------------------------+ + // | Number of channels | + // +----------------------------------------------------------+ + + cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); + + return cfg; + + } + + mod_istft_cfg * parameters_mod_istft_seps_config(const char * fileConfig) { + + mod_istft_cfg * cfg; + + cfg = mod_istft_cfg_construct(); + + return cfg; + + } + + mod_istft_cfg * parameters_mod_istft_pfs_config(const char * fileConfig) { + + mod_istft_cfg * cfg; + + cfg = mod_istft_cfg_construct(); + + return cfg; + + } + + msg_hops_cfg * parameters_msg_hops_seps_config(const char * fileConfig) { + + msg_hops_cfg * cfg; + + cfg = msg_hops_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + + // +----------------------------------------------------------+ + // | Hop size | + // +----------------------------------------------------------+ + + cfg->hopSize = parameters_lookup_int(fileConfig, "general.size.hopSize"); + + // +----------------------------------------------------------+ + // | Number of channels | + // +----------------------------------------------------------+ + + cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); + + return cfg; + + } + + msg_hops_cfg * parameters_msg_hops_pfs_config(const char * fileConfig) { + + msg_hops_cfg * cfg; + + cfg = msg_hops_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + + // +----------------------------------------------------------+ + // | Hop size | + // +----------------------------------------------------------+ + + cfg->hopSize = parameters_lookup_int(fileConfig, "general.size.hopSize"); + + // +----------------------------------------------------------+ + // | Number of channels | + // +----------------------------------------------------------+ + + cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); + + return cfg; + + } + + mod_resample_cfg * parameters_mod_resample_seps_config(const char * fileConfig) { + + mod_resample_cfg * cfg; + + unsigned int tmpInt1; + unsigned int tmpInt2; + + cfg = mod_resample_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rates | + // +----------------------------------------------------------+ + + tmpInt1 = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + tmpInt2 = parameters_lookup_int(fileConfig, "sss.separated.fS"); + + cfg->fSin = tmpInt1; + cfg->fSout = tmpInt2; + + return cfg; + + } + + mod_resample_cfg * parameters_mod_resample_pfs_config(const char * fileConfig) { + + mod_resample_cfg * cfg; + + unsigned int tmpInt1; + unsigned int tmpInt2; + + cfg = mod_resample_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rates | + // +----------------------------------------------------------+ + + tmpInt1 = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + tmpInt2 = parameters_lookup_int(fileConfig, "sss.postfiltered.fS"); + + cfg->fSin = tmpInt1; + cfg->fSout = tmpInt2; + + return cfg; + + } + + msg_hops_cfg * parameters_msg_hops_seps_rs_config(const char * fileConfig) { + + msg_hops_cfg * cfg; + + cfg = msg_hops_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "sss.separated.fS"); + + // +----------------------------------------------------------+ + // | Hop size | + // +----------------------------------------------------------+ + + cfg->hopSize = parameters_lookup_int(fileConfig, "sss.separated.hopSize"); + + // +----------------------------------------------------------+ + // | Number of channels | + // +----------------------------------------------------------+ + + cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); + + return cfg; + + } + + msg_hops_cfg * parameters_msg_hops_pfs_rs_config(const char * fileConfig) { + + msg_hops_cfg * cfg; + + cfg = msg_hops_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "sss.postfiltered.fS"); + + // +----------------------------------------------------------+ + // | Hop size | + // +----------------------------------------------------------+ + + cfg->hopSize = parameters_lookup_int(fileConfig, "sss.postfiltered.hopSize"); + + // +----------------------------------------------------------+ + // | Number of channels | + // +----------------------------------------------------------+ + + cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); + + return cfg; + + } + + mod_volume_cfg * parameters_mod_volume_seps_config(const char * fileConfig) { + + mod_volume_cfg * cfg; + + cfg = mod_volume_cfg_construct(); + + // +----------------------------------------------------------+ + // | Gain | + // +----------------------------------------------------------+ + + cfg->gain = parameters_lookup_float(fileConfig, "sss.gain_sep"); + + return cfg; + + } + + mod_volume_cfg * parameters_mod_volume_pfs_config(const char * fileConfig) { + + mod_volume_cfg * cfg; + + cfg = mod_volume_cfg_construct(); + + // +----------------------------------------------------------+ + // | Gain | + // +----------------------------------------------------------+ + + cfg->gain = parameters_lookup_float(fileConfig, "sss.gain_pf"); + + return cfg; + + } + + msg_hops_cfg * parameters_msg_hops_seps_vol_config(const char * fileConfig) { + + msg_hops_cfg * cfg; + + cfg = msg_hops_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "sss.separated.fS"); + + // +----------------------------------------------------------+ + // | Hop size | + // +----------------------------------------------------------+ + + cfg->hopSize = parameters_lookup_int(fileConfig, "sss.separated.hopSize"); + + // +----------------------------------------------------------+ + // | Number of channels | + // +----------------------------------------------------------+ + + cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); + + return cfg; + + } + + msg_hops_cfg * parameters_msg_hops_pfs_vol_config(const char * fileConfig) { + + msg_hops_cfg * cfg; + + cfg = msg_hops_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "sss.postfiltered.fS"); + + // +----------------------------------------------------------+ + // | Hop size | + // +----------------------------------------------------------+ + + cfg->hopSize = parameters_lookup_int(fileConfig, "sss.postfiltered.hopSize"); + + // +----------------------------------------------------------+ + // | Number of channels | + // +----------------------------------------------------------+ + + cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); + + return cfg; + + } + + snk_hops_cfg * parameters_snk_hops_seps_vol_config(const char * fileConfig) { + + snk_hops_cfg * cfg; + unsigned int tmpInt1; + char * tmpStr1; + char * tmpStr2; + + cfg = snk_hops_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "sss.separated.fS"); + + + // +----------------------------------------------------------+ + // | Format | + // +----------------------------------------------------------+ + + tmpInt1 = parameters_lookup_int(fileConfig, "sss.separated.nBits"); + + if ((tmpInt1 == 8) || (tmpInt1 == 16) || (tmpInt1 == 24) || (tmpInt1 == 32)) { + cfg->format = format_construct_binary_int(tmpInt1); + } + else { + printf("raw.nBits: Invalid number of bits\n"); + exit(EXIT_FAILURE); + } + + // +----------------------------------------------------------+ + // | Interface | + // +----------------------------------------------------------+ + + tmpStr1 = parameters_lookup_string(fileConfig, "sss.separated.interface.type"); + + if (strcmp(tmpStr1, "blackhole") == 0) { + + cfg->interface = interface_construct_blackhole(); + cfg->format = format_construct_undefined(); + + } + else if (strcmp(tmpStr1, "file") == 0) { + + tmpStr2 = parameters_lookup_string(fileConfig, "sss.separated.interface.path"); + cfg->interface = interface_construct_file(tmpStr2); + free((void *) tmpStr2); + + } + else if (strcmp(tmpStr1, "socket") == 0) { + + tmpStr2 = parameters_lookup_string(fileConfig, "sss.separated.interface.ip"); + tmpInt1 = parameters_lookup_int(fileConfig, "sss.separated.interface.port"); + + cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); + free((void *) tmpStr2); + + } + else if (strcmp(tmpStr1, "terminal") == 0) { + + cfg->interface = interface_construct_terminal(); + + } + else { + + printf("sss.separated.interface.type: Invalid type\n"); + exit(EXIT_FAILURE); + + } + + free((void *) tmpStr1); + + return cfg; + + } + + snk_hops_cfg * parameters_snk_hops_pfs_vol_config(const char * fileConfig) { + + snk_hops_cfg * cfg; + unsigned int tmpInt1; + char * tmpStr1; + char * tmpStr2; + + cfg = snk_hops_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "sss.postfiltered.fS"); + + // +----------------------------------------------------------+ + // | Format | + // +----------------------------------------------------------+ + + tmpInt1 = parameters_lookup_int(fileConfig, "sss.postfiltered.nBits"); + + if ((tmpInt1 == 8) || (tmpInt1 == 16) || (tmpInt1 == 24) || (tmpInt1 == 32)) { + cfg->format = format_construct_binary_int(tmpInt1); + } + else { + printf("raw.nBits: Invalid number of bits\n"); + exit(EXIT_FAILURE); + } + + // +----------------------------------------------------------+ + // | Type | + // +----------------------------------------------------------+ + + tmpStr1 = parameters_lookup_string(fileConfig, "sss.postfiltered.interface.type"); + + if (strcmp(tmpStr1, "blackhole") == 0) { + + cfg->interface = interface_construct_blackhole(); + cfg->format = format_construct_undefined(); + + } + else if (strcmp(tmpStr1, "file") == 0) { + + tmpStr2 = parameters_lookup_string(fileConfig, "sss.postfiltered.interface.path"); + cfg->interface = interface_construct_file(tmpStr2); + free((void *) tmpStr2); + + } + else if (strcmp(tmpStr1, "socket") == 0) { + + tmpStr2 = parameters_lookup_string(fileConfig, "sss.postfiltered.interface.ip"); + tmpInt1 = parameters_lookup_int(fileConfig, "sss.postfiltered.interface.port"); + + cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); + free((void *) tmpStr2); + + } + else if (strcmp(tmpStr1, "terminal") == 0) { + + cfg->interface = interface_construct_terminal(); + + } + else { + + printf("sss.postfiltered.interface.type: Invalid type\n"); + exit(EXIT_FAILURE); + + } + + free((void *) tmpStr1); + + return cfg; + + } + + mod_classify_cfg * parameters_mod_classify_config(const char * fileConfig) { + + mod_classify_cfg * cfg; + + cfg = mod_classify_cfg_construct(); + + // +----------------------------------------------------------+ + // | Frame size | + // +----------------------------------------------------------+ + + cfg->frameSize = parameters_lookup_int(fileConfig, "classify.frameSize"); + + // +----------------------------------------------------------+ + // | Window size | + // +----------------------------------------------------------+ + + cfg->winSize = parameters_lookup_int(fileConfig, "classify.winSize"); + + // +----------------------------------------------------------+ + // | tauMin | + // +----------------------------------------------------------+ + + cfg->tauMin = parameters_lookup_int(fileConfig, "classify.tauMin"); + + // +----------------------------------------------------------+ + // | tauMax | + // +----------------------------------------------------------+ + + cfg->tauMax = parameters_lookup_int(fileConfig, "classify.tauMax"); + + // +----------------------------------------------------------+ + // | deltaTauMax | + // +----------------------------------------------------------+ + + cfg->deltaTauMax = parameters_lookup_int(fileConfig, "classify.deltaTauMax"); + + // +----------------------------------------------------------+ + // | alpha | + // +----------------------------------------------------------+ + + cfg->alpha = parameters_lookup_float(fileConfig, "classify.alpha"); + + // +----------------------------------------------------------+ + // | gamma | + // +----------------------------------------------------------+ + + cfg->gamma = parameters_lookup_float(fileConfig, "classify.gamma"); + + // +----------------------------------------------------------+ + // | phiMin | + // +----------------------------------------------------------+ + + cfg->phiMin = parameters_lookup_float(fileConfig, "classify.phiMin"); + + // +----------------------------------------------------------+ + // | r0 | + // +----------------------------------------------------------+ + + cfg->r0 = parameters_lookup_float(fileConfig, "classify.r0"); + + return cfg; + + } + + msg_categories_cfg * parameters_msg_categories_config(const char * fileConfig) { + + msg_categories_cfg * cfg; + + cfg = msg_categories_cfg_construct(); + + // +----------------------------------------------------------+ + // | Number of channels | + // +----------------------------------------------------------+ + + cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + + return cfg; + + } + + snk_categories_cfg * parameters_snk_categories_config(const char * fileConfig) { + + snk_categories_cfg * cfg; + unsigned int tmpInt1; + char * tmpStr1; + char * tmpStr2; + + cfg = snk_categories_cfg_construct(); + + // +----------------------------------------------------------+ + // | Sample rate | + // +----------------------------------------------------------+ + + cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + + // +----------------------------------------------------------+ + // | Format | + // +----------------------------------------------------------+ + + tmpStr1 = parameters_lookup_string(fileConfig, "classify.category.format"); + + if (strcmp(tmpStr1, "json") == 0) { cfg->format = format_construct_text_json(); } + else if (strcmp(tmpStr1, "undefined") == 0) { cfg->format = format_construct_undefined(); } + else { printf("classify.category.format: Invalid format\n"); exit(EXIT_FAILURE); } + + free((void *) tmpStr1); + + // +----------------------------------------------------------+ + // | Type | + // +----------------------------------------------------------+ + + tmpStr1 = parameters_lookup_string(fileConfig, "classify.category.interface.type"); + + if (strcmp(tmpStr1, "blackhole") == 0) { + + cfg->interface = interface_construct_blackhole(); + + } + else if (strcmp(tmpStr1, "file") == 0) { + + tmpStr2 = parameters_lookup_string(fileConfig, "classify.category.interface.path"); + cfg->interface = interface_construct_file(tmpStr2); + free((void *) tmpStr2); + + } + else if (strcmp(tmpStr1, "socket") == 0) { + + tmpStr2 = parameters_lookup_string(fileConfig, "classify.category.interface.ip"); + tmpInt1 = parameters_lookup_int(fileConfig, "classify.category.interface.port"); + + cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); + free((void *) tmpStr2); + + } + else if (strcmp(tmpStr1, "terminal") == 0) { + + cfg->interface = interface_construct_terminal(); + + } + else { + + printf("classify.category.interface.type: Invalid type\n"); + exit(EXIT_FAILURE); + + } + + free((void *) tmpStr1); + + return cfg; + + } \ No newline at end of file diff --git a/demo/odaslive/parameters.h b/demo/odaslive/parameters.h new file mode 100644 index 0000000..10daacd --- /dev/null +++ b/demo/odaslive/parameters.h @@ -0,0 +1,104 @@ +#ifndef __DEMO_PARAMETERS +#define __DEMO_PARAMETERS + + #include + #include + + int parameters_lookup_int(const char * file, const char * path); + + float parameters_lookup_float(const char * file, const char * path); + + char * parameters_lookup_string(const char * file, const char * path); + + unsigned int parameters_count(const char * file, const char * path); + + + src_hops_cfg * parameters_src_hops_mics_config(const char * fileConfig); + + msg_hops_cfg * parameters_msg_hops_mics_raw_config(const char * fileConfig); + + + mod_mapping_cfg * parameters_mod_mapping_mics_config(const char * fileConfig); + + msg_hops_cfg * parameters_msg_hops_mics_map_config(const char * fileConfig); + + + mod_resample_cfg * parameters_mod_resample_mics_config(const char * fileConfig); + + msg_hops_cfg * parameters_msg_hops_mics_rs_config(const char * fileConfig); + + + mod_stft_cfg * parameters_mod_stft_mics_config(const char * fileConfig); + + msg_spectra_cfg * parameters_msg_spectra_mics_config(const char * fileConfig); + + + mod_noise_cfg * parameters_mod_noise_mics_config(const char * fileConfig); + + msg_powers_cfg * parameters_msg_powers_mics_config(const char * fileConfig); + + + mod_ssl_cfg * parameters_mod_ssl_config(const char * fileConfig); + + msg_pots_cfg * parameters_msg_pots_ssl_config(const char * fileConfig); + + snk_pots_cfg * parameters_snk_pots_ssl_config(const char * fileConfig); + + + inj_targets_cfg * parameters_inj_targets_sst_config(const char * fileConfig); + + msg_targets_cfg * parameters_msg_targets_sst_config(const char * fileConfig); + + + mod_sst_cfg * parameters_mod_sst_config(const char * fileConfig); + + msg_tracks_cfg * parameters_msg_tracks_sst_config(const char * fileConfig); + + snk_tracks_cfg * parameters_snk_tracks_sst_config(const char * fileConfig); + + + mod_sss_cfg * parameters_mod_sss_config(const char * fileConfig); + + msg_spectra_cfg * parameters_msg_spectra_seps_config(const char * fileConfig); + + msg_spectra_cfg * parameters_msg_spectra_pfs_config(const char * fileConfig); + + + mod_istft_cfg * parameters_mod_istft_seps_config(const char * fileConfig); + + mod_istft_cfg * parameters_mod_istft_pfs_config(const char * fileConfig); + + msg_hops_cfg * parameters_msg_hops_seps_config(const char * fileConfig); + + msg_hops_cfg * parameters_msg_hops_pfs_config(const char * fileConfig); + + + mod_resample_cfg * parameters_mod_resample_seps_config(const char * fileConfig); + + mod_resample_cfg * parameters_mod_resample_pfs_config(const char * fileConfig); + + msg_hops_cfg * parameters_msg_hops_seps_rs_config(const char * fileConfig); + + msg_hops_cfg * parameters_msg_hops_pfs_rs_config(const char * fileConfig); + + + mod_volume_cfg * parameters_mod_volume_seps_config(const char * fileConfig); + + mod_volume_cfg * parameters_mod_volume_pfs_config(const char * fileConfig); + + msg_hops_cfg * parameters_msg_hops_seps_vol_config(const char * fileConfig); + + msg_hops_cfg * parameters_msg_hops_pfs_vol_config(const char * fileConfig); + + snk_hops_cfg * parameters_snk_hops_seps_vol_config(const char * fileConfig); + + snk_hops_cfg * parameters_snk_hops_pfs_vol_config(const char * fileConfig); + + + mod_classify_cfg * parameters_mod_classify_config(const char * fileConfig); + + msg_categories_cfg * parameters_msg_categories_config(const char * fileConfig); + + snk_categories_cfg * parameters_snk_categories_config(const char * fileConfig); + +#endif \ No newline at end of file diff --git a/demo/odaslive/profiler.c b/demo/odaslive/profiler.c new file mode 100644 index 0000000..14ee21a --- /dev/null +++ b/demo/odaslive/profiler.c @@ -0,0 +1,177 @@ + + #include "profiler.h" + + profiler * profiler_construct(void) { + + profiler * prf; + + prf = (profiler *) malloc(sizeof(profiler)); + + prf->duration = 0.0f; + + prf->src_hops_mics_prf = 0.0f; + prf->con_hops_mics_raw_prf = 0.0f; + + prf->mod_mapping_mics_prf = 0.0f; + prf->con_hops_mics_map_prf = 0.0f; + + prf->mod_resample_mics_prf = 0.0f; + prf->con_hops_mics_rs_prf = 0.0f; + + prf->mod_stft_mics_prf = 0.0f; + prf->con_spectra_mics_prf = 0.0f; + + prf->mod_noise_mics_prf = 0.0f; + prf->con_powers_mics_prf = 0.0f; + + prf->mod_ssl_prf = 0.0f; + prf->con_pots_ssl_prf = 0.0f; + prf->snk_pots_ssl_prf = 0.0f; + + prf->inj_targets_sst_prf = 0.0f; + prf->con_targets_sst_prf = 0.0f; + + prf->mod_sst_prf = 0.0f; + prf->con_tracks_sst_prf = 0.0f; + prf->snk_tracks_sst_prf = 0.0f; + + prf->mod_sss_prf = 0.0f; + prf->con_spectra_seps_prf = 0.0f; + prf->con_spectra_pfs_prf = 0.0f; + + prf->mod_istft_seps_prf = 0.0f;; + prf->mod_istft_pfs_prf = 0.0f;; + prf->con_hops_seps_prf = 0.0f; + prf->con_hops_pfs_prf = 0.0f; + + prf->mod_resample_seps_prf = 0.0f; + prf->mod_resample_pfs_prf = 0.0f; + prf->con_hops_seps_rs_prf = 0.0f; + prf->con_hops_pfs_rs_prf = 0.0f; + + prf->mod_volume_seps_prf = 0.0f; + prf->mod_volume_pfs_prf = 0.0f; + prf->con_hops_seps_vol_prf = 0.0f; + prf->con_hops_pfs_vol_prf = 0.0f; + prf->snk_hops_seps_vol_prf = 0.0f; + prf->snk_hops_pfs_vol_prf = 0.0f; + + prf->mod_classify_prf = 0.0f; + prf->con_categories_prf = 0.0f; + prf->snk_categories_prf = 0.0f; + + return prf; + + } + + void profiler_destroy(profiler * prf) { + + free((void *) prf); + + } + + void profiler_printf(const profiler * prf) { + + float source, sink, module, injector, connector; + float total; + + source = prf->src_hops_mics_prf; + + sink = prf->snk_pots_ssl_prf + + prf->snk_tracks_sst_prf + + prf->snk_hops_seps_vol_prf + + prf->snk_hops_pfs_vol_prf + + prf->snk_categories_prf; + + module = prf->mod_mapping_mics_prf + + prf->mod_resample_mics_prf + + prf->mod_stft_mics_prf + + prf->mod_noise_mics_prf + + prf->mod_ssl_prf + + prf->mod_sst_prf + + prf->mod_sss_prf + + prf->mod_istft_seps_prf + + prf->mod_istft_pfs_prf + + prf->mod_resample_seps_prf + + prf->mod_resample_pfs_prf + + prf->mod_volume_seps_prf + + prf->mod_volume_pfs_prf + + prf->mod_classify_prf; + + injector = prf->inj_targets_sst_prf; + + connector = prf->con_hops_mics_raw_prf + + prf->con_hops_mics_map_prf + + prf->con_hops_mics_rs_prf + + prf->con_spectra_mics_prf + + prf->con_powers_mics_prf + + prf->con_pots_ssl_prf + + prf->con_targets_sst_prf + + prf->con_tracks_sst_prf + + prf->con_spectra_seps_prf + + prf->con_spectra_pfs_prf + + prf->con_hops_seps_prf + + prf->con_hops_pfs_prf + + prf->con_hops_seps_rs_prf + + prf->con_hops_pfs_rs_prf + + prf->con_hops_seps_vol_prf + + prf->con_hops_pfs_vol_prf + + prf->con_categories_prf; + + total = source + sink + module + connector; + + printf("+--------------------------------------------+\n"); + printf("| Profiler summary |\n"); + printf("+--------------------------------------------+\n"); + printf("| + Raw |\n"); + printf("| - Source.......... %07.3f (%06.2f%%) |\n",prf->src_hops_mics_prf,roundf(10000.0f * prf->src_hops_mics_prf / prf->duration) / 100.0f); + printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_hops_mics_raw_prf,roundf(10000.0f * prf->con_hops_mics_raw_prf / prf->duration) / 100.0f); + printf("| + Mapping |\n"); + printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_mapping_mics_prf,roundf(10000.0f * prf->mod_mapping_mics_prf / prf->duration) / 100.0f); + printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_hops_mics_map_prf,roundf(10000.0f * prf->con_hops_mics_map_prf / prf->duration) / 100.0f); + printf("| + Resample |\n"); + printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_resample_mics_prf,roundf(10000.0f * prf->mod_resample_mics_prf / prf->duration) / 100.0f); + printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_hops_mics_rs_prf,roundf(10000.0f * prf->con_hops_mics_rs_prf / prf->duration) / 100.0f); + printf("| + STFT |\n"); + printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_stft_mics_prf,roundf(10000.0f * prf->mod_stft_mics_prf / prf->duration) / 100.0f); + printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_spectra_mics_prf,roundf(10000.0f * prf->con_spectra_mics_prf / prf->duration) / 100.0f); + printf("| + Noise |\n"); + printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_noise_mics_prf,roundf(10000.0f * prf->mod_noise_mics_prf / prf->duration) / 100.0f); + printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_powers_mics_prf,roundf(10000.0f * prf->con_powers_mics_prf / prf->duration) / 100.0f); + printf("| + SSL |\n"); + printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_ssl_prf,roundf(10000.0f * prf->mod_ssl_prf / prf->duration) / 100.0f); + printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_pots_ssl_prf,roundf(10000.0f * prf->con_pots_ssl_prf / prf->duration) / 100.0f); + printf("| - Sink............ %07.3f (%06.2f%%) |\n",prf->snk_pots_ssl_prf,roundf(10000.0f * prf->snk_pots_ssl_prf / prf->duration) / 100.0f); + printf("| + Target |\n"); + printf("| - Injector........ %07.3f (%06.2f%%) |\n",prf->inj_targets_sst_prf,roundf(10000.0f * prf->inj_targets_sst_prf / prf->duration) / 100.0f); + printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_targets_sst_prf,roundf(10000.0f * prf->con_targets_sst_prf / prf->duration) / 100.0f); + printf("| + SST |\n"); + printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_sst_prf,roundf(10000.0f * prf->mod_sst_prf / prf->duration) / 100.0f); + printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_tracks_sst_prf,roundf(10000.0f * prf->con_tracks_sst_prf / prf->duration) / 100.0f); + printf("| - Sink............ %07.3f (%06.2f%%) |\n",prf->snk_tracks_sst_prf,roundf(10000.0f * prf->snk_tracks_sst_prf / prf->duration) / 100.0f); + printf("| + SSS |\n"); + printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_sss_prf,roundf(10000.0f * prf->mod_sss_prf / prf->duration) / 100.0f); + printf("| - Connector....... %07.3f (%06.2f%%) |\n",(prf->con_spectra_seps_prf+prf->con_spectra_pfs_prf),roundf(10000.0f * ((prf->con_spectra_seps_prf+prf->con_spectra_pfs_prf) / prf->duration) / 100.0f)); + printf("| + ISTFT |\n"); + printf("| - Module.......... %07.3f (%06.2f%%) |\n",(prf->mod_istft_seps_prf+prf->mod_istft_pfs_prf),roundf(10000.0f * (prf->mod_istft_seps_prf+prf->mod_istft_pfs_prf) / prf->duration) / 100.0f); + printf("| - Connector....... %07.3f (%06.2f%%) |\n",(prf->con_hops_seps_prf+prf->con_hops_pfs_prf),roundf(10000.0f * (prf->con_hops_seps_prf+prf->con_hops_pfs_prf) / prf->duration) / 100.0f); + printf("| + Resample |\n"); + printf("| - Module.......... %07.3f (%06.2f%%) |\n",(prf->mod_resample_seps_prf+prf->mod_resample_pfs_prf),roundf(10000.0f * (prf->mod_resample_seps_prf+prf->mod_resample_pfs_prf) / prf->duration) / 100.0f); + printf("| - Connector....... %07.3f (%06.2f%%) |\n",(prf->con_hops_seps_rs_prf+prf->con_hops_pfs_rs_prf),roundf(10000.0f * (prf->con_hops_seps_rs_prf+prf->con_hops_pfs_rs_prf) / prf->duration) / 100.0f); + printf("| + Volume |\n"); + printf("| - Module.......... %07.3f (%06.2f%%) |\n",(prf->mod_volume_seps_prf+prf->mod_volume_pfs_prf),roundf(10000.0f * (prf->mod_volume_seps_prf+prf->mod_volume_pfs_prf) / prf->duration) / 100.0f); + printf("| - Connector....... %07.3f (%06.2f%%) |\n",(prf->con_hops_seps_vol_prf+prf->con_hops_pfs_vol_prf),roundf(10000.0f * (prf->con_hops_seps_vol_prf+prf->con_hops_pfs_vol_prf) / prf->duration) / 100.0f); + printf("| - Sink............ %07.3f (%06.2f%%) |\n",(prf->snk_hops_seps_vol_prf+prf->snk_hops_pfs_vol_prf),roundf(10000.0f * (prf->snk_hops_seps_vol_prf+prf->snk_hops_pfs_vol_prf) / prf->duration) / 100.0f); + printf("| + Classify |\n"); + printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_classify_prf,roundf(10000.0f * prf->mod_classify_prf / prf->duration) / 100.0f); + printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_categories_prf,roundf(10000.0f * prf->con_categories_prf / prf->duration) / 100.0f); + printf("| - Sink............ %07.3f (%06.2f%%) |\n",prf->snk_categories_prf,roundf(10000.0f * prf->snk_categories_prf / prf->duration) / 100.0f); + printf("+--------------------------------------------+\n"); + printf("| + TOTAL.............. %07.3f (%06.2f%%) |\n",total,roundf(10000.0f * total / prf->duration) / 100.0f); + printf("| - Module.......... %07.3f (%06.2f%%) |\n",module,roundf(10000.0f * module / prf->duration) / 100.0f); + printf("| - Connector....... %07.3f (%06.2f%%) |\n",connector,roundf(10000.0f * connector / prf->duration) / 100.0f); + printf("| - Source.......... %07.3f (%06.2f%%) |\n",source,roundf(10000.0f * source / prf->duration) / 100.0f); + printf("| - Sink............ %07.3f (%06.2f%%) |\n",sink,roundf(10000.0f * sink / prf->duration) / 100.0f); + printf("+--------------------------------------------+\n"); + + } \ No newline at end of file diff --git a/demo/odaslive/profiler.h b/demo/odaslive/profiler.h new file mode 100644 index 0000000..bf803be --- /dev/null +++ b/demo/odaslive/profiler.h @@ -0,0 +1,71 @@ +#ifndef __DEMO_PROFILER +#define __DEMO_PROFILER + + #include + #include + #include + + typedef struct profiler { + + float duration; + + float src_hops_mics_prf; + float con_hops_mics_raw_prf; + + float mod_mapping_mics_prf; + float con_hops_mics_map_prf; + + float mod_resample_mics_prf; + float con_hops_mics_rs_prf; + + float mod_stft_mics_prf; + float con_spectra_mics_prf; + + float mod_noise_mics_prf; + float con_powers_mics_prf; + + float mod_ssl_prf; + float con_pots_ssl_prf; + float snk_pots_ssl_prf; + + float inj_targets_sst_prf; + float con_targets_sst_prf; + + float mod_sst_prf; + float con_tracks_sst_prf; + float snk_tracks_sst_prf; + + float mod_sss_prf; + float con_spectra_seps_prf; + float con_spectra_pfs_prf; + + float mod_istft_seps_prf; + float mod_istft_pfs_prf; + float con_hops_seps_prf; + float con_hops_pfs_prf; + + float mod_resample_seps_prf; + float mod_resample_pfs_prf; + float con_hops_seps_rs_prf; + float con_hops_pfs_rs_prf; + + float mod_volume_seps_prf; + float mod_volume_pfs_prf; + float con_hops_seps_vol_prf; + float con_hops_pfs_vol_prf; + float snk_hops_seps_vol_prf; + float snk_hops_pfs_vol_prf; + + float mod_classify_prf; + float con_categories_prf; + float snk_categories_prf; + + } profiler; + + profiler * profiler_construct(void); + + void profiler_destroy(profiler * prf); + + void profiler_printf(const profiler * prf); + +#endif \ No newline at end of file diff --git a/demo/odaslive/threads.c b/demo/odaslive/threads.c new file mode 100644 index 0000000..7bde48e --- /dev/null +++ b/demo/odaslive/threads.c @@ -0,0 +1,1086 @@ + + #include "threads.h" + + void threads_multiple_start(aobjects * aobjs) { + + unsigned int iSink; + + // +----------------------------------------------------------+ + // | Raw | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Source | + // +------------------------------------------------------+ + + thread_start(aobjs->asrc_hops_mics_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_start(aobjs->acon_hops_mics_raw_object->thread); + + // +----------------------------------------------------------+ + // | Mapping | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + thread_start(aobjs->amod_mapping_mics_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_start(aobjs->acon_hops_mics_map_object->thread); + + // +----------------------------------------------------------+ + // | Resample | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + thread_start(aobjs->amod_resample_mics_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_start(aobjs->acon_hops_mics_rs_object->thread); + + // +----------------------------------------------------------+ + // | STFT | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + thread_start(aobjs->amod_stft_mics_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_start(aobjs->acon_spectra_mics_object->thread); + + // +----------------------------------------------------------+ + // | STFT | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + thread_start(aobjs->amod_noise_mics_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_start(aobjs->acon_powers_mics_object->thread); + + // +----------------------------------------------------------+ + // | SSL | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + thread_start(aobjs->amod_ssl_object->thread); + + // +------------------------------------------------------+ + // | Sinks | + // +------------------------------------------------------+ + + thread_start(aobjs->asnk_pots_ssl_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_start(aobjs->acon_pots_ssl_object->thread); + + // +----------------------------------------------------------+ + // | Targets | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Injector | + // +------------------------------------------------------+ + + thread_start(aobjs->ainj_targets_sst_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_start(aobjs->acon_targets_sst_object->thread); + + // +----------------------------------------------------------+ + // | SST | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + thread_start(aobjs->amod_sst_object->thread); + + // +------------------------------------------------------+ + // | Sinks | + // +------------------------------------------------------+ + + thread_start(aobjs->asnk_tracks_sst_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_start(aobjs->acon_tracks_sst_object->thread); + + // +----------------------------------------------------------+ + // | SSS | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + thread_start(aobjs->amod_sss_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_start(aobjs->acon_spectra_seps_object->thread); + thread_start(aobjs->acon_spectra_pfs_object->thread); + + // +----------------------------------------------------------+ + // | ISTFT | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + thread_start(aobjs->amod_istft_seps_object->thread); + thread_start(aobjs->amod_istft_pfs_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_start(aobjs->acon_hops_seps_object->thread); + thread_start(aobjs->acon_hops_pfs_object->thread); + + // +------------------------------------------------------+ + // | Resample | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + thread_start(aobjs->amod_resample_seps_object->thread); + thread_start(aobjs->amod_resample_pfs_object->thread); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + thread_start(aobjs->acon_hops_seps_rs_object->thread); + thread_start(aobjs->acon_hops_pfs_rs_object->thread); + + // +------------------------------------------------------+ + // | Volume | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + thread_start(aobjs->amod_volume_seps_object->thread); + thread_start(aobjs->amod_volume_pfs_object->thread); + + // +--------------------------------------------------+ + // | Sinks | + // +--------------------------------------------------+ + + thread_start(aobjs->asnk_hops_seps_vol_object->thread); + thread_start(aobjs->asnk_hops_pfs_vol_object->thread); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + thread_start(aobjs->acon_hops_seps_vol_object->thread); + thread_start(aobjs->acon_hops_pfs_vol_object->thread); + + // +------------------------------------------------------+ + // | Classify | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + thread_start(aobjs->amod_classify_object->thread); + + // +--------------------------------------------------+ + // | Sink | + // +--------------------------------------------------+ + + thread_start(aobjs->asnk_categories_object->thread); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + thread_start(aobjs->acon_categories_object->thread); + + } + + void threads_multiple_stop(aobjects * aobjs) { + + // +----------------------------------------------------------+ + // | Raw | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Source | + // +------------------------------------------------------+ + + thread_stop(aobjs->asrc_hops_mics_object->thread); + + // Stops the source that generate frames to process. + // This will generate a "zero" message that will stop + // all following threads. + + } + + void threads_multiple_join(aobjects * aobjs) { + + unsigned int iSink; + + // +----------------------------------------------------------+ + // | Raw | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Source | + // +------------------------------------------------------+ + + thread_join(aobjs->asrc_hops_mics_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_join(aobjs->acon_hops_mics_raw_object->thread); + + // +----------------------------------------------------------+ + // | Mapping | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + thread_join(aobjs->amod_mapping_mics_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_join(aobjs->acon_hops_mics_map_object->thread); + + // +----------------------------------------------------------+ + // | Resample | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + thread_join(aobjs->amod_resample_mics_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_join(aobjs->acon_hops_mics_rs_object->thread); + + // +----------------------------------------------------------+ + // | STFT | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + thread_join(aobjs->amod_stft_mics_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_join(aobjs->acon_spectra_mics_object->thread); + + // +----------------------------------------------------------+ + // | Noise | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + thread_join(aobjs->amod_noise_mics_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_join(aobjs->acon_powers_mics_object->thread); + + // +----------------------------------------------------------+ + // | SSL | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + thread_join(aobjs->amod_ssl_object->thread); + + // +------------------------------------------------------+ + // | Sinks | + // +------------------------------------------------------+ + + thread_join(aobjs->asnk_pots_ssl_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_join(aobjs->acon_pots_ssl_object->thread); + + // +----------------------------------------------------------+ + // | Targets | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Injector | + // +------------------------------------------------------+ + + thread_join(aobjs->ainj_targets_sst_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_join(aobjs->acon_targets_sst_object->thread); + + // +----------------------------------------------------------+ + // | SST | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + thread_join(aobjs->amod_sst_object->thread); + + // +------------------------------------------------------+ + // | Sinks | + // +------------------------------------------------------+ + + thread_join(aobjs->asnk_tracks_sst_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_join(aobjs->acon_tracks_sst_object->thread); + + // +----------------------------------------------------------+ + // | SSS | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + thread_join(aobjs->amod_sss_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_join(aobjs->acon_spectra_seps_object->thread); + thread_join(aobjs->acon_spectra_pfs_object->thread); + + // +----------------------------------------------------------+ + // | ISTFT | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Module | + // +------------------------------------------------------+ + + thread_join(aobjs->amod_istft_seps_object->thread); + thread_join(aobjs->amod_istft_pfs_object->thread); + + // +------------------------------------------------------+ + // | Connector | + // +------------------------------------------------------+ + + thread_join(aobjs->acon_hops_seps_object->thread); + thread_join(aobjs->acon_hops_pfs_object->thread); + + // +------------------------------------------------------+ + // | Resample | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + thread_join(aobjs->amod_resample_seps_object->thread); + thread_join(aobjs->amod_resample_pfs_object->thread); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + thread_join(aobjs->acon_hops_seps_rs_object->thread); + thread_join(aobjs->acon_hops_pfs_rs_object->thread); + + // +------------------------------------------------------+ + // | Volume | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + thread_join(aobjs->amod_volume_seps_object->thread); + thread_join(aobjs->amod_volume_pfs_object->thread); + + // +--------------------------------------------------+ + // | Sinks | + // +--------------------------------------------------+ + + thread_join(aobjs->asnk_hops_seps_vol_object->thread); + thread_join(aobjs->asnk_hops_pfs_vol_object->thread); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + thread_join(aobjs->acon_hops_seps_vol_object->thread); + thread_join(aobjs->acon_hops_pfs_vol_object->thread); + + // +------------------------------------------------------+ + // | Classify | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + thread_join(aobjs->amod_classify_object->thread); + + // +--------------------------------------------------+ + // | Sink | + // +--------------------------------------------------+ + + thread_join(aobjs->asnk_categories_object->thread); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + thread_join(aobjs->acon_categories_object->thread); + + } + + void threads_single_open(objects * objs) { + + unsigned int iSink; + + // +----------------------------------------------------------+ + // | Raw | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Source | + // +------------------------------------------------------+ + + src_hops_open(objs->src_hops_mics_object); + + // +----------------------------------------------------------+ + // | SSL | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Sinks | + // +------------------------------------------------------+ + + snk_pots_open(objs->snk_pots_ssl_object); + + // +----------------------------------------------------------+ + // | SST | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Sinks | + // +------------------------------------------------------+ + + snk_tracks_open(objs->snk_tracks_sst_object); + + // +----------------------------------------------------------+ + // | Volume | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Sinks | + // +------------------------------------------------------+ + + snk_hops_open(objs->snk_hops_seps_vol_object); + snk_hops_open(objs->snk_hops_pfs_vol_object); + + // +----------------------------------------------------------+ + // | Classify | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Sinks | + // +------------------------------------------------------+ + + snk_categories_open(objs->snk_categories_object); + + } + + void threads_single_close(objects * objs) { + + unsigned int iSink; + + // +----------------------------------------------------------+ + // | Raw | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Source | + // +------------------------------------------------------+ + + src_hops_close(objs->src_hops_mics_object); + + // +----------------------------------------------------------+ + // | SSL | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Sinks | + // +------------------------------------------------------+ + + snk_pots_close(objs->snk_pots_ssl_object); + + // +----------------------------------------------------------+ + // | SST | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Sinks | + // +------------------------------------------------------+ + + snk_tracks_close(objs->snk_tracks_sst_object); + + // +----------------------------------------------------------+ + // | Volume | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Sinks | + // +------------------------------------------------------+ + + snk_hops_close(objs->snk_hops_seps_vol_object); + snk_hops_close(objs->snk_hops_pfs_vol_object); + + // +----------------------------------------------------------+ + // | Classify | + // +----------------------------------------------------------+ + + // +------------------------------------------------------+ + // | Sinks | + // +------------------------------------------------------+ + + snk_categories_close(objs->snk_categories_object); + + } + + int threads_single_process(objects * objs, profiler * prf) { + + int rtnValue; + int rtnResample; + unsigned int iSink; + + clock_t begin, end; + + prf->duration += ((float) (objs->src_hops_mics_object->hopSize)) / ((float) (objs->src_hops_mics_object->fS)); + + // +----------------------------------------------------------+ + // | SECTION I | + // +----------------------------------------------------------- + + // +------------------------------------------------------+ + // | Raw | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Source | + // +--------------------------------------------------+ + + begin = clock(); + rtnValue = src_hops_process(objs->src_hops_mics_object); + end = clock(); + prf->src_hops_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + begin = clock(); + con_hops_process(objs->con_hops_mics_raw_object); + end = clock(); + prf->con_hops_mics_raw_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +------------------------------------------------------+ + // | Mapping | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + begin = clock(); + mod_mapping_process(objs->mod_mapping_mics_object); + end = clock(); + prf->mod_mapping_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + begin = clock(); + con_hops_process(objs->con_hops_mics_map_object); + end = clock(); + prf->con_hops_mics_map_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +------------------------------------------------------+ + // | Resample | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + begin = clock(); + mod_resample_process_push(objs->mod_resample_mics_object); + end = clock(); + prf->mod_resample_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +----------------------------------------------------------+ + // | SECTION II | + // +----------------------------------------------------------- + + // Loop through section II as long as there are frames to process from the resample module + while(1) { + + // +------------------------------------------------------+ + // | Resample | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + begin = clock(); + rtnResample = mod_resample_process_pop(objs->mod_resample_mics_object); + end = clock(); + prf->mod_resample_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // If there is no frames to process, stop + if (rtnResample == -1) { + break; + } + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + begin = clock(); + con_hops_process(objs->con_hops_mics_rs_object); + end = clock(); + prf->con_hops_mics_rs_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +------------------------------------------------------+ + // | STFT | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + begin = clock(); + mod_stft_process(objs->mod_stft_mics_object); + end = clock(); + prf->mod_stft_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + begin = clock(); + con_spectra_process(objs->con_spectra_mics_object); + end = clock(); + prf->con_spectra_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +------------------------------------------------------+ + // | Noise | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + begin = clock(); + mod_noise_process(objs->mod_noise_mics_object); + end = clock(); + prf->mod_noise_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + begin = clock(); + con_powers_process(objs->con_powers_mics_object); + end = clock(); + prf->con_powers_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +------------------------------------------------------+ + // | SSL | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + begin = clock(); + mod_ssl_process(objs->mod_ssl_object); + end = clock(); + prf->mod_ssl_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + begin = clock(); + con_pots_process(objs->con_pots_ssl_object); + end = clock(); + prf->con_pots_ssl_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +--------------------------------------------------+ + // | Sinks | + // +--------------------------------------------------+ + + begin = clock(); + snk_pots_process(objs->snk_pots_ssl_object); + end = clock(); + prf->snk_pots_ssl_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +------------------------------------------------------+ + // | Targets | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Injector | + // +--------------------------------------------------+ + + begin = clock(); + inj_targets_process(objs->inj_targets_sst_object); + end = clock(); + prf->inj_targets_sst_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + begin = clock(); + con_targets_process(objs->con_targets_sst_object); + end = clock(); + prf->con_targets_sst_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +------------------------------------------------------+ + // | SST | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + begin = clock(); + mod_sst_process(objs->mod_sst_object); + end = clock(); + prf->mod_sst_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + begin = clock(); + con_tracks_process(objs->con_tracks_sst_object); + end = clock(); + prf->con_tracks_sst_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +--------------------------------------------------+ + // | Sinks | + // +--------------------------------------------------+ + + begin = clock(); + snk_tracks_process(objs->snk_tracks_sst_object); + end = clock(); + prf->snk_tracks_sst_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +------------------------------------------------------+ + // | SSS | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + begin = clock(); + mod_sss_process(objs->mod_sss_object); + end = clock(); + prf->mod_sss_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + begin = clock(); + con_spectra_process(objs->con_spectra_seps_object); + end = clock(); + prf->con_spectra_seps_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + begin = clock(); + con_spectra_process(objs->con_spectra_pfs_object); + end = clock(); + prf->con_spectra_pfs_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +------------------------------------------------------+ + // | ISTFT | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + begin = clock(); + mod_istft_process(objs->mod_istft_seps_object); + end = clock(); + prf->mod_istft_seps_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + begin = clock(); + mod_istft_process(objs->mod_istft_pfs_object); + end = clock(); + prf->mod_istft_pfs_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + begin = clock(); + con_hops_process(objs->con_hops_seps_object); + end = clock(); + prf->con_hops_seps_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + begin = clock(); + con_hops_process(objs->con_hops_pfs_object); + end = clock(); + prf->con_hops_pfs_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +------------------------------------------------------+ + // | Resample | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + begin = clock(); + mod_resample_process_push(objs->mod_resample_seps_object); + end = clock(); + prf->mod_resample_seps_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + begin = clock(); + mod_resample_process_push(objs->mod_resample_pfs_object); + end = clock(); + prf->mod_resample_pfs_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +------------------------------------------------------+ + // | SECTION III | + // +------------------------------------------------------+ + + while(1) { + + // +----------------------------------------------+ + // | Module | + // +----------------------------------------------+ + + begin = clock(); + rtnResample = mod_resample_process_pop(objs->mod_resample_seps_object); + end = clock(); + prf->mod_resample_seps_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // If there is no frames to process, stop + if (rtnResample == -1) { + break; + } + + // +----------------------------------------------+ + // | Connector | + // +----------------------------------------------+ + + begin = clock(); + con_hops_process(objs->con_hops_seps_rs_object); + end = clock(); + prf->con_hops_seps_rs_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +----------------------------------------------+ + // | Module | + // +----------------------------------------------+ + + begin = clock(); + mod_volume_process(objs->mod_volume_seps_object); + end = clock(); + prf->mod_volume_seps_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +----------------------------------------------+ + // | Connector | + // +----------------------------------------------+ + + begin = clock(); + con_hops_process(objs->con_hops_seps_vol_object); + end = clock(); + prf->con_hops_seps_vol_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +----------------------------------------------+ + // | Sink | + // +----------------------------------------------+ + + begin = clock(); + snk_hops_process(objs->snk_hops_seps_vol_object); + end = clock(); + prf->snk_hops_seps_vol_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + } + + + while(1) { + + // +----------------------------------------------+ + // | Module | + // +----------------------------------------------+ + + begin = clock(); + rtnResample = mod_resample_process_pop(objs->mod_resample_pfs_object); + end = clock(); + prf->mod_resample_pfs_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // If there is no frames to process, stop + if (rtnResample == -1) { + break; + } + + // +----------------------------------------------+ + // | Connector | + // +----------------------------------------------+ + + begin = clock(); + con_hops_process(objs->con_hops_pfs_rs_object); + end = clock(); + prf->con_hops_pfs_rs_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +----------------------------------------------+ + // | Module | + // +----------------------------------------------+ + + begin = clock(); + mod_volume_process(objs->mod_volume_pfs_object); + end = clock(); + prf->mod_volume_pfs_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +----------------------------------------------+ + // | Connector | + // +----------------------------------------------+ + + begin = clock(); + con_hops_process(objs->con_hops_pfs_vol_object); + end = clock(); + prf->con_hops_pfs_vol_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +----------------------------------------------+ + // | Sink | + // +----------------------------------------------+ + + begin = clock(); + snk_hops_process(objs->snk_hops_pfs_vol_object); + end = clock(); + prf->snk_hops_pfs_vol_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + } + + // +------------------------------------------------------+ + // | Classify | + // +------------------------------------------------------+ + + // +--------------------------------------------------+ + // | Module | + // +--------------------------------------------------+ + + begin = clock(); + mod_classify_process(objs->mod_classify_object); + end = clock(); + prf->mod_classify_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ + + begin = clock(); + con_categories_process(objs->con_categories_object); + end = clock(); + prf->con_categories_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + // +--------------------------------------------------+ + // | Sink | + // +--------------------------------------------------+ + + begin = clock(); + snk_categories_process(objs->snk_categories_object); + end = clock(); + prf->snk_categories_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + + } + + return rtnValue; + + } \ No newline at end of file diff --git a/demo/odaslive/threads.h b/demo/odaslive/threads.h new file mode 100644 index 0000000..64a1376 --- /dev/null +++ b/demo/odaslive/threads.h @@ -0,0 +1,23 @@ +#ifndef __DEMO_THREADS +#define __DEMO_THREADS + + #include "objects.h" + #include "profiler.h" + + #include + + #include + + void threads_multiple_start(aobjects * aobjs); + + void threads_multiple_stop(aobjects * aobjs); + + void threads_multiple_join(aobjects * aobjs); + + void threads_single_open(objects * objs); + + void threads_single_close(objects * objs); + + int threads_single_process(objects * objs, profiler * prf); + +#endif \ No newline at end of file