Sound Output Device and setting it

Fellow Scholars

I return from my travels in the 3d valley beyond and tremble before you, this time with a sound question from afar!

I would like to change the audio output device Babylon is using. If the user switches their audio device, the user might also switch preferred audio device, so I’d like to update it; I was doing this with an HTML5 audio element and setSyncId, but switching to Babylon Sound class to get some positional audio has thrown this hurdle in my way.

I did have a source code snoop, 119 I thought was a win, but if I’m right, we’re just using the audio element created to interrogate capabilities. The internal HTMLElement _hostElement is just the sound Icon in the top left.

Any advice folks?

A Traveled Potato

I have no faen clue but just wanted to say that I absolutely luv your posts. The writing is always so creative and humble, it’s just a delight to read :smiling_face_with_three_hearts: I hope that despite of the numereous issues you are facing (we are all facing :wink:) you project is making progress? I’m really eager to see the result of your travels in the valley of 3D (and its cumbersome aspects :grin:). Meanwhile, have a great day.

@RaananW Probably you are the best person to answer this question, are you/will you? :wink: Thanks :hugs:

dawwwwww Thank you @mawa, you can find some progress over at @betta_teams

I’m still working on the audio challenge, my feeling(from what I’ve read on the forum) is that the whole audio engine is due for some BJ6.0 love, but that will not stop me. I had some really weird spatial sound issues, some other folks eluded to having the same ones(audio choppy, cutting out, funny stepping).

I think the stepping is to do in part with the polling frequency, so if someone is running away from you and you’re polling vectors of everything in the scene @ 500ms the audio stepping is pretty abrupt at half-second intervals.

Tried google resonance, but I don’t think that’s quite what I’m after; not enough control, and howl doesn’t look like it supports media streams, so I’m just going to have a look at hacking that in. In fairness, I probably misunderstood the whole cone thing so I will take another look today.

Micropig update:

The setSinkId sage continues to this day, but its pretty active, looks close

I think the way to do this is to use a MediaStreamAudioDestinationNode, take the master gain node and connect it to the new mediastreamnode, and then connect the stream to an HTMLAudio element and setSinkId…or something like that, I’m fresh off the potato boat when it comes to web audio APIs

1 Like

Hello fellow traveler!

There are a lot of fingerprinting issues when it comes to selecting audio devices. The Audio Output Devices API does define the wonderful method selectAudioOutput (Audio Output Devices API), but it is not really available in any browser. setSinkId is the way to go…