Audio test and Characterization Tool

Clone this repo:
  1. 959d988 audiofuntest: Use nonblock write to avoid being stuck during playback by Yu-Hsuan Hsu · 2 weeks ago master stabilize-rust-13555.B stabilize-rust-13562.B
  2. 69e1002 audiofuntest: Terminate child process after parent exits by Yu-Hsuan Hsu · 2 weeks ago
  3. dffe544 alsa_conformance_test: Show the run time of snd_pcm_prepare by Yu-Hsuan Hsu · 5 weeks ago firmware-volteer-13521.B release-R87-13505.B stabilize-13525.B stabilize-13532.B stabilize-rust-13514.B
  4. ebf9b04 alsa_conformance_test: Print the name of the card by Yu-Hsuan Hsu · 5 months ago factory-endeavour-13295.B factory-puff-13329.B factory-trogdor-13443.B factory-zork-13427.B firmware-puff-13324.B firmware-zork-13421.B firmware-zork-13434.B release-R85-13310.B release-R86-13421.B stabilize-13310.72.B stabilize-13310.74.B stabilize-13310.83.B stabilize-13310.94.B stabilize-13310.99.B stabilize-13360.B stabilize-13421.42.B stabilize-13421.53.B stabilize-13421.73.B stabilize-13421.80.B stabilize-13482.B stabilize-lazor-13278.B stabilize-quickfix-13310.73.B stabilize-quickfix-13310.76.B stabilize-quickfix-13310.91.B stabilize-quickfix-13421.74.B
  5. d8e7890 alsa_conformance_test: Use the default period size if not set by Yu-Hsuan Hsu · 6 months ago factory-drallion-13080.B firmware-endeavour-13259.B release-R84-13099.B stabilize-13070.B stabilize-13099.101.B stabilize-13099.110.B stabilize-13099.118.B stabilize-13099.70.B stabilize-13099.72.B stabilize-13099.73.B stabilize-13099.85.B stabilize-13099.90.B stabilize-13099.94.B stabilize-quickfix-13099.93.B

ChromeOS Audio Test

This package intends to be a fast and powerful automated audio test tool. It performs polyphonic tone synthesis while simultaneously capturing the incoming sound in some form of external audio loopback. The external Mic/Headphone jack can easily be tested but the built-in speakers and microphone can also be tested by placing the ChromeBook/Laptop in a box and arranging for the built-in speaker sound to bounce off a surface and be directed to the built-in microphone. USB/audio dongles can also be tested and the audio output present in a HDMI port can likewise be tested with an appropriate dongle while looping back to an incoming microphone port.

The incoming sound is convolved through a Fourier Transform and the resulting energy peaks are filtered, sorted and compared to the known expected tones. Any missing or unexpected tones are reported. This test is fast- usually running in 1/2 second per port combination tested. During that time up to 7 sinsusoidal tones are polyphonically played, captured, Fourier analyzed, a report given and an optional spectrogram created. More than 7 tones can be used but peak discrimination of the convolved signal becomes more difficult. This could be handled by using a larger transform space and taking a little more time in processing.

It is a command line tool which lends itself to being script driven. Scripts would be different for different laptop/chromebook devices as the configuration of audio inputs and outputs can be very different across different platforms. This tool can be run on any Linux machine, not just a ChromeBook, providied the ALSA audio subsystem is available, and it usually will be.

Additional features in the tool:

  • Generation of a captured audio spectrogram file in ‘gnuplot’ format.
  • Playing the captured sound buffer to a monitor port. Useful when DUT is in a chamber and the monitor port is a USB dongle.
  • Generation of sound without capture; capture without generation. Useful for external characterization of test tool itself.

Additional features planned for inclusion very shortly:

  • Automatic test sequencing of multiple channels in a port.
  • Remote control, so a master can test ports in a Device Under Test.
  • Higher resolution sound capture with new hardware.

Packages included

Miscellaneous Notes

Properties of the DFT DFT stands for ‘Discrete Fourier Transform’. A pure Fourier Transform is continuous; DFTs were invented so Fourier Transforms could be used in the real world. The reverse of the DFT is calculated simply by applying the Fourier transform again, and reversing the resulting buffer (to satisfy normalization, also divide resulting samples by N).

The components of the DFT are complex numbers. They have a modulus and a phase: The modulus of V[k], sqrt(V[k]V[k]), describes the intensity of the particular frequency corresponding to k (because of normalization, divide modulus by sqrt(N))

The phase of a given component describes the phase shift of this component--at what angle it starts its oscillations.

What is the relation between k, the index of the Fourier component, and its frequency? The function describing the k-th basis vector is e-2πikt/N. Sample it at t= 0,1,2,..,N-1. Its real part is cos(2πkt/N) (cosine is symmetric, so sign of argument doesn't matter). Cosine starts repeating after 2π, which corresponds to kt/N = 1 or t = N/k. So how many such repetitions fit in a segment of length N? Exactly k. In other words, the k-th basis vector has k periods per buffer. What time interval corresponds to one buffer? That depends on sampling speed. If sps is number of samples/sec, then sps/N is number of buffers/second. Therefore k*sps/N is number of periods/second, or frequency.