Windows, How to map output device to spectral monitor

I am having trouble on windows specifically in just adding a spectral monitor to the speakers audio.

I am not generating audio, I just want to get the output from whatever is playing on the machine. In linux this has been fine, as speakers are seen as input devices as well.
But so far on windows, I can not figure out how to pipe the output node into a spectal monitor, or any monitor for that matter.

The input analyzer example crashes when it tries to find an input as well.

Any help is greatly appreciated.

I think I had a similar issue which as solved by @rich.e in this post Changin audio output

You can look a code sample I wrote for selecting audio inputs/outputs, it might help

It sounds like you are trying to capture sound not generated from your app (ie other sounds playing on the machine).

As far as I know Windows does not have native functionality for this and even on Mac OS you need to use a tool called SoundFlower (or Loopback which is paid) to do this. This allows you to set your default system audio output device to “Soundflower” and you can then listen to this device as an input in your Cinder app.

There might be windows tools to achieve this (some hardware audio interfaces even have this feature) but unfortunately this is not something that can be solved in Cinder alone.

Hope this helps.

1 Like

Thanks @xumo
I took a look at your code (I was not able to compile. I think I was using a different imgui block), but wanted to try and implement what you were showing with the ctx->disable();

However, I still get the same failure.

auto device = audio::Device::findDeviceByName("MY DEVICE");

ctx->disable();
mOutputDeviceNode = ctx->createOutputDeviceNode(device);
ctx->setOutput(mOutputDeviceNode);
ctx->enable();

////

mInputDeviceNode =  ctx->createInputDeviceNode(device);
if (mInputDeviceNode) 
{
    mInputDeviceNode->getChannelMode();
    .....///SET UP SPECTRAL NODES PER FOUND CHANNEL (0 by the way)
     //THIS IS WHERE I CRASH
    mInputDeviceNode->enable();
}

This code produces this error:

Exception thrown at 0x00007FFA8B3FA388 in Test.exe: Microsoft C++ exception: cinder::audio::msw::WasapiExc at memory location 0x0000000000149AA0.

|fatal | cinder::app::AppBase::executeLaunch[197] Uncaught exception, type: class cinder::audio::msw::WasapiExc, what: Failed to check if format is supported (HRESULT: 80070057, ‘E_INVALIDARG’)

@felixfaire
I’m a little optimistic, that surely this must not be so complicated…
Thanks again for helping out.

I tried this code and had the same error “Error Format unsupported by IAudioClient” at
input->enable(); and that’s because you are trying to initialize a input device node with a reference to an output device.
I think you can only create input node with input devices. It’s like the input node expects a “reader” and not a “writer”.

I just dug a little deeper in your example to illustrate something I just realized I misunderstood. At first I thought that you were hooking up outputs to spectral nodes…
But then found that you had mDevices separate from mAudioOutputDevices.
So it appears then that I can not connect the output to spectral then at this point. Perhaps @felixfaire is correct.