Forum

VVVV.Audio Windows System Audio Support (WASAPI)

Due to popular demand VVVV.Audio now supports WASAPI, the latest windows audio driver model and the only system audio driver model that supports latencies low enough for music visualization with live input. Except for ASIO of course, which allows even lower latencies and has better performance, but needs third party drivers.

The good thing under Windows 10 is that for a while (if you did all updates) the latency setting of WASAPI devices is on lowest by default.

WASAPI is also the only driver model that allows having a loopback device for every audio output endpoint.

That means that you can now get the current sound playing in windows as an audio input. And that other applications can still use the same audio device.

However, there is one thing you have to take care of since VVVV.Audio doesn’t do any resampling: The sample rate of the selected input must match the sample rate of the output device. The AudioEngine node has an output that lists all WASAPI devices and their sample rates.

Download:
VVVV.Audio_AnyCPU_V19_preview.zip

Important: Make sure that you delete all occurrences or VVVV.Audio.Core.* and NAudio.* files from the vvvv installation folder before trying the new pack.

and here is a test patch:
WasapiDebug.v4p (20.6 KB)

Let me know whether it works and especially what doesn’t.

7 Likes

just did a quick test and could not get it to work. AudioEngine node stays red and TTY shows this exception:

00:00:23 ERR : Exception occurred during creation of plugin: The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.
1) Method not found: 'Boolean NAudio.CoreAudioApi.MMDeviceEnumerator.HasDefaultAudioEndpoint(NAudio.CoreAudioApi.DataFlow, NAudio.CoreAudioApi.Role)'.

 Resulting in: An exception occurred while calling the 'OnImportsSatisfied' method on type 'VVVV.Nodes.AudioEngineNode'.

Resulting in: Cannot activate part 'VVVV.Nodes.AudioEngineNode'.
Element: VVVV.Nodes.AudioEngineNode -->  VVVV.Nodes.AudioEngineNode -->  TypeCatalog (Types='VVVV.Nodes.AudioEngineNode').

Resulting in: Cannot get export 'VVVV.Nodes.AudioEngineNode (ContractName="VVVV.PluginInterfaces.V1.IPluginBase")' from part 'VVVV.Nodes.AudioEngineNode'.
Element: VVVV.Nodes.AudioEngineNode (ContractName="VVVV.PluginInterfaces.V1.IPluginBase") -->  VVVV.Nodes.AudioEngineNode -->  TypeCatalog (Types='VVVV.Nodes.AudioEngineNode').

Resulting in: Cannot set import 'VVVV.Hosting.IO.PluginContainer.PluginBase (ContractName="VVVV.PluginInterfaces.V1.IPluginBase")' on part 'VVVV.Hosting.IO.PluginContainer'.
Element: VVVV.Hosting.IO.PluginContainer.PluginBase (ContractName="VVVV.PluginInterfaces.V1.IPluginBase") -->  VVVV.Hosting.IO.PluginContainer

did a fresh install of b39 x64 + addonpack (nothing else) to verify if there is not an NAudio install i overlooked somewhere.

then there is some old NAudio.dll floating around in your vvvv folder or packs? did you delete all of them, including all VVVV.Audio.Core files?

true - found two instances of naudio and vvvv.audio.core in

  • lib/core
  • lib/nugets/vl.corlib…

and a third in

  • VVVV.Audio\girlpower\plugins\VAudioOSCTester\bin\Dynamic

removing them makes it work nicely.

this is really awesome, thanks a lot tebjan! finally audio loopback without additional tools - this makes audiohandling so much easier.

2 Likes

Very excited about this, thought you were dead set on keeping it ASIO only :)

Loopback and non-exclusive mode allowing all system sounds to work should be very nice. Seems there is also an exclusive mode for WASAPI which could yield similar latencies to ASIO4ALL while staying with stock drivers.

I tested it out but unfortunately can’t get it to work though. Removed the extra NAudio.dll like motzi but the AudioEngine node is still red and this keeps filling the TTY:

00:00:24 ERR : Exception occured in TMPluginWrapperNode.Evaluate
00:00:24 ERR : Method not found: 'Void VVVV.Audio.AudioEngine.ChangeDriverSettings(System.String, System.String, Int32, Int32, Int32, Int32, Int32)'.

@domj

it seems you didn’t delete the VVVV.Audio.Core files.

You are of course correct, now works perfectly. Vvvvery cool.

Found one problem: Gist node crashes vvvv now (When WASAPI driver is used)

1 Like

Thanks for finding this bug, will fix it for the next version.

it also crashes when the sample rate is not set to 44.1 khz, even in asio

@microdee cannot confirm crashes with other samplerates than 44.1. lots of exceptions though when changing drivers…

@tonfilm the new hybrid Audioengine node providing access to ASIO and WASAPI is a little confusing from a usability point of view. even when ASIO drivers are selected, the WASAPI pins (inputdevices and deviceinfos) stay visible/selectable. especially beginners will be confused by the fact, that for ASIO there is only a driver selection while for WASAPI the driver sets the outputs and there is a separat input pin.
as a solution one could consider to have two versions (audioengine (vaudio.asio) and audioengine (vaudio.wasapi)) or just hide the wasapi pins when selecting an asio driver.

just a thought…

1 Like