Make audiovideo_CRASFormatConversion not so flaky.
Fix the following issues:
1. Use fixed but different sine tones in the two audio streams at different
sampling rate
2. Set output node volume level to 100
TEST=Run the test on stout and parrot.
BUG=chromium:307378
Change-Id: I36df3522f8b116f142d5147ffe2c71cbf399332d
Reviewed-on: https://chromium-review.googlesource.com/177430
Reviewed-by: Owen Lin <owenlin@chromium.org>
Tested-by: Owen Lin <owenlin@chromium.org>
Commit-Queue: Owen Lin <owenlin@chromium.org>
diff --git a/client/cros/audio/sox_utils.py b/client/cros/audio/sox_utils.py
new file mode 100644
index 0000000..3e2c72e
--- /dev/null
+++ b/client/cros/audio/sox_utils.py
@@ -0,0 +1,31 @@
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+SOX_PATH = '/usr/local/bin/sox'
+
+def generate_sine_tone_cmd(
+ filename, channels=2, bits=16, rate=44100, duration=None, frequence=440,
+ gain=None):
+ """Gets a command to generate sine tones at specified ferquencies.
+
+ @param filename: the name of the file to store the sine wave in.
+ @param channels: the number of channels.
+ @param bits: the number of bits of each sample.
+ @param rate: the sampling rate.
+ @param duration: the length of the generated sine tone (in seconds).
+ @param frequence: the frequence of the sine wave.
+ @param gain: the gain (in db).
+ """
+ args = [SOX_PATH, '-n', '-t', 'raw']
+ args += ['-c', str(channels)]
+ args += ['-b', str(bits)]
+ args += ['-r', str(rate)]
+ args.append(filename)
+ args.append('synth')
+ if duration is not None:
+ args.append(str(duration))
+ args += ['sine', str(frequence)]
+ if gain is not None:
+ args += ['gain', str(gain)]
+ return args