Selecting audio output device

#1

hi,

my app contains a number of ofVideoPlayers and i would like to route their audio output to a specific (non-default) audio device. what would be the simplest way to do this? can i route all the audio coming from my app or do i need to route each ofVideoPlayer separately?

#2

What OS are you working on? The task you have in mind may be impossible, depending on the underlying architecture of the audio system and drivers (and the soundcard hardware).

cheers
Davide

#3

i’m on macOS. selecting the audio device to use seems like such basic functionality though, on any platform, that i would be surprised if it was impossible.

i’m looking at ofSoundStream, which has some relevant code, but i’m not familiar enough with OF’s audio architecture to determine if/how i can apply it to do what i want…

#4

Selecting the audio device is easy enough (though it may need some platform specific call) but my doubt was on the possibility of selecting different outputs for different players in the same application, or for different applications. Usually the output is set at the OS level and is shared by all apps running in a given moment. But I may be wrong about this, it would interesting to know if it is indeed possible

#5

I have used a kind of dirty trick to achieve this. If you make your movie files with 7.1 audio, so 8 tracks, you can configure your computer to output 8 discreet audio tracks, so four stereo pairs. The trick I did was to have silent audio on 6 of the 8 tracks and a stereo mix on two. By shifting the tracks with the actual audio on different video files you can have some movies play audio from outputs 1&2, some from 3&4, some from 5&6 and some from 7&8. Furthermore, if you are using multiple sound cards you can create an aggregate device using the audio midi setup utility that will bundle several sound cards into a single device.

You can do the same on windows, except for the aggregate device part, which you do with another software.

Instructions on aggregate devices can be found here: http://donyaquick.com/recording-from-multiple-devices-on-mac-and-windows/

I only used prores codec on OSX and AVI on windows (virtual dub will help you add the 7.1 audio track to the video files on windows and quicktime 7 will let you do this on Mac, or you can export them with the correct channels and mapping from a video editing software).

Maybe not the solution you were looking for but it can solve your problem.

If the movies do not need to play at the same time and you have a soundcard with a good routing utility like an rme fireface you can actually route audio to different outputs by controlling the sound cards routing via midi or osc.

1 Like
#6

that’s a good trick, thanks for sharing! my use case is actually a lot simpler though. :sweat_smile: let me elaborate a bit now that i’ve had some sleep…

i have multiple ofVideoPlayers that are totally independent of each other. i want to take their combined audio output (stereo mix) and feed it into SuperCollider for some further processing, via the Soundflower virtual audio interface.

however, due to some other inflexible apps, my system’s default audio output needs to be set to my actual physical audio interface rather than Soundflower. so really all i need is the ability to make OF output to Soundflower instead of the system default. there is no other audio coming from my OF app, so it’s fine if i can just route the master output.

#7

I would try loopback instead of soundflower, it may help with the stubborn apps that will not route to it. From there loopback has the flexibility you need to solve most problems. Alternatively, if you have an external sound card you can always use an actual cable (apple computers headphone jack is also a digital port so no need to lose quality) and plug the output of your Mac into the input of an external soundcard.