Audiolet icon indicating copy to clipboard operation
Audiolet copied to clipboard

Audio Channel routing

Open ghost opened this issue 13 years ago • 4 comments

I'd like to be able to route audio coming from Audiolet to the audio channels of the OS. I see that Audiolet has internal channels and routing capabilities, is there a way to hook into these channels using something like Soundflower?

I am working on a project that includes remixing streaming internet audio. I've hit a stumbling block at being able to access independent audio streams. Browsers send audio exclusively on channels 1 and 2 AFAIK.

Any help/ideas greatly appreciated.

ghost avatar Nov 23 '12 22:11 ghost

Hm, I think this is currently difficult - as you said the audio API implementations only allow you to send audio on channels 1 and 2. As far as I can tell multichannel output is a planned feature for the Web Audio API, but the implementations are stereo-only at the moment.

One possibility would be to create a node which chucks the audio data through a WebSocket to an application running outside the browser, which then passes that to the audio output. I have no idea whether WebSockets are up to passing that much data with any sort of reliability though, and I can only imagine that results will be flaky at best.

If I think of any better ideas I'll post them up here, but I have a feeling that this will be a matter of waiting for the implementations to work with multiple channels (at which point it will be simple to route Audiolet data to whichever channel you want).

oampo avatar Nov 24 '12 09:11 oampo

Just an update: it appears that multi-channel functionality has just been exposed! http://www.html5audio.org/2013/03/surround-audio-comes-to-the-web.html

https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#AudioDestinationNode

ghost avatar Mar 21 '13 05:03 ghost

Sorry for the late reply - I've been super busy and my brain skipped over this. Awesome news though. I've just had a quick glance through all the code concerning this and as far as I can tell it should work automagically with multi-channel output. All you need to do it give a different numberOfChannels argument when you create the Audiolet object, and set up your routing accordingly. I don't really have a good way of testing this at the moment, so YMMV. If you try it out I'd be interested to know how it goes.

oampo avatar Apr 02 '13 09:04 oampo

Can someone make a gist of how to make this work? It looks like a very desirable feature to me to be able to route your audio into external applications like a DAW.

Imagine I have this:

context = new AudioContext;
oscillator = context.createOscillator();
oscillator.frequency.value = 200;

oscillator.connect(context.destination);

oscillator.start(0);

how could I route this into soundflower and use the audio output directly somewhere outside the browser?

jenyckee avatar Dec 25 '15 12:12 jenyckee