web-audio-api

Web Audio Offline Context and Analyser Node

China☆狼群 提交于 2019-11-29 16:37:29
Is it possible to use the Analyser node in the offlineAudioContext to do frequency analysis? I found out that ScriptProcessor 's onaudioprocess event still fires in the offlineAudioContext and this was the only event source I could use to call getByteFrequencyData of the Analyser Node. As below: var offline = new offlineAudioContext(1, buffer.length, 44100); var bufferSource = offline.createBufferSource(); bufferSource.buffer = buffer; var analyser = offline.createAnalyser(); var scp = offline.createScriptProcessor(256, 0, 1); bufferSource.connect(analyser); scp.connect(offline.destination); /

How to set up sample rate using web audio API?

十年热恋 提交于 2019-11-29 16:19:07
I have blob type generated by webaudio API, but the file that is saved have to high sample rate. How can I convert it to lower maybe something like https://developer.mozilla.org/en-US/docs/Web/API/OfflineAudioContext can help? Here is some sample of code: var xhr = new XMLHttpRequest(); /* HERE IS SOME CONVERTATION TO LOWER RATE */ var fd = new FormData(); fd.append("randomname", bigBlob); xhr.open("POST",url,false); xhr.send(fd); xhr.onload=function(e) { alert(e.target.responseText); }; Create an OfflineAudioContext with the rate you want at the end, and the number of frames there will be at

Recording audio in Chrome for Android using web audio API and navigator.getUserMedia

我是研究僧i 提交于 2019-11-29 16:11:41
Chrome for Android versions 30 and 31 beta on Android 4.1 do not appear to correctly record audio using HTML5 web audio and navigator.webkitGetUserMedia. (Chrome 30+ on Android is supposed to support these APIs.) The symptom is that the code appears to work correctly, including displaying the prompt for whether or not to allow microphone access, but recorded data contains nothing but zeros. I created a simplified testcase (go to http://jsfiddle.net/JCFtK/ , and click Record button, then choose the appropriate option to allow it to access your microphone). The key part of the code is below (

HTML5 Microphone capture stops after 5 seconds in Firefox

大兔子大兔子 提交于 2019-11-29 09:12:23
I'm capturing audio input from microphone with getUserMedia() function, works fine in chrome, but in firefox sound dies out after 5 seconds. If I send request for microphone again (without reloading the page) same thing happens. Here is the code (I used http://updates.html5rocks.com/2012/09/Live-Web-Audio-Input-Enabled as guidance): //getting the function depending on browser navigator.getMedia = ( navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia); // success callback when requesting audio input stream function gotAudioStream

Mixing two audio buffers, put one on background of another by using web Audio Api

雨燕双飞 提交于 2019-11-29 06:44:16
I want to mix two audio sources by put one song as background of another into single source. for example, i have input : <input id="files" type="file" name="files[]" multiple onchange="handleFilesSelect(event)"/> And script to decode this files: window.AudioContext = window.AudioContext || window.webkitAudioContext; var context = new window.AudioContext(); var sources = []; var files = []; var mixed = {}; function handleFilesSelect(event){ if(event.target.files.length <= 1) return false; files = event.target.files; readFiles(mixAudioSources); } function readFiles(index, callback){ var freader

Using WebAudio API from NodeJs

陌路散爱 提交于 2019-11-29 05:03:58
I want to use WebAudio(AudioContext) in NodeJS. However NodeJS does not support WebAudio. There is an npm for web-audio-api but it is still in alpha stage and is incomplete. So how can I use WebAudio(AudioContext) in NodeJS. Can I instantiate a chrome browser environment from NodeJS and utilize its capabilties. Is this possible? Is there any other way to do it? Please help. You can use node-webkit or app.js to use WebAudio API and talk with it with socket.io. 来源: https://stackoverflow.com/questions/25197708/using-webaudio-api-from-nodejs

Specifying codecs with MediaRecorder

匆匆过客 提交于 2019-11-29 04:34:15
How can I specify the codecs used with the MediaRecorder API ? The only option I see is for mimeType which isn't really sufficient. Cramming in the codecs in the mimeType option doesn't seem to work. var mediaRecorder = new MediaRecorder( outputMediaStream ), { mimeType: 'video/webm; codecs="opus,vp8"' } ); This results in a WebM stream with Vorbis and VP8: FFMPEG STDERR: Input #0, matroska,webm, from 'pipe:': Metadata: encoder : QTmuxingAppLibWebM-0.0.1 Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0(eng): Video: vp8, yuv420p, 640x360, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 1k tbn, 1k tbc

WebKit equivalent to Firefox's “moz-chunked-arraybuffer” xhr responseType

孤街浪徒 提交于 2019-11-29 01:14:08
I would like to read an MP3 stream (from icecast, to read ICY metadata an then pass the binary MP3 data to a Web Audio Api). Firefox has a "moz-chunked-arraybuffer" xhr responseType to read data on progress, but I can't find any equivalent for webkit / chrome. EDIT 2014/02/03 : Chrome has started implementing xhr.responseType "stream" The "parsing" is landed in Chrome (with the --enable-experimental-webkit-features flag) but the xhr.response resulted object (Stream) is not yet useable directly in Javascript : https://code.google.com/p/chromium/issues/detail?id=240603 EDIT 2014/07/10 : The spec

Playing PCM stream from Web Audio API on Node.js

别说谁变了你拦得住时间么 提交于 2019-11-29 00:28:43
问题 I'm streaming recorded PCM audio from a browser with web audio api. I'm streaming it with binaryJS (websocket connection) to a nodejs server and I'm trying to play that stream on the server using the speaker npm module. This is my client. The audio buffers are at first non-interleaved IEEE 32-bit linear PCM with a nominal range between -1 and +1. I take one of the two PCM channels to start off and stream it below. var client = new BinaryClient('ws://localhost:9000'); var Stream = client.send(

Is there a way get something like decibel levels from an audio file and transform that information into a json array?

荒凉一梦 提交于 2019-11-28 20:56:15
So that I can use the information to coordinate a page animation like making elements brighter as the decibel levels get higher Kevin Ennis This approach will work in Chrome / Safari: +function(){ var ctx = new AudioContext() , url = 'https://cf-media.sndcdn.com/OfjMZo27DlvH.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vT2ZqTVpvMjdEbHZILjEyOC5tcDMiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE1MTUwNDM5Njd9fX1dfQ__&Signature=FfmL2qUssAKs3Z7EPoYo0Yq8-SAg8rKLPs65EasXwuVkfsOB4joFqeCvVR2elpaG-lJaV4hXpXFiRCDWXNOYyAtO4Oz~sexiPwIoSk8