web-audio-api

HTML5 Audio API inputBuffer.getChannelData to audio Array buffer

北慕城南 提交于 2019-12-10 11:01:50
问题 I am making an application where I am taking mic data from the inputBuffer and I want to stream to another client and play it. However, I cannot get it wokring. My recording/capturing works fine so I will skip to relevant parts of the code function recorderProcess(e) { var left = e.inputBuffer.getChannelData(0); var convert = convertFloat32ToInt16(left); window.stream.write(convert); var src = window.URL.createObjectURL(lcm); playsound(convert); ss(socket).emit('file',convert, {size: src.size

Safari 6.0.2 not calling onaudioprocess

杀马特。学长 韩版系。学妹 提交于 2019-12-10 10:24:20
问题 I've earlier successfully used the JavaScriptAudioNode in the Web Audio API to synthesize and mix audio both in Chrome and Safari 6.0. However, the latest version of Safari no longer appears to work, because it does not call onaudioprocess to fill the source buffers. This is a simplified example which plays only silence and appends text to the document body on each call to onaudioprocess : <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>

Send MediaStream object with Web Audio effects over PeerConnection

浪子不回头ぞ 提交于 2019-12-10 08:52:16
问题 I'm trying to send audio, obtained by getUserMedia() and altered with the Web Audio API, over a PeerConnection from WebRTC. The Web Audio API and WebRTC seem to have the ability to do this but I'm having trouble understanding how this can be done. Within the Web Audio API, the AudioContext object contains a method createMediaStreamSource() , which provides a way to connect the MediaStream obtained by getUserMedia(). Also, there is a createMediaStreamDestination() method, which seems to return

Detect if a MIDI interface is connected in Web MIDI API

时间秒杀一切 提交于 2019-12-09 18:40:44
问题 I am experimenting with the Web Midi API in Chrome/OS X. So far I get good results but I am wondering: Is there a way to detect if a MIDI interface is connected/disconnected WHILE an application is running? The way it works for now is to restart the browser to let the application know that an interface is present or not ... There seems to be a MIDIAccess onconnect / ondisconnect event but I don't know what to do to make them fire. Is this implemented yet in Chrome (Canary)? 回答1: The current

Choppy/inaudible playback with chunked audio through Web Audio API

穿精又带淫゛_ 提交于 2019-12-08 23:17:52
问题 I brought this up in my last post but since it was off topic from the original question I'm posting it separately. I'm having trouble with getting my transmitted audio to play back through Web Audio the same way it would sound in a media player. I have tried 2 different transmission protocols, binaryjs and socketio, and neither make a difference when trying to play through Web Audio. To rule out the transportation of the audio data being the issue I created an example that sends the data back

Javascript Web Audio API AnalyserNode Not Working

岁酱吖の 提交于 2019-12-08 19:22:35
The code is supposed to stream any url and provide a visualization of the audio. Unfortunately, the visualizer is not working. The visualization relies on the data from the AnalyzerNode, which is always returning empty data. Why doesn't the AnalyserNode in this code work? The numberOfOutputs on the source node increases after I .connect() them, but the numberOfInputs on the AnalyserNode does not change. <html> <head> <script> var context; var source; var analyser; var canvas; var canvasContext; window.addEventListener('load', init, false); function init() { try { // Fix up for prefixing window

Web Audio API: How do I play a mono source in only left or right channel?

▼魔方 西西 提交于 2019-12-08 18:46:45
问题 Is there an (easy) way to take a mono input and play it only in the left or right channel? I'm thinking I can do it through the ScriptProcessing node, but if there is a node meant to handle this situation I'd really like to know. The API has a section on mixing, but I don't see any code on how to manipulate channels yourself in this fashion. Note, I have tried the panner node, but it doesn't seem to really cut off the left the from the right channel, I don't want any sound bleeding from one

WAVE file extended part of fmt chunk

烈酒焚心 提交于 2019-12-08 15:45:00
I have a WAVE file with a wFormatTag that is 3 ( WAVE_FORMAT_IEEE_FLOAT ). Firefox treats WAVE_FORMAT_IEEE_FLOAT files like WAVE_FORMAT_EXTENSIBLE , which means that it expects that a WAVE_FORMAT_IEEE_FLOAT file contains the extended part of the fmt chunk. My file doesn't contain the extended part of the fmt chunk, which results in an error when decoding the file in Firefox: The buffer passed to decodeAudioData contains invalid content which cannot be decoded successfully. This means I have to add wValidBitsPerSample at byte 38, dwChannelMask at byte 40 and SubFormat at byte 44. What

Extracting audio data every t seconds

我的未来我决定 提交于 2019-12-08 13:04:34
问题 I am trying to extract amplitude information from a sound loaded from a URL using the Web Audio API instantaneously (not in real time), which will likely require the OfflineAudioContext . I am expecting to obtain something along the lines of an array containing the amplitude of the sound every t seconds for the duration of the sound (with size depending on the duration of the sound, divided by t ). Unfortunately, documentation is sparse at this point, and I'm unsure of how to proceed. How can

Using Web Audio API to assign two sounds to two Divs and play each independently via a click event with javascript

放肆的年华 提交于 2019-12-08 12:33:24
问题 I have been picking away at the code linked in the url below and I haven't been able to get anywhere. I have only managed to reassign the event handler to a small div instead of the whole page. I can't figure out how to tweak this to load more than one sound. http://www.f1lt3r.com/w3caudio/web-audio-api/basic-examples/low-latency-playback-user-input.html With the code example below I haven't been able to trigger a sound via a click of a div at all. However this code seems nicer to look at so