Revert of C++ porting of the initial python script for conversational speech generation. (patchset #2 id:100001 of https://codereview.webrtc.org/2740063004/ )

Reason for revert:
Even if the conversational speech tool is external and not a core part of webrtc, there are too many trybots failing.

Original issue's description:
> C++ porting of the initial python script for conversational speech generation.
>
> This CL removes the Python script and adds its C++ porting.
> The former was in its early stage and it has permanently been removed.
>
> BUG=webrtc:7218
> NOTRY=True
>
> Review-Url: https://codereview.webrtc.org/2740063004
> Cr-Commit-Position: refs/heads/master@{#17254}
> Committed: 0cf3aa6d0d

TBR=henrik.lundin@webrtc.org,kjellander@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:7218

Review-Url: https://codereview.webrtc.org/2753843002
Cr-Commit-Position: refs/heads/master@{#17257}
This commit is contained in:
alessiob 2017-03-15 08:19:25 -07:00 committed by Commit bot
parent 29f730ebd8
commit dbbaa2ad66
9 changed files with 82 additions and 172 deletions

View File

@ -475,7 +475,6 @@ if (rtc_include_tests) {
":audioproc_f",
":audioproc_unittest_proto",
":unpack_aecdump",
"test/conversational_speech",
"test/py_quality_assessment",
]
}

View File

@ -1,31 +0,0 @@
# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
import("../../../../webrtc.gni")
group("conversational_speech") {
testonly = true
deps = [
":convspeech_gen",
]
}
rtc_executable("convspeech_gen") {
testonly = true
sources = [
"convspeech_gen.cc",
"settings.cc",
"settings.h",
]
deps = [
"//third_party/gflags",
"//webrtc/base:rtc_base_approved",
"//webrtc/test:fileutils",
]
visibility = [ ":*" ] # Only targets in this file can depend on this.
}

View File

@ -1,68 +0,0 @@
/*
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include <iostream>
#include "gflags/gflags.h"
#include "webrtc/base/logging.h"
#include "webrtc/modules/audio_processing/test/conversational_speech/settings.h"
#include "webrtc/test/testsupport/fileutils.h"
namespace webrtc {
namespace test {
namespace {
// Adapting DirExists/FileExists interfaces to DEFINE_validator.
auto dir_exists = [](const char* c, const std::string& dirpath) {
return DirExists(dirpath);
};
auto file_exists = [](const char* c, const std::string& filepath) {
return FileExists(filepath);
};
const char kUsageDescription[] =
"Usage: convspeech_gen\n"
" -i <path/to/source/audiotracks>\n"
" -t <path/to/timing_file.txt>\n"
" -o <output/path>\n"
"\n\n"
"Command-line tool to generate multiple-end audio tracks to simulate "
"conversational speech with two or more participants.";
DEFINE_string(i, "", "Directory containing the speech turn wav files");
DEFINE_validator(i, dir_exists);
DEFINE_string(t, "", "Path to the timing text file");
DEFINE_validator(t, file_exists);
DEFINE_string(o, "", "Output wav files destination path");
DEFINE_validator(o, dir_exists);
} // namespace
int main(int argc, char* argv[]) {
google::SetUsageMessage(kUsageDescription);
google::ParseCommandLineFlags(&argc, &argv, true);
ConvSpeechGeneratorSettings settings(FLAGS_i, FLAGS_t, FLAGS_o);
// TODO(alessiob): remove line below once debugged.
rtc::LogMessage::LogToDebug(rtc::LS_VERBOSE);
LOG(LS_VERBOSE) << "i = " << settings.audiotracks_path();
LOG(LS_VERBOSE) << "t = " << settings.timing_filepath();
LOG(LS_VERBOSE) << "o = " << settings.output_path();
return 0;
}
} // namespace test
} // namespace webrtc
int main(int argc, char* argv[]) {
return webrtc::test::main(argc, argv);
}

View File

@ -1,29 +0,0 @@
/*
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/modules/audio_processing/test/conversational_speech/settings.h"
namespace webrtc {
namespace test {
const std::string& ConvSpeechGeneratorSettings::audiotracks_path() const {
return audiotracks_path_;
}
const std::string& ConvSpeechGeneratorSettings::timing_filepath() const {
return timing_filepath_;
}
const std::string& ConvSpeechGeneratorSettings::output_path() const {
return output_path_;
}
} // namespace test
} // namespace webrtc

View File

@ -1,39 +0,0 @@
/*
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_SETTINGS_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_SETTINGS_H_
#include <string>
namespace webrtc {
namespace test {
struct ConvSpeechGeneratorSettings {
ConvSpeechGeneratorSettings(const std::string& audiotracks_path,
const std::string& timing_filepath,
const std::string& output_path)
: audiotracks_path_(audiotracks_path),
timing_filepath_(timing_filepath),
output_path_(output_path) {}
const std::string& audiotracks_path() const;
const std::string& timing_filepath() const;
const std::string& output_path() const;
const std::string audiotracks_path_;
const std::string timing_filepath_;
const std::string output_path_;
};
} // namespace test
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_SETTINGS_H_

View File

@ -1,7 +1,7 @@
# Conversational Speech generator tool
#Conversational Speech generator tool
Tool to generate multiple-end audio tracks to simulate conversational speech
with two or more participants.
Python tool to generate multiple-end audio tracks to simulate conversational
speech with two or more participants.
The input to the tool is a directory containing a number of audio tracks and
a text file indicating how to time the sequence of speech turns (see the Example
@ -21,7 +21,7 @@ and silence in the conversation.
IMPORTANT: **the whole code has not been landed yet.**
### Example
###Example
For each end, there is a set of audio tracks, e.g., a1, a2 and a3 (speaker A)
and b1, b2 (speaker B).

View File

@ -0,0 +1,58 @@
#!/usr/bin/env python
# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
"""Generate multiple-end audio tracks to simulate conversational
speech with two or more participants.
Usage: generate_conversational_tracks.py
-i path/to/source/audiotracks
-t path/to/timing_file.txt
-o output/path
"""
import argparse
import logging
import sys
def _InstanceArgumentsParser():
parser = argparse.ArgumentParser(description=(
'Generate multiple-end audio tracks to simulate conversational speech '
'with two or more participants.'))
parser.add_argument('-i', '--input_tracks_path', required=True,
help='directory containing the speech turn wav files')
parser.add_argument('-t', '--timing_file', required=True,
help='path to the timing text file')
parser.add_argument('-o', '--output_dir', required=False,
help=('base path to the output directory in which the '
'output wav files are saved'),
default='output')
return parser
def main():
# TODO(alessiob): level = logging.INFO once debugged.
logging.basicConfig(level=logging.DEBUG)
parser = _InstanceArgumentsParser()
args = parser.parse_args()
# TODO(alessiob): pass the arguments to the app controller.
# TODO(alessiob): remove when comment above addressed.
logging.debug(args)
sys.exit(0)
if __name__ == '__main__':
main()

View File

@ -0,0 +1,20 @@
#!/usr/bin/env python
# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
import unittest
import generate_conversational_tracks
class TestGenerationScript(unittest.TestCase):
def TestMain(self):
# Exit with error code if no arguments are passed.
with self.assertRaises(SystemExit) as cm:
generate_conversational_tracks.main()
self.assertGreater(cm.exception.code, 0)