web-audio-api

Saving sounds played in sequence as one audio file

不想你离开。 提交于 2020-01-15 06:14:05
问题 Lets say I created a program that plays one sound after another. Is it possible, without the use of 3rd party libraries, to somehow export the sound as wav or mp3? I am trying to build a little sequencer, but before I do, I need to know if this is possible. I already did my research and found many 3rd party libraries, the most famous seems to be recorder.js. For the sake of learning, I prefer to use the pure api. 回答1: Well these can be done with HTML 5 user media api's. Here is a intro from

stop all sounds in Web Audio API

若如初见. 提交于 2020-01-13 17:51:49
问题 I loaded and played multiple sounds with web audio api at the same time. Is there any way to stop all sounds? ex: a button to stop all sounds now. Since I have more than 10 sounds playing at the same time, I dont wanna manually use noteOff(0) (or stop(0) ) for each sound source. 回答1: The easiest way to achieve the effect you want, then, is to connect() them all to a gain node which is then connected to the destination, and set gain.gain.value = 0. It won't actually stop them, of course, but

stop all sounds in Web Audio API

丶灬走出姿态 提交于 2020-01-13 17:50:45
问题 I loaded and played multiple sounds with web audio api at the same time. Is there any way to stop all sounds? ex: a button to stop all sounds now. Since I have more than 10 sounds playing at the same time, I dont wanna manually use noteOff(0) (or stop(0) ) for each sound source. 回答1: The easiest way to achieve the effect you want, then, is to connect() them all to a gain node which is then connected to the destination, and set gain.gain.value = 0. It won't actually stop them, of course, but

stop all sounds in Web Audio API

て烟熏妆下的殇ゞ 提交于 2020-01-13 17:47:59
问题 I loaded and played multiple sounds with web audio api at the same time. Is there any way to stop all sounds? ex: a button to stop all sounds now. Since I have more than 10 sounds playing at the same time, I dont wanna manually use noteOff(0) (or stop(0) ) for each sound source. 回答1: The easiest way to achieve the effect you want, then, is to connect() them all to a gain node which is then connected to the destination, and set gain.gain.value = 0. It won't actually stop them, of course, but

How can I detect the number of audio channels in an mp3 in an <audio> tag?

北战南征 提交于 2020-01-13 09:35:11
问题 From what I've read I would expect the following JavaScript code to log "All is well", but instead it hits the error case: var audio = document.createElement('audio'); var ctx = new window.AudioContext(); var source = ctx.createMediaElementSource(audio); audio.src = 'http://www.mediacollege.com/audio/tone/files/440Hz_44100Hz_16bit_30sec.mp3'; // As @padenot mentioned, this is the number of channels in the source node, not the actual media file var chans = source.channelCount; if(chans == 1) {

Web Audio synthesis: how to handle changing the filter cutoff during the attack or release phase?

南楼画角 提交于 2020-01-12 14:15:50
问题 I'm building an emulation of the Roland Juno-106 synthesizer using WebAudio. The live WIP version is here. I'm hung up on how to deal with updating the filter if the cutoff frequency or envelope modulation amount are changed during the attack or release while the filter is simultaneously being modulated by the envelope. That code is located around here. The current implementation doesn't respond the way an analog synth would, but I can't quite figure out how to calculate it. On a real synth

Restart oscillator in javascript

♀尐吖头ヾ 提交于 2020-01-11 11:34:10
问题 I'm trying to make oscillator play when mouse is on canvas and stop when it's not. However, with current code, it works just once after loading page, when mouse is on canvas second time error occurs: "Uncaught InvalidStateError: Failed to execute 'start' on 'OscillatorNode': cannot call start more than once. var ac = new window.AudioContext() || new window.webkitAudioContext(); var osc = ac.createOscillator(); var canvas1 = document.getElementById("canvas1"); canvas1.addEventListener(

Using web audio api for analyzing input from microphone (convert MediaStreamSource to BufferSource)

余生颓废 提交于 2020-01-06 18:08:13
问题 I am trying to get the beats per Minute (BPM) using the Web Audio Api like it is done in the following links (http://joesul.li/van/beat-detection-using-web-audio/ or https://github.com/JMPerez/beats-audio-api/blob/gh-pages/script.js) but from an audio stream (microphone). Unfortunately, I don´t get it running. Does somebody know how I can convert the microphone MediaStreamSource to a BufferSource and continue like on the first linked Website? Here´s the Code I´ve come to this Point: navigator

Web Audio API with IOS and Phonegap causes crash on resume from background

吃可爱长大的小学妹 提交于 2020-01-05 07:33:11
问题 This might be a shot in the dark but here it goes: I have an HTML5 game running great on iPhone using Phonegap. I added audio using Web Audio API (which as of ios 6 is supported). This too works well, except when I exit the app then re-open the app (from being "Backgrounded"). Upon resuming, the app now pauses then crashes. Some other info I first noticed this after using the howler.js framework for audio. I removed this and tried the most basic barebones example of Web Audio API and the

Use ScriptProcessorNode in iPhone Safari

隐身守侯 提交于 2020-01-05 04:50:30
问题 I'm new in html5 and I want to use a ScriptProcessorNode to generate a sounds. My problem is that this code don't work in iPhone safari. But it works in safari on desktop. var context; var isPlaying; var generatorNode; var isNeedShowAlert; function myButtonClick(button) { isNeedShowAlert = true; if (isPlaying) { isPlaying = false; console.log("Stop!"); generatorNode.disconnect(); } else { alert("Play!"); isPlaying = true; console.log("Play!"); context = new webkitAudioContext(); generatorNode