Multiple sound card output under Windows with Liquidsoap - internet-radio

Is it possible to output to multiple sound cards under Windows?
It seems that portaudio is the only way to play back through a sound card with Windows, but portaudio offers no mechanism for choosing which device to output to. Even if it did, it isn't clear that it would be possible to open multiple outputs.
Currently, I'm using a hack using VLC to output to the sound cards:
output.external(
%mp3(bitrate=320,stereo_mode="stereo"),
'"C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe" -vvv --config C:\vlc\vlcrc-remote1 -',
remote1
)
output.external(
%mp3(bitrate=320,stereo_mode="stereo"),
'"C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe" -vvv --config C:\vlc\vlcrc-remote2 -',
remote2
)
Each VLC profile has a different sound device set by default. Obviously this could be improved by switching to PCM, but if I can simply skip the whole external process issue completely, that would be great.

This is probably too late now...
Having been searching for this for a all night (several hours) and delving into the source code for PortAudio and Liquidsoap, I have established that LS utilises Pa_OpenDefaultStream() to open one stream only. It is not possible through LS' interface to pass a PA ID to input or output.portaudio. It will always default to device 0 which is the sound mapper (Windows default device).
However, all is not lost, in order to tell PortAudio which input/output to use, you can pass an environment variable before running LS:
set PA_RECOMMENDED_OUTPUT_DEVICE=x
set PA_RECOMMENDED_INPUT_DEVICE=x
Where x is a PA device reference. To find your device references you need a copy of pa_devs.exe (I found a copy here http://www.w1hkj.com/alpha/temp/pa_devs.exe) which when ran generates results.txt. This file contains the IDs you need. You can also get the IDs with Audacity by selecting Help>Audio Device Info.
So you could in theory do multiple outputs like this:
setenv("PA_RECOMMENDED_OUTPUT_DEVICE","13")
streamout1 = output.portaudio()
setenv("PA_RECOMMENDED_OUTPUT_DEVICE","14")
streamout2 = output.portaudio()
I don't know for definite if this will work but it's worth a go! If it doesn't work, you could always run two liquidsoap instances in different settings if this would work for your application.

Related

program to know list of attached devices to my linux laptop

I am writing a small apllication that will tell list of attached devices to my linux laptop.There is one utility that is udev that can be used for hot plugging but is their some other way where i can write simple c program where it will tell that these devices are attached to your laptop.or it will pop up message when new devices will be attached and removed.please provide some basic stuff so that i can start my project.thanx in advance.
As far as I can see, there are two parts to your question. I will answer them separately.
Get a list of current devices
Your source of information would be /sys/ and proc and their sub directories. You can get most information by simply reading the appropriate file from here. For example, trying running utilities such as lsusb using strace and see what files they access - you will see it reads /sys/devices. Also look at lshw and it's source code.
Notification of hardware events
This is where udev comes in. Here are couple of articles I came across they may be helpful:
http://www.signal11.us/oss/udev/
http://www.reactivated.net/writing_udev_rules.html

Recording Audio Output from a Specific Program on Windows

Is there any way to record the sound output of a specific program on Windows? I already have a solution that uses WASAPI's loopback device to record all audio output to the speakers, but I would prefer to be able to record only the audio output of a specific program and ignore everything else. I assume this is possible using a virtual audio device, but I would like to avoid something so complicated if possible.
According to this post (which is very interesting in itself), there's a program called
Virtual Audio Cable which might do the trick for you....
Virtual Audio Cable will do what you already mentioned when you said it captures all audio sent to it.
You can a Virtual Line to be the default and then record that Virtual Line. You can Not select a specific program to do such a thing.
I have made a tutorial for using it.
https://www.youtube.com/watch?v=WUQmkgw8Pjg
I use it to play music from youtube through my "mic" while playing games.
On Windows 10, You may check here, which use ActivateAudioInterfaceAsync Win32 API ; "Note that this sample requires Windows 10 build 20348 or later."

Get available X11 video modes without extensions

I've been searching around and can't find a solution for this. The official NVIDIA Tegra 2 Linux SDK (L4T) doesn't include both XRandR or the VideoMode X11 extension for querying available video modes. My next thought was to parse the log file for video modes. Of course most of the time it's at /var/log/Xorg.0.log but I'd rather not always make that assumption. The XF86misc extension provides a way to get the log path but that extension is also not installed by default.
So I'm wondering if anyone knows of any other way to figure out what video modes are available and also what the current video mode of the display is.
The core X protocol does not mention modes. You have to use extensions. There's nothing wrong with that, that's what extensions are for.
Also, remember that there's no guarantee that the machine you're displaying on is the same machine as you're running on, so parsing the X log file is destined to fail if your app ever runs across the network.

HAL - how to monitor audio output on a mac

There is an application called wiretap available at
http://www.ambrosiasw.com/utilities/wiretap/
This application can record the system audio. I would like to be able to do the same in my program. Any insights on what I need to do this? I am familiar with Core Audio but havent found anything on how to do this.
would this help getting the answer? I entered the command line: ioreg -w0 -l | grep io |more
this is what I found aboud wiretap....there might be more related info close to where i found it:
+-o com_AmbrosiaSW_AudioSupport <class com_AmbrosiaSW_AudioSupport, registered, matched, active, busy 0, retain 4 >
"CFBundleIdentifier" = "com.AmbrosiaSW.AudioSupport"
"IOMatchCategory" = "com_AmbrosiaSW_AudioSupport"
"version" = 2
"IOClass" = "com_AmbrosiaSW_AudioSupport"
yan-bellavances-mac-mini:~ ybellavance$ ioreg -w0 -l | grep io |more
The short answer is no, unless you have connections and/or are really experienced/talented (i'm new to mac dev). Guess i'm gonna use the audioEngine example in the Darwin open source section.
Here is the answer I got from Jeff Moore at core-audio mailing list:
"There is no API for doing this, just various hacks/work-arounds that
folks have come up with. The most straight forward way would be to
write a fake driver to do what you want. Soundflower and JACK would be
good examples of this approach. Soundflower uses a kernel driver while
JACK uses a user-land driver.
Folks are clever and have come up with other ways to do it as well.
But I'll let them speak for themselves if they are inclined to share
their techniques. At any rate, you might want to start your education
on this by reading the list archives as this topic comes up on a
regular basis."
Another similar opensource tool is SoundFlower. This tool works by registering as an audio output device. Instead of being a physical device, it is just a virtual output device, that forwards to other devices, or back to the inputs.
This is one strategy for recording system audio output -- appear as an audio output device, and have the system play through this virtual device. In addition to recording the audio, you could also forward it on to the speakers to appear transparent. You could use SoundFlower as an example if you're interested in pursuing this route.

DirectSound/FFDShow without a Sound Card

I've got an application that uses DirectShow/DirectSound which plays videos and extracts the video/sound. Running it on a server without a soundcard means the audio cannot be grabbed, is there a way around this? I look briefly at Virtual Audio Cable 4 but that doesn't seem to emulate a soundcard over a terminal session..
The tricky part of this is that it's running on x64 so i maybe somewhat limited..
Cheers
VAC does do the trick but it's somewhat limited in that it doesn't work when you connect to the server through a RDP session.
For the moment I've worked around the issue by starting the process over VNC...
I haven't tested, but, make sure you set the "RDP -> option -> local resources -> remote computer sound" to "live at remote computer" otherwise you can't find any audio randers.

Resources