Play an audio with a higher frequency

Open
#38,696 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
20/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript

Research direction

The issue provides only a JavaScript snippet using AudioContext.createOscillator and oscillator_node.frequency.value; start by checking the Web Audio API specification and relevant browser tests for the nominal frequency range. A useful resolution would state whether frequencies above 23 kHz are supported and identify the corresponding test or documentation change, but no repository file is named.

Written by the indexing model from the issue text.

Description

webaudio

We are using createOscillator in AudioContext to play audio with a specified frequency. If we are using a frequency of more than 23kHz, we are getting an error as below
Oscillator.frequency.value 23000 outside nominal range [-22050, 22050]; value will be clamped.

Can you please let us know how can we play an audio with a higher frequency
we use the below code to generate the audio.

const ctx = new AudioContext()
const oscillator_node = ctx.createOscillator();
oscillator_node.type="sine";
// frequency in khz
const frequency = 10;
oscillator_node.frequency.value = frequency * 1000;
oscillator_node.connect(ctx.destination);
oscillator_node.start();
setTimeout(() => {
	oscillator_node.stop()
}, 5000);

Thanks in advance

Dominant language
HTML
Stars
6.2k
Forks
3.9k
Avg merge
1d 6h
Merged PRs (30d)
586

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from web-platform-tests/wpt

All issues in web-platform-tests/wpt

Similar issues

More Audio/Video & RTC issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.