Consolidate audio quality measurement to make it easy to use for other test framework |
||||||
Issue descriptionThe check_recorded_frequency is integrated to chameleon test framework so it looks complicated. Actually, the core library of analyzing audio is in audio_quality_measurement.py and audio_analysis.py. A command line tool check_quality.py is an example to analyze a wav file in command line using audio_quality_measurement library. We should consolidate all the needed files into one python file, e.g. audio_quality_tool.py. It features: 1. Only depends on python 2.7 environment and numpy library. No dependency on other autotest framework. 2. Provide functions to analyze sine wave audio (suitable for long, analog signal) - Analyze frequency, amplitude - Find burst, delay, noise - Find volume changes 3. Provide function to compare two signals (suitable for short, digital signal) - Compute cross correlation index to get similarity score (invariant to volume) 4. Provide command line interface for manual execution. The target test framework: TradeFed, Mobile Harness.
,
Apr 28 2017
,
Apr 28 2017
Sorry! I just found out that I added the wrong Murali.
,
May 10 2017
,
May 10 2017
remote: https://chromium-review.googlesource.com/501688 [autotest] audio_data: Fix numpy data type usage remote: https://chromium-review.googlesource.com/501689 [autotest] audio_quality: Add support for converting file format remote: https://chromium-review.googlesource.com/501690 [autotest] audio_quality: Simplify check_quality usage remote: https://chromium-review.googlesource.com/501691 [autotest] audio: Add script to pack audio quality modules With these CLs, user can run ./pack_audio_quality.py to pack all the required modules into audio_quality.zip. Then, this audio_quality.zip can be executed by python standalone like python audio_quality.zip test.wav It will do the spectral analysis and check artifacts. There are still some improvements to be done: 1. To simplify the usage, the script should return an error code if there is any artifact detected. 2. The spectral analysis and artifact detection result should be dumped to a human readable file like yaml, so user can easily find where is the artifact. User can also read in that yaml file for further processing.
,
May 12 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/a2ccb016ea760e1ac72773ec7320e5aa4ba8728f commit a2ccb016ea760e1ac72773ec7320e5aa4ba8728f Author: Cheng-Yi Chiang <cychiang@chromium.org> Date: Fri May 12 10:25:25 2017 [autotest] audio_data: Fix numpy data type usage Some numpy version does not recognize 'h' dtype for short. It is replaced by 'i' to specify that data type is integer. The number of bytes is specified by the number which comes after dtype string. BUG= chromium:714066 TEST=Run check_quality.py on some wav file. Change-Id: Iecd44aa17273628efe793e89a59dc8fbcc4bd843 Reviewed-on: https://chromium-review.googlesource.com/501688 Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> [modify] https://crrev.com/a2ccb016ea760e1ac72773ec7320e5aa4ba8728f/client/cros/audio/audio_data.py
,
May 12 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/cb5f918ce3357b1ad4d5c841cad6cd264311637d commit cb5f918ce3357b1ad4d5c841cad6cd264311637d Author: Cheng-Yi Chiang <cychiang@chromium.org> Date: Fri May 12 10:25:25 2017 [autotest] audio_quality: Add support for converting file format Convert wav file with format WAVE_FORMAT_EXTENSIBLE to WAVE_FORMAT_PCM since python wave library only supports WAVE_FORMAT_PCM. BUG= chromium:714066 TEST=run check_quality.py on a wav file that is not wavpcm format. see the script uses sox to convert the file format. Change-Id: I5405eacd402238e816626d60eefc1b75898eb2f2 Reviewed-on: https://chromium-review.googlesource.com/501689 Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> [modify] https://crrev.com/cb5f918ce3357b1ad4d5c841cad6cd264311637d/client/cros/audio/check_quality.py
,
May 12 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/3386cac2726b27aab8adc8ef7677ef0be6685a37 commit 3386cac2726b27aab8adc8ef7677ef0be6685a37 Author: Cheng-Yi Chiang <cychiang@chromium.org> Date: Fri May 12 10:25:26 2017 [autotest] audio_quality: Simplify check_quality usage This script should check quality of each channel by default. If user only wants to do spectral analysis, use --spectral-only. BUG= chromium:714066 TEST=run ./check_quality.py <wav file> and ./check_quality.py <wav file> --spectral-only Change-Id: Ia2c540bcd22c5dba1c630989524c1e9031966e63 Reviewed-on: https://chromium-review.googlesource.com/501690 Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> [modify] https://crrev.com/3386cac2726b27aab8adc8ef7677ef0be6685a37/client/cros/audio/check_quality.py
,
May 12 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/2a4ebb2f4396be25dc8881ce3105e36d80cbfc00 commit 2a4ebb2f4396be25dc8881ce3105e36d80cbfc00 Author: Cheng-Yi Chiang <cychiang@chromium.org> Date: Fri May 12 10:25:26 2017 [autotest] audio: Add script to pack audio quality modules Audio quality modules can be packed into a zip file such that it is easy to be shared by other test framework. BUG= chromium:714066 TEST=./pack_audio_quality.py, then run python ./audio_quality.zip Change-Id: Ie4f6e08bbf47b7c40050f664b5ef661528c2171a Reviewed-on: https://chromium-review.googlesource.com/501691 Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> [modify] https://crrev.com/2a4ebb2f4396be25dc8881ce3105e36d80cbfc00/client/cros/audio/audio_quality_measurement_unittest.py [add] https://crrev.com/2a4ebb2f4396be25dc8881ce3105e36d80cbfc00/client/cros/audio/pack_audio_quality.py [modify] https://crrev.com/2a4ebb2f4396be25dc8881ce3105e36d80cbfc00/client/cros/audio/check_quality.py [modify] https://crrev.com/2a4ebb2f4396be25dc8881ce3105e36d80cbfc00/client/cros/audio/audio_quality_measurement.py
,
May 26 2017
,
May 26 2017
Some feedback from Eddie: 1. Add argument to specify expected frequency of each channel. 2. Return error when expected frequency is not correct. 3. Add argument to specify a frequency threshold to ignore high frequencies. 4. Dump spectral analysis result to yaml or json file. 5. Dump artifacts analysis result to yaml or json file. 6. Return error when there is artifacts. 7. Support RAW data format. This should be detected automatically by file name '.raw'.
,
May 31 2017
Also, I should append the packed file name with git hash and date so it is easier to see the difference.
,
Jun 5 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/d4235a4a1f802cd6d737dda565ff32d22ea6f18e commit d4235a4a1f802cd6d737dda565ff32d22ea6f18e Author: Cheng-Yi Chiang <cychiang@chromium.org> Date: Mon Jun 05 05:09:45 2017 [autotest] pack_audio_quality: Add git SHA-1 to packed file name It will be helpful to see the packed file is different than the older one. BUG= chromium:714066 TEST=Run pack_audio_quality when there is uncommited changes in autotest repo. Check the output file is like audio_quality_f4610bdd3_dirty.zip. TEST=Run pack_audio_quality when there is not changes in autotest repo. Check the output file is like audio_quality_f4610bdd3.zip. Change-Id: I3140130fac7627cdab38b548044f3c8f8fc8edb9 Reviewed-on: https://chromium-review.googlesource.com/520827 Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> [modify] https://crrev.com/d4235a4a1f802cd6d737dda565ff32d22ea6f18e/client/cros/audio/pack_audio_quality.py
,
Jun 9 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/694990755f7dc718e91a25f24d058bc00d1d18c3 commit 694990755f7dc718e91a25f24d058bc00d1d18c3 Author: Cheng-Yi Chiang <cychiang@chromium.org> Date: Fri Jun 09 14:10:39 2017 [autotest] check_quality: Add support to specify expected frequencies Use --freqs to specify expected frequencies on each channel. If the frequency does not match, an exception will be raised. BUG= chromium:714066 TEST=1. Generate test data: sox -b 16 -r 48000 -c 4 -e signed -n synth.wav synth 5 sine 300 sine 20 sine 10 sine 5 2. Run the check: ./check_quality.py synth.wav --freqs 300 20 --spec Change-Id: Idb27d48ca4c75984cb89db5e3ef1361b4875ebc7 Reviewed-on: https://chromium-review.googlesource.com/527538 Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> [modify] https://crrev.com/694990755f7dc718e91a25f24d058bc00d1d18c3/client/cros/audio/check_quality.py
,
Jun 9 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/1fcbf6a0806a0a2b4c605e615059fbd8f9ae038c commit 1fcbf6a0806a0a2b4c605e615059fbd8f9ae038c Author: Cheng-Yi Chiang <cychiang@chromium.org> Date: Fri Jun 09 14:10:39 2017 [autotest] check_quality: Add raw file support Add raw file support. BUG= chromium:714066 TSET=1. Generate test file: sox -b 16 -r 48000 -c 4 -e signed -n synth.raw synth 5 sine 300 sine 660 sine 20 sine 30 2. Run spectral analysis on the first two channels: ./check_quality.py synth.raw --spec --freqs 300 660 -b 16 -c4 Change-Id: I288123218926777d68b803c0aa84e27dbb1d7bbd Reviewed-on: https://chromium-review.googlesource.com/527539 Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> [modify] https://crrev.com/1fcbf6a0806a0a2b4c605e615059fbd8f9ae038c/client/cros/audio/check_quality.py
,
Jun 9 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/fbc89d59e2285f7006160cab3708503a6d929307 commit fbc89d59e2285f7006160cab3708503a6d929307 Author: Cheng-Yi Chiang <cychiang@chromium.org> Date: Fri Jun 09 14:10:39 2017 [autotest] audio_analysis: Handle data with too small RMS Do not raise exception when data RMS is too small. This happens on the channels that should be ignored. Set dominant frequency and coefficient to both 0 instead. BUG= chromium:714066 TEST=1.Generate the data: sox -b 16 -r 48000 -c 4 -e signed -n synth_with_0.raw synth 5 sine 300 sine 660 sine 0 sine 0 2. Run the check: ./check_quality.py synth_with_0.raw --spec --freqs 300 660 -b 16 -c4 Change-Id: I1ad9012fc6f8f6b0174079268b7213bf463ab7a9 Reviewed-on: https://chromium-review.googlesource.com/527540 Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> [modify] https://crrev.com/fbc89d59e2285f7006160cab3708503a6d929307/client/cros/audio/audio_analysis_unittest.py [modify] https://crrev.com/fbc89d59e2285f7006160cab3708503a6d929307/client/cros/audio/audio_analysis.py
,
Jun 12 2017
A bunch of CLs went in. Listed the TODOs: DONE 1. Add argument to specify expected frequency of each channel. DONE 2. Return error when expected frequency is not correct. 3. Add argument to specify a frequency threshold to ignore high frequencies. 4. Dump spectral analysis result to yaml or json file. 5. Dump artifacts analysis result to yaml or json file. 6. Return error when there is artifacts. DONE 7. Support RAW data format. This should be detected automatically by file name '.raw'. DONE 8. Put git hash in zipped file name.
,
Jun 29 2017
The CL series https://chromium-review.googlesource.com/#/c/554852/ covers 3.4.5.6. in #17. After the review we can close this issue.
,
Jul 6 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/8c934ad22574ad0ef3f27ea49bca63d1ed977d3d commit 8c934ad22574ad0ef3f27ea49bca63d1ed977d3d Author: Cheng-Yi Chiang <cychiang@chromium.org> Date: Thu Jul 06 12:00:27 2017 [autotest] check_quality: Add argument to ignore high frequencies This argument will be useful when there are high-frequency noise. Also, fix freq-threshold argument typo. BUG= chromium:714066 TEST=run check_quality command with --ignore-high-freq argument. Change-Id: I528a7c9aa53bff9066a68a4e298081ccd69f3e43 Reviewed-on: https://chromium-review.googlesource.com/532501 Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-by: Hsu Wei-Cheng <mojahsu@chromium.org> [modify] https://crrev.com/8c934ad22574ad0ef3f27ea49bca63d1ed977d3d/client/cros/audio/check_quality.py
,
Jul 6 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/394d7d3243cda9b9e9e9ef8d71449d6ee42f03b8 commit 394d7d3243cda9b9e9e9ef8d71449d6ee42f03b8 Author: Cheng-Yi Chiang <cychiang@chromium.org> Date: Thu Jul 06 12:00:27 2017 [autotest] check_quality: Dump spectral and quality measurement results Let user specify an output file path to dump spectral and quality measurement result in json format. BUG= chromium:714066 TEST=run check_quality argument with --output-file argument. Change-Id: If700aceb78a39c951a9b9586f217435ba8a87558 Reviewed-on: https://chromium-review.googlesource.com/532502 Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-by: Hsu Wei-Cheng <mojahsu@chromium.org> [modify] https://crrev.com/394d7d3243cda9b9e9e9ef8d71449d6ee42f03b8/client/cros/audio/check_quality.py
,
Jul 6 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/2c6d0b775c5702331da94c2ce62c25a46edfdf7d commit 2c6d0b775c5702331da94c2ce62c25a46edfdf7d Author: Cheng-Yi Chiang <cychiang@chromium.org> Date: Thu Jul 06 12:00:27 2017 [autotest] check_quality: Raise exception at quality issue Raise exception for quality defect found in the wave file. BUG= chromium:714066 TEST=run check_quality tool on wav file with delay. Change-Id: I1028d33fdd707c321d01ffaf6e97124e69cca80f Reviewed-on: https://chromium-review.googlesource.com/554851 Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-by: Hsu Wei-Cheng <mojahsu@chromium.org> [modify] https://crrev.com/2c6d0b775c5702331da94c2ce62c25a46edfdf7d/client/cros/audio/check_quality.py
,
Jul 6 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/eda79b2aa543cfb7535d5b21e4d68c5365c483eb commit eda79b2aa543cfb7535d5b21e4d68c5365c483eb Author: Cheng-Yi Chiang <cychiang@chromium.org> Date: Thu Jul 06 12:00:28 2017 [autotest] check_quality: Add arguments for quality measurement There some arguments to be tuned for target wave file. Expose those arguments for user. BUG= chromium:714066 TEST=run check_quality tool with quality-* args. Change-Id: Id534827bee5c0d69acc2f3c3a33677b458593af8 Reviewed-on: https://chromium-review.googlesource.com/554852 Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-by: Hsu Wei-Cheng <mojahsu@chromium.org> [modify] https://crrev.com/eda79b2aa543cfb7535d5b21e4d68c5365c483eb/client/cros/audio/check_quality.py
,
Jul 17 2017
All the necessary CLs are merged. Now user can pack the libraries by running ./pack_audio_quality.py under client/cros/audio/ Then, execute the utility to check audio quality/frequency by python ./audio_quality_xxxx.zip Hi Eddie, you are welcomed to try out the new packed library. Hope this ease the use case in your environment. Please let me know if you find any issue. Thanks! |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by cychiang@chromium.org
, Apr 21 2017