xref: /aosp_15_r20/external/oboe/apps/OboeTester/docs/Usage.md (revision 05767d913155b055644481607e6fa1e35e2fe72c)
1[Home](README.md)
2
3# How to Use OboeTester
4
5## Loopback Adapter Needed for Some Tests
6
7Some of these tests require an [audio Loopback Adapter](https://source.android.com/devices/audio/latency/loopback) that plugs into a 3.5 mm jack.
8If the phone does not have a 3.5 mm jack then you can combine that with a USB to 3.5mm adapter.
9
10Loopback adapters can be purchased from [PassMark Software](https://www.passmark.com/products/audio-loopback-plug/).
11
12## Test Activities
13
14Launch OboeTester and then select one of the test Activities.
15
16### Test Output
17
18Tap the green bar to expand the Settings display.
19
20Test opening, starting, stopping and closing a stream.
21Various stream parameters can be selected before opening.
22While the stream is playing, the frame counts and stream state are displayed.
23The latency is estimated based on the timestamp information.
24
25Experiment with changing the buffer size to see if there are glitches when the size is high or low.
26
27Experiment with changing the "Workload".
28Watch the "% CPU" and the #XRuns.
29The audio is expected to glitch when the workload is high because there is too much work
30and the audio task misses its delivery deadlines.
31
32The extra workload is generated by calculating a number of classic synthesizer voices with two oscillators, two envelopes and a resonant filter.
33You can see the affect of the changing workload in the "% cpu" report in the status area.
34The extra workload will always cause glitching when you get close to 100% CPU load.
35If the workload is causing glitching at a low % CPU load then there may be a problem with the callback timing.
36
37A variety of output signals can be played including frequency sweeps and white noise.
38The default output sound is a sine wave on each channel. The base frequency is 330 Hz
39and increases by a ratio of 4:3 (a perfect fourth) for each channel.
40
41Instructions for using TEST OUTPUT for 4 or more chanels is in
42[Wiki/OboeTester_MultiChannelOutput](https://github.com/google/oboe/wiki/OboeTester_MultiChannelOutput).
43
44### Test Input
45
46Test input streams. Displays current volume as VU bars.
47
48### Tap to Tone Latency
49
50Measure touch screen latency plus audio output latency.
51Press START then tap on the screen with your fingertip.
52The app will listen for the sound of your fingernail tapping the screen
53and the resulting beep, and then measure the time between them.
54
55If you use headphones then you can eliminate the latency caused by speaker protection.
56If you use USB-MIDI input then you can eliminate the latency due to the touch screen, which is around 15-30 msec.
57MIDI latency is generally under 1 msec.
58This test works well for measuring the output latency of Bluetooth headsets.
59
60More instructions in the [Wiki/OboeTester_TapToTone](https://github.com/google/oboe/wiki/OboeTester_TapToTone).
61
62### Echo Input to Output
63
64This test copies input to output and adds up to 3 seconds of delay.
65This can be used to simulate high latency on a phone that supports low latency.
66Try putting the phone to your ear with the added delay at 0 and try talking.
67Then set it to about 700 msec and try talking on the phone. Notice how the echo can be very confusing.
68
69The test will also display estimated "cold start latency" for full duplex streams.
70
71### Round Trip Latency
72
73This test works with either a [loopback adapter](https://source.android.com/devices/audio/latency/loopback) or through speakers.
74Latency through the speakers will probably be higher.
75It measures the input and output latency combined.
76
771. Set the Input or Output settings by tapping the green bar to expose the controls.
782. Set the volume somewhere above the middle. The test works at almost any volume. But the confidence will be higher at higher volumes.
793. Tap "MEASURE" to make a single measurement.
804. Or tap "AVERAGE" to run the test several times and report an average and Mean Absolute Deviation.
81
82The test starts by setting up a stable full-duplex stream.
83Then it outputs a random series of bits encoded using smoothed Manchester Encoding.
84We record the Input and Output stream together for about a second.
85Then we correlate the two streams by sliding the portion of the output stream that contains the random bits over the input stream at different time offsets.
86The Manchaster Encoded signal provide a very sharp peak when the offset matches the combined input and output latency.
87
88Source code for the analyzer in [LatencyAnalyzer.h](https://github.com/google/oboe/blob/main/apps/OboeTester/app/src/main/cpp/analyzer/LatencyAnalyzer.h).
89
90### Record and Play
91
92* Tap RECORD to record several seconds of audio. You should see the red VU meters move.
93* Tap STOP then PLAY to play it back.
94* Tap SHARE button to the recorded WAV file to GDrive, GMail or another app.
95You can then examine the WAV file using a program like Audacity.
96
97### Glitch Test
98
99This test works best with a loopback adapter. But it can also work in a quiet room.
100It plays a sine wave and then tries to record and lock onto that sine wave.
101If the actual input does not match the expected sine wave value then it is counted as a glitch.
102The test will display the maximum time that it ran without seeing a glitch.
103
1041. Plug in loopback adapter. (Optional)
1052. Press green bars to show input and output settings. Make changes. (optional)
1063. Press START button.
1074. Watch for state=LOCKED, which means it has detected and locked onto the sine wave output.
1085. Note the glitch count, which should be zero.
1096. Also the "max.time.no.glitches" should be as long as you run the test.
1107. Press STOP button.
1118. Press SHARE button to send a WAV file recording of the last glitch by email to yourself.
112
113Look for the #XRuns display.
114If #XRuns increments when a glitch occurs then the glitch is probably due to preemption of the audio task.
115If #XRuns is not incrementing then the glitches may be due to AAudio MMAP tuning errors in the HAL.
116
117### Auto Glitch Test
118
119Measure glitches for various combinations of input and output settings.
120Change the test duration to a high value and let it run for a while.
121If you get glitches in one configuration then you can investigate using the previous manual Glitch Test.
122The Share button will let you email the report to yourself.
123
124### Test Disconnect
125
126You can test whether the disconnect logic is working in Android by plugging or unplugging a headset.
127Just follow the instructions in red. You will get a report at the end that you can SHARE by GMail or Drive.
128
129### Device Report
130
131Provides a device report. This report includes info about the features enabled, the properties set, audio
132paths, and microphones.
133You can share this report by first pressing the icon with the three vertical dots at the top right of OboeTester.
134After that, simply press the share button and you should be able to email this to yourself.
135
136### Data Paths
137
138This checks for dead speaker and mic channels, dead Input Presets and other audio data path problems.
139
1401. Tap "DATA PATHS" button.
1411. Unplug or disconnect any headphones.
1421. Set volume to medium high.
1431. Place the phone on a table in a quiet room and hit START.
1441. Wait a few minutes, quietly, for the test to complete. You will hear some sine tones.
1451. You will get a report at the end that you can SHARE by GMail or Drive.
146
147### External Tap-to-Tone
148
149This lets you measure the latency between touching a screen to the sound coming out on a second device.
150You could use this to measure, for example, the latency on an iPhone.
151
1521. Launch OboeTester on Android device (A) in a quiet room.
1532. Tap "EXTRAS..." button.
1543. Tap "EXTERNAL TAP" button.
1554. Launch a program on a second device (B) that will make a sound when you touch the screen. A good example would be an interactive drum pad.
1565. Tap "START" button to start listening on device (A).
1576. Tap on the app on the device (B) with your fingertip. You need to make a noise with your fingernail.
1587. Quickly tap the "ANALYSE" button on device (A).
1598. OboeTester will now look for two sounds in the recording and measure the time between them.
160
161### Plug Latency
162Measures the time it takes to close, open, and start streams as audio devices are plugged in and removed.
163
164### Error Callback Test
165Lets you delete an error callback while it is used by Oboe. Targeted test for issue #1603.
166
167### Route Callback Test
168Changes the VoiceCommunication route while playing audio. Targeted test for issue #1763.
169
170### CPU Load
171This test plays a tone and alternates between low and high workloads.
172It exercises the kernel's CPU scheduler, which controls CPU frequency and core migration.
173Moredetails on the [wiki/OboeTester_DynamicCpuLoad](https://github.com/google/oboe/wiki/OboeTester_DynamicCpuLoad).
174