Questions tagged [javascript-oscillator]
20 questions
33
votes
4 answers
(Web Audio API) Oscillator node error: cannot call start more than once
When I start my oscillator, stop it, and then start it again; I get the following error:
Uncaught InvalidStateError: Failed to execute 'start' on 'OscillatorNode': cannot call start more than once.
Obviously I could use gain to "stop" the audio but…

Jacksonkr
- 31,583
- 39
- 180
- 284
7
votes
2 answers
How can I write an array of audio samples to a wav file with Node.js?
I'm writing an oscillator in JavaScript that creates a sweep(i.e. chirp) between sine wave frequencies. For testing, I'd like to write the samples(which are floats) to a wav file. How would I do this in Node.js? I've seen lots of information on…

Ten Bitcomb
- 2,316
- 1
- 25
- 39
3
votes
2 answers
Changing volume of oscillator in JavaScript?
I have created a oscillator (as shown below), like MDN said:
// from : https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Using_Web_Audio_API
var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
var oscillator =…

Stardust
- 999
- 3
- 12
- 24
2
votes
1 answer
How to beep on evey button click
Html application needs to beep on every button touch.
Tried code below in desktop and Android browsers.
In desktop browser (latest Chrome) after clicking rapidly 100 times
in button beep is disabled after 100 clicks.
In mobile browser (Android 11 or…

Andrus
- 26,339
- 60
- 204
- 378
2
votes
1 answer
Is there a node.js module that can generate 1/f (pink noise) fluctuations?
I'm looking for a node.js module that would be able to generate fluctuations (of any sort) that would follow the S(f) = 1/f "pink / fractal noise" pattern. That means, that if we performed Fourier analysis of the time-series we'd find that there's a…

Aerodynamika
- 7,883
- 16
- 78
- 137
2
votes
2 answers
javascript oscillator volume not fully working
I have the following snippet that creates an oscillator and plays it at a certain volume. I keep the oscillator variable outside of the scope of the function so that I can stop it with other functions if I need to.
var oscillator = null;
var…

Cliff
- 697
- 8
- 19
1
vote
0 answers
Is it more expensive to create and close web audio oscillators or to keep running and manipulate the gain?
So I have a web app I'm building that has several different possible sounds that can be triggered by a button press. Something like a radio list of options and you choose your option and then hit the play button and it plays.
previously with only 2…

shaedopotato
- 457
- 1
- 3
- 12
1
vote
1 answer
How does oscillator.detune() work in Web Audio API?
I have read that 1200 cents are in 1 octave.
So, I tried the following:
const audioContext = new AudioContext();
function Oscillator(frequency, detune) {
this.oscillator = audioContext.createOscillator();
…

vighnesh153
- 4,354
- 2
- 13
- 27
0
votes
0 answers
WebAudioAPI: Non-started oscillators still consume resources, stutter and crash - too many?
Really a number of questions about the Web Audio API here, like: Is there a limit to how many nodes you can have in a graph? How do I know if I am approaching the limit? Why do non-started nodes still consume resources?
Here is a JSFiddle for…

Greg Kennedy
- 430
- 4
- 23
0
votes
1 answer
Oscillator not stoppingor ramping down in Web Audio API
I am trying to make a metronome as part of a bigger app by using an oscillator that switches on and off at set intervals in Web Audio Api, I have tried both the Start()/Stop() method and the LinearRampToValue(), in the code below. The oscillator…
0
votes
1 answer
Javascript Audiocontext Oscillator Not Working on Windows Edge or Android Browsers
The code is complete.
No sound produced.
Tried on Windows Edge Version 109.0.1518.70 (Official build) (64-bit)
Fresh reinstall of Andriod OS and also Windows Install and Upgraded.
I have tried old Audiocontext Oscillator app code
that worked on my…

noname
- 1
0
votes
1 answer
Trying to detect when oscillator audio ends (javascript)
I am trying to detect when the oscillator audio has stopped playing.
When I use onended,onend or event listener ended it only gets detected when I execute oscillator.stop()
Any one has any idea what I'm doing wrong or how this can be done? Thanks in…

Gych
- 21
- 4
0
votes
2 answers
How to get the real and imag arrays for createPeriodicWave for a piecewise periodic function?
The pattern of the wave is as follows:
0.0 - 0.5 => low,
0.5 - 1.0 => high,
1.0 - 2.0 => low,
2.0 - 2.5 => high,
2.5 - 4.0 => low,
4.0 - 4.5 => high,
4.5 - 6.5 => low,
6.5 - 7.0 => high,
The pulses are equal but the time between different pulses…

Mutai Mwiti
- 487
- 1
- 7
- 20
0
votes
0 answers
How to connect/trigger elements in specific mouse-pressed combinations in p5.js
I'm trying to visualize music in a concrete way:
I built a keyboard with 60 keys, which I positioned at the bottom of the canvas. The whole visualization of every single key pressed, is supposed to be above that.
The idea is, that with every key…

Javrimir
- 1
0
votes
1 answer
WebAudio isn't giving any audio output
HTML
000hz
SCRIPT var ctx = new AudioContext(); var osc = ctx.createOscillator(); var gain =…
Enceladus
- 55
- 6