web-audio-api

Where is a comprehensive list of supported media types when recording with the Media * API?

安稳与你 提交于 2019-12-12 10:57:51
问题 I am trying to learn how to record media in the browser and I may be over-complicating things. There is an abundant supply of straight-forward examples but I got bogged down at the part when the recordings are pushed to a Blob object with an arbitrarily selected media type without checking whether that format is supported. Therefore I assume there is a list or people just keep building on past experiences. For example, from Mido22/MediaRecorder-sample: mediaOptions = { video: { tag: 'video',

Web Audio start and stop oscillator then start it again

我的梦境 提交于 2019-12-12 08:36:51
问题 I am trying to start and stop a sound. And that works. But I can't start the sound up again. Do i really have to make another oscillator again? This just seems extremely un-intuitive. There must be a better way. This is all i have that works: oscillator1.noteOn(0); oscillator1.noteOff(0); Calling noteOn again doesnt do anything. Why? Is beyond me. I also tried setting the volume, or in the context of the Web Audio people, "gain", equal to zero. But for some reason, a gain of zero makes sound.

Trim or cut audio recorded with mediarecorder JS

有些话、适合烂在心里 提交于 2019-12-12 08:14:43
问题 Requested Knowledge How to shorten (from the front) an array of audio blobs and still have playable audio. Goal I am ultimately trying to record a continuous 45 second loop of audio using the JS MediaRecorder API. The user will be able to push a button and the last 45s of audio will be saved. I can record, playback, and download a single recording just fine. Issue When I have an array called chunks of say 1000 blobs from the MediaRecorder and use chunks.slice(500, 1000) the resulting blob

Play bytestream on client site with web audio api

笑着哭i 提交于 2019-12-12 04:49:10
问题 I'm sending an stereo audiofile (WAV) via websockets and want to play it via the Web Audio Api. The Serversite technology is asp.net. Currently i have this: ws.onmessage = function(evt) { var d2 = new DataView(evt.data); var data = new Float32Array(d2.byteLength / Float32Array.BYTES_PER_ELEMENT); for (var jj = 0; jj < data.length; ++jj) { data[jj] = d2.getFloat32(jj * Float32Array.BYTES_PER_ELEMENT, true); } var buffer = context.createBuffer(1, data.length, 44100); buffer.getChannelData(0)

ScriptProcessorNode - prevent jittering?

混江龙づ霸主 提交于 2019-12-12 04:23:11
问题 I'm using a ScriptProcessorNode in order to record audio from a MediaStream / MediaStreamNode . Any time a UI operation blocks the main thread a little bit (like drawing on a canvas), the audio result is jittery at those specific moments. It seems like AudioWorker is eventually going to be implemented, which I think would solve my problem, but as of now, what is the solution? Cheers! 回答1: Use MediaRecorder API to record rather than ScriptProcessor, is my only advice. 来源: https://stackoverflow

Volume control with Web Audio API

纵然是瞬间 提交于 2019-12-12 03:38:40
问题 I'm working on a simple project to create an instrument, using Web Audio API, and wrote the following snippet (you can press ' Q ' to play the note): var audio = new AudioContext(); var volume = 0; var attack = 1; var release = 1; var carrier = audio.createOscillator(); carrier.frequency.value = 440.00; carrier.type = "sine"; carrier.start(); var carrier_volume = audio.createGain(); carrier_volume.gain.linearRampToValueAtTime(volume, 0); carrier.connect(carrier_volume); carrier_volume.connect

Web Audio API - Live Stream 'clicks' between chunks.

痞子三分冷 提交于 2019-12-12 03:02:10
问题 I am trying to stream audio through a websocket on a node.js (express) server to a web browser. The audio is coming from an iOS device as 16-bit, mono wav files sampled at 4k (4000 samples per second). Here's my code: Server Code: webSocketServer.on('connection', function connection(client) { client.on('message', function(message) { webSocketServer.clients.forEach(function each(connection) { connection.send(message, { binary: true } ); }); }); Client Code: webSocket = new WebSocket('ws://' +

Memory leak with web audio api oscillator

旧巷老猫 提交于 2019-12-12 02:59:21
问题 http://codepen.io/superuntitled/pen/EjZOjw/?editors=001 I have a little web instrument (see link above) that has a memory leak, and I am unsure how to plug it. The following function is called when an element is hovered over (there are a couple hundred of these). function tone(id, freq, tonelength) { gainNodes.id = audioCtx.createGain(); osc.id = audioCtx.createOscillator(); osc.id.connect(gainNodes.id); // set frequency and gain osc.id.frequency.value = freq; osc.id.start(0); gainNodes.id

WebAudio API: Change pitch of samples (for example mp3)

主宰稳场 提交于 2019-12-12 02:44:32
问题 I figured I can stretch a sample using playbackRate but how do I set the pitch? Im trying to achieve this without using any libraries. I found something about a doppler pitch effect in the specification but other than that I couldnt find anything truly relevant to my objective. Just a simple pitch shift, is this even possible? If so then how? Edit : Could it be that playbackRate changes the pitch as well but the browser applies some sort of correction? I think this might be the case. I have

Web audio analyser node - run at regular interval

人走茶凉 提交于 2019-12-12 02:27:55
问题 I want to detect an audio signal (morse code) on specific frequencies using web audio. I retrieve the frequency data using an analyser node's getFloatFrequencyData function. Now the problem: Using setInterval() to regularly sample the frequency data is not regular enough: the callback gets executed a few milliseconds earlier or later than expected. How can I retrieve the analyser's frequency data regularly exactly every few miliseconds? I would prefer using the built-in analyser node's FFT