web-audio-api

Can I stream microphone audio from client to client using nodejs?

偶尔善良 提交于 2019-12-04 20:55:01
问题 I'm trying to create a realtime voice chat. once a client is holding a button and talks, I want the sound to be sent over the socket to the nodejs backend, then I want to stream this data to another client. here is the sender client code: socket.on('connect', function() { var session = { audio: true, video: false }; navigator.getUserMedia(session, function(stream){ var audioInput = context.createMediaStreamSource(stream); var bufferSize = 2048; recorder = context.createScriptProcessor

How to set position correctly in SoundJS for Firefox, IE

我是研究僧i 提交于 2019-12-04 18:28:47
I'm trying to use SoundJS to play sn mp3 file and seek to a specific position. I'm using: instance.setPosition(10000); which works correctly in Google Chrome. But in Mozilla Firefox I hear the sound playing from the correct position, and a second instance of the sound also playing from another position. In Internet Explorer, the sound starts playing again from the beginning. Here's a jsFiddle (with autoplaying sound) and here is the complete javascript: createjs.Sound.registerPlugins([createjs.WebAudioPlugin, createjs.HTMLAudioPlugin, createjs.FlashPlugin]); createjs.Sound.addEventListener(

Firefox WebAudio createMediaElementSource not working

两盒软妹~` 提交于 2019-12-04 18:13:07
问题 Im using the WebAudio API with new Audio() object as a source. The following is a simplified version of what i am doing. This however, doesnt play any sounds in firefox 25.0.1. var context; if(window.webkitAudioContext) { context = new webkitAudioContext(); } else { context = new AudioContext(); } var audio = new Audio(); // This file does seem to have CORS Header audio.src = "http://upload.wikimedia.org/wikipedia/en/4/45/ACDC_-_Back_In_Black-sample.ogg"; var source; function onCanPlay() {

Cracks in webaudio playback during streaming of raw audio data

走远了吗. 提交于 2019-12-04 13:56:13
I have a server sending chunks of raw audio over a websocket. The idea is to retrieve those and play them in a way to have the smoothest playback possible. Here is the most important piece of code: ws.onmessage = function (event) { var view = new Int16Array(event.data); var viewf = new Float32Array(view.length); audioBuffer = audioCtx.createBuffer(1, viewf.length, 22050); audioBuffer.getChannelData(0).set(viewf); source = audioCtx.createBufferSource(); source.buffer = audioBuffer; source.connect(audioCtx.destination); source.start(0); }; This works decently well, but there are some cracks in

How to disable Web-Audio analyzer filtering high frequencies

↘锁芯ラ 提交于 2019-12-04 13:12:11
I am studying the html5 audio API. I have noticed the analysis module has problems processing high frequencies. It is as if there is a build in filter in it. For example, if I emitting a 20Khz tone and plot the outcome of getFloatFrequencyData I see the following spectrum: However, if I use Audacity, the same signal looks like this: (notice the peak @ 20khz) Can I disable the built in filter of the analysis model? p.s. the sampling rate is high enough according to the context canvas so I would not suspect aliasing problems. @cwilso has it, the input is filtered by default, you need to pass a

preloading the next song in a playlist a bit before the current one ends

こ雲淡風輕ζ 提交于 2019-12-04 12:40:40
I've made a small media player that works fine but I want to make it so that there's no more loading in between each songs I know about the preload property but it only preloads the music when the page loads for the first time, so I feel like this wont work is there a way to do this at all? maybe using the web audio API? When you start playing a song you could watch the play event of the audio and already start preloading the next song in the queue. This is the function I use for preloading audio, you can use it any time, not only in the first time the page being loaded: function preloadAudio

<audio> tag to audioBuffer - is it possible?

流过昼夜 提交于 2019-12-04 10:18:51
My javascript-webApp first reads a short mp3 file and finds silence-gaps in it (for navigational purposes), then it plays the same mp3 file cueing it to start where one silence or another finishes. This differs from the usual webAudio scenario designed to grant access to audio data currently being played in the stream (not to the whole track). To get my webApp to work I have to read/access the mp3 file twice : via XMLHttpRequest to read an entire MP3 file and put it in to an audioBuffer that I can subsequently decode using audioContext.decodeAudioData() - as explained here: Extracting audio

Ask for microphone on onclick event

淺唱寂寞╮ 提交于 2019-12-04 10:03:10
The other day I stumbled upon with this example of a Javascript audio recorder: http://webaudiodemos.appspot.com/AudioRecorder/index.html Which I ended up using for implementing my own. The problem I'm having is that in this file: var audioContext = new webkitAudioContext(); var audioInput = null, realAudioInput = null, inputPoint = null, audioRecorder = null; var rafID = null; var analyserContext = null; var canvasWidth, canvasHeight; var recIndex = 0; /* TODO: - offer mono option - "Monitor input" switch */ function saveAudio() { audioRecorder.exportWAV( doneEncoding ); } function drawWave(

AudioContext.createMediaStreamSource alternative for iOS?

末鹿安然 提交于 2019-12-04 09:19:01
I've developed an app using Cordova and the Web Audio API, that allows the user to plug in headphones, press the phone against their heart, and hear their own heartbeat. It does this by using audio filter nodes. //Setup userMedia context = new (window.AudioContext||window.webkitAudioContext); navigator.getUserMedia = (navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia); navigator.getUserMedia( {audio:true}, userMediaSuccess, function(e) { alert("error2 " + e.message); }); function userMediaSuccess(stream) { //set microphone as input

How to seamlessly loop sound with web audio api

半世苍凉 提交于 2019-12-04 08:28:24
I can't find a clear answer to this question anywhere. I'm looking for the easiest way to seamlessly loop a .wav file automatically on document load in chrome. It seems that the webaudio api is the best practice, but I can't find simple documentation. Support for safari and others would be great too but not as important. I have looked at the w3.org example but it didn't help I think this is the closest to what I want besides the on.click for the buttons: https://forestmist.org/blog/web-audio-api-loops/ here i implemented the forestmist for my own audio which works perfectly in safari but stops