Skip to content

fix(PeriodicWave): use < instead of <= for 24 kHz table size boundary#1081

Closed
spikything wants to merge 1 commit into
software-mansion:mainfrom
spikything:fix/periodic-wave-sample-rate-table-size
Closed

fix(PeriodicWave): use < instead of <= for 24 kHz table size boundary#1081
spikything wants to merge 1 commit into
software-mansion:mainfrom
spikything:fix/periodic-wave-sample-rate-table-size

Conversation

@spikything
Copy link
Copy Markdown

On Android devices where PROPERTY_OUTPUT_SAMPLE_RATE is exactly 24000,
new AudioContext() sets sampleRate_ to 24000 and getPeriodicWaveSize()
returned 2048 (Nyquist 12 kHz), causing OscillatorNode to roll off severely
from ~9.5 kHz and be silent at 12 kHz.

Change <= to < so that exactly-24000 Hz gets the 4096-entry table.
Reading back the actual Oboe stream rate after open is a separate follow-up.

Closes #1080

⚠️ Breaking changes ⚠️

None.

Introduced changes

  • PeriodicWave::getPeriodicWaveSize(): change <= 24000 to < 24000 so devices with a 24 kHz preferred sample rate use the 4096-entry wavetable instead of 2048

Checklist

  • Linked relevant issue
  • Updated relevant documentation
  • Added/Conducted relevant tests
  • Performed self-review of the code
  • Updated Web Audio API coverage
  • Added support for web
  • Updated old arch android spec file

On Android devices where PROPERTY_OUTPUT_SAMPLE_RATE is exactly 24000,
new AudioContext() sets sampleRate_ to 24000 and getPeriodicWaveSize()
returned 2048 (Nyquist 12 kHz), causing OscillatorNode to roll off
severely from ~9.5 kHz and be silent at 12 kHz.

Change <= to < so that exactly-24000 Hz gets the 4096-entry table.

Reading back actual Oboe stream rate after open could be a follow-up.
@mdydek mdydek closed this Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OscillatorNode silent above ~9.5 kHz on Android devices where PROPERTY_OUTPUT_SAMPLE_RATE is 24 kHz

2 participants