web-audio-api

How can I extract the preceding audio (from microphone) as a buffer when silence is detected (JS)?

ぐ巨炮叔叔 提交于 2019-11-28 07:33:14
I'm using the Google Cloud API for Speech-to-text, with a NodeJS back-end. The app needs to be able to listen for voice commands, and transmit them to the back-end as a buffer. For this, I need to send the buffer of the preceding audio when silence is detected. Any help would be appreciated. Including the js code below if (!navigator.getUserMedia) navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia; if (navigator.getUserMedia) { navigator.getUserMedia({audio: true}, success, function (e) { alert('Error

HTML5 web audio - convert audio buffer into wav file

醉酒当歌 提交于 2019-11-28 07:00:01
I have an audio buffer rendered using webkitOfflineAudioContext . Now, I wish to export it into a WAV file. How do I do it? I tried using recorder.js but couldn't figure out how to use it. Here's my code: http://jsfiddle.net/GBQV8/ . Here's a gist that should help: https://gist.github.com/kevincennis/9754325 . I haven't actually tested this, so there might be a stupid typo or something, but the basic approach will work (I've done it before). Essentially, you're going to use the web worker from Recorder.js directly so that you can process one big AudioBuffer all in one shot, rather than

Create a waveform of the full track with Web Audio API

我怕爱的太早我们不能终老 提交于 2019-11-28 04:45:28
Realtime moving Waveform I'm currently playing with Web Audio API and made a spectrum using canvas. function animate(){ var a=new Uint8Array(analyser.frequencyBinCount), y=new Uint8Array(analyser.frequencyBinCount),b,c,d; analyser.getByteTimeDomainData(y); analyser.getByteFrequencyData(a); b=c=a.length; d=w/c; ctx.clearRect(0,0,w,h); while(b--){ var bh=a[b]+1; ctx.fillStyle='hsla('+(b/c*240)+','+(y[b]/255*100|0)+'%,50%,1)'; ctx.fillRect(1*b,h-bh,1,bh); ctx.fillRect(1*b,y[b],1,1); } animation=webkitRequestAnimationFrame(animate); } Mini question: is there a way to not write 2 times new

HTML5 Microphone capture stops after 5 seconds in Firefox

耗尽温柔 提交于 2019-11-28 02:37:42
问题 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 ||

Using WebAudio API from NodeJs

独自空忆成欢 提交于 2019-11-27 18:52:19
问题 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. 回答1: You can use node-webkit or app.js to use WebAudio API and talk with it with socket.io. 来源: https://stackoverflow

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

感情迁移 提交于 2019-11-27 15:43:51
问题 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

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

天大地大妈咪最大 提交于 2019-11-27 13:18:42
问题 So that I can use the information to coordinate a page animation like making elements brighter as the decibel levels get higher 回答1: This approach will work in Chrome / Safari: +function(){ var ctx = new AudioContext() , url = 'https://cf-media.sndcdn.com/OfjMZo27DlvH.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vT2ZqTVpvMjdEbHZILjEyOC5tcDMiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE1MTUwNDM5Njd9fX1dfQ__&Signature

Web Audio API append/concatenate different AudioBuffers and play them as one song

旧时模样 提交于 2019-11-27 10:52:31
问题 I've been playing with the Web Audio API and I'm trying to load multiple parts of a song and append them to a new ArrayBuffer and then use that ArrayBuffer for playing all the parts as one song. In the following example I am using the same song data (which is a small loop) instead of different parts of a song. The problem is that it still plays just once instead of two times and I don't know why. Download song function init() { /** * Appends two ArrayBuffers into a new one. * * @param

Web Audio API, get the output from the soundcard

六眼飞鱼酱① 提交于 2019-11-27 06:56:34
问题 Can it be done? If so, any information on the subject is greatly appreciated. (If not with the Web Audio API, is there some other API that lets me achieve this?) 回答1: Derek is correct. If You have a realtek card (I don't know about support from other manufacturers) You set it to stereo mix, and set the stereo mix to default microphone. You can then create a source node linked with your mic using navigator.getUserMedia .. Google and You Will find it. I just made a fiddle for you: Audio from

How to get Orientation of Camera in THREE.js

被刻印的时光 ゝ 提交于 2019-11-27 04:31:24
问题 I am creating a 3d game using THREE.JS and the Web Audio API. One of the problems I am having is that I want to use the web audio Listener orientation, and define the listener to be the camera, whose position and direction are constantly being updated My question, is there anyway to easily get the vector direction of a THREE camera? I was trying to calculate it by using the old camera position, and using the velocity vectors to calculate which way it is facing, but this won't work when the