1#!/bin/bash 2# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 3# 4# Use of this source code is governed by a BSD-style license 5# that can be found in the LICENSE file in the root of the source 6# tree. An additional intellectual property rights grant can be found 7# in the file PATENTS. All contributing project authors may 8# be found in the AUTHORS file in the root of the source tree. 9 10# Path to the POLQA tool. 11if [ -z ${POLQA_PATH} ]; then # Check if defined. 12 # Default location. 13 export POLQA_PATH='/var/opt/PolqaOem64' 14fi 15if [ -d "${POLQA_PATH}" ]; then 16 echo "POLQA found in ${POLQA_PATH}" 17else 18 echo "POLQA not found in ${POLQA_PATH}" 19 exit 1 20fi 21 22# Path to the Aechen IR database. 23if [ -z ${AECHEN_IR_DATABASE_PATH} ]; then # Check if defined. 24 # Default location. 25 export AECHEN_IR_DATABASE_PATH='/var/opt/AIR_1_4' 26fi 27if [ -d "${AECHEN_IR_DATABASE_PATH}" ]; then 28 echo "AIR database found in ${AECHEN_IR_DATABASE_PATH}" 29else 30 echo "AIR database not found in ${AECHEN_IR_DATABASE_PATH}" 31 exit 1 32fi 33 34# Customize probing signals, test data generators and scores if needed. 35CAPTURE_SIGNALS=(probing_signals/*.wav) 36TEST_DATA_GENERATORS=( \ 37 "identity" \ 38 "white_noise" \ 39 # "environmental_noise" \ 40 # "reverberation" \ 41) 42SCORES=( \ 43 # "polqa" \ 44 "audio_level_peak" \ 45 "audio_level_mean" \ 46) 47OUTPUT_PATH=output 48 49# Generate standard APM config files. 50chmod +x apm_quality_assessment_gencfgs.py 51./apm_quality_assessment_gencfgs.py 52 53# Customize APM configurations if needed. 54APM_CONFIGS=(apm_configs/*.json) 55 56# Add output path if missing. 57if [ ! -d ${OUTPUT_PATH} ]; then 58 mkdir ${OUTPUT_PATH} 59fi 60 61# Start one process for each "probing signal"-"test data source" pair. 62chmod +x apm_quality_assessment.py 63for capture_signal_filepath in "${CAPTURE_SIGNALS[@]}" ; do 64 probing_signal_name="$(basename $capture_signal_filepath)" 65 probing_signal_name="${probing_signal_name%.*}" 66 for test_data_gen_name in "${TEST_DATA_GENERATORS[@]}" ; do 67 LOG_FILE="${OUTPUT_PATH}/apm_qa-${probing_signal_name}-"` 68 `"${test_data_gen_name}.log" 69 echo "Starting ${probing_signal_name} ${test_data_gen_name} "` 70 `"(see ${LOG_FILE})" 71 ./apm_quality_assessment.py \ 72 --polqa_path ${POLQA_PATH}\ 73 --air_db_path ${AECHEN_IR_DATABASE_PATH}\ 74 -i ${capture_signal_filepath} \ 75 -o ${OUTPUT_PATH} \ 76 -t ${test_data_gen_name} \ 77 -c "${APM_CONFIGS[@]}" \ 78 -e "${SCORES[@]}" > $LOG_FILE 2>&1 & 79 done 80done 81 82# Join Python processes running apm_quality_assessment.py. 83wait 84 85# Export results. 86chmod +x ./apm_quality_assessment_export.py 87./apm_quality_assessment_export.py -o ${OUTPUT_PATH} 88 89# Show results in the browser. 90RESULTS_FILE="$(realpath ${OUTPUT_PATH}/results.html)" 91sensible-browser "file://${RESULTS_FILE}" > /dev/null 2>&1 & 92