Skip to content

Commit 35be3ef

Browse files
authored
OboeTester: make Data Paths test match CTSV (#2217)
Remove the noise signal. Use frequency 857 Hz. Increase sine amplitude. Raise threshold for phaseJitter. Fixes #2216
1 parent 19a5786 commit 35be3ef

3 files changed

Lines changed: 13 additions & 15 deletions

File tree

apps/OboeTester/app/src/main/cpp/analyzer/BaseSineAnalyzer.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ class BaseSineAnalyzer : public LoopbackProcessor {
5858
return mMagnitude;
5959
}
6060

61+
/**
62+
* Set the amplitude of some white noise that can be added to the output signal.
63+
* This can be used to try to defeat feedback suppression that may block pure sine waves.
64+
* The default is zero because it can add phaseJitter and result in flaky tests.
65+
* @param noiseAmplitude amplitude of white noise, default is 0.0
66+
*/
6167
void setNoiseAmplitude(double noiseAmplitude) {
6268
mNoiseAmplitude = noiseAmplitude;
6369
}
@@ -198,8 +204,9 @@ class BaseSineAnalyzer : public LoopbackProcessor {
198204
}
199205

200206
protected:
201-
// Try to get a prime period so the waveform plot changes every time.
202-
static constexpr int32_t kTargetGlitchFrequency = 48000 / 113;
207+
// Use a frequency that will not align with the common burst sizes.
208+
// If it aligns then buffer reordering bugs could be masked.
209+
static constexpr int32_t kTargetGlitchFrequency = 857; // Match CTS Verifier
203210

204211
int32_t mSinePeriod = 1; // this will be set before use
205212
double mInverseSinePeriod = 1.0;
@@ -209,7 +216,7 @@ class BaseSineAnalyzer : public LoopbackProcessor {
209216
// in a callback and the output frame count may advance ahead of the input, or visa versa.
210217
double mInputPhase = 0.0;
211218
double mOutputPhase = 0.0;
212-
double mOutputAmplitude = 0.75;
219+
double mOutputAmplitude = 0.90;
213220
// This is the phase offset between the mInputPhase sine wave and the recorded
214221
// signal at the tuned frequency.
215222
// If this jumps around then we are probably just hearing noise.
@@ -233,7 +240,8 @@ class BaseSineAnalyzer : public LoopbackProcessor {
233240
private:
234241
float mTolerance = 0.10; // scaled from 0.0 to 1.0
235242

236-
float mNoiseAmplitude = 0.00; // Used to experiment with warbling caused by DRC.
243+
// Default to zero because some phones have a high pass filter that make it too loud.
244+
float mNoiseAmplitude = 0.0f;
237245
PseudoRandom mWhiteNoise;
238246
};
239247

apps/OboeTester/app/src/main/cpp/analyzer/DataPathAnalyzer.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@
3636
class DataPathAnalyzer : public BaseSineAnalyzer {
3737
public:
3838

39-
DataPathAnalyzer() : BaseSineAnalyzer() {
40-
// Add a little bit of noise to reduce blockage by speaker protection and DRC.
41-
setNoiseAmplitude(0.02);
42-
}
43-
4439
double calculatePhaseError(double p1, double p2) {
4540
double diff = p1 - p2;
4641
// Wrap around the circle.

apps/OboeTester/app/src/main/java/com/mobileer/oboetester/TestDataPathsActivity.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,9 @@ public class TestDataPathsActivity extends BaseAutoGlitchActivity {
8686
public static final String KEY_USE_OUTPUT_DEVICES = "use_output_devices";
8787
public static final boolean VALUE_DEFAULT_USE_OUTPUT_DEVICES = true;
8888

89-
9089
public static final int DURATION_SECONDS = 4;
9190
private final static double MIN_REQUIRED_MAGNITUDE = 0.001;
92-
private final static int MAX_SINE_FREQUENCY = 1000;
93-
private final static int TYPICAL_SAMPLE_RATE = 48000;
94-
private final static double FRAMES_PER_CYCLE = TYPICAL_SAMPLE_RATE / MAX_SINE_FREQUENCY;
95-
private final static double PHASE_PER_BIN = 2.0 * Math.PI / FRAMES_PER_CYCLE;
96-
private final static double MAX_ALLOWED_JITTER = 0.5 * PHASE_PER_BIN;
91+
private final static double MAX_ALLOWED_JITTER = 0.1; // Matches CTS Verifier
9792
// This must match the value of kPhaseInvalid in BaseSineAnalyzer.h
9893
private final static double PHASE_INVALID = -999.0;
9994
private final static String MAGNITUDE_FORMAT = "%7.5f";

0 commit comments

Comments
 (0)