Virtual Loopback Audio Driver for PC DSP

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
The most popular solution for a PC crossover seems to be using 2 sound cards. All sound applications output to SoundCard1. SoundCard1 routes the stream internally and makes it available at its inputs. A software that runs continuously on the PC picks up the stream from SoundCard1 and does the necessary processing. Usually that is done in a VST host that runs several plug-ins. Then the software sends the processed sound to SoundCard2 which outputs it to the amplifiers.

Media Player -> SoundCard1 -> DSP software -> SoundCard2 -> Amplifier

The hardware of SoundCard1 is not necessary, the sound stream is usually routed in the driver and never reaches the card itself. Another popular solution is the DAW Reaper. It has a very good virtual audio driver called ReaRoute and a VST host simplifying this type of work.

Media Player -> Reaper ReaRoute -> Reaper VST DSPs -> Sound Card -> Amplifier


----
It should be possible to create a standalone Virtual Loopback Audio Driver without attaching it to hardware. It could receive all audio streams, process them and transfer them to the actual Sound Card Driver to output. It can be optimized for minimum overhead and since it's a driver it will run continuously in the background. Windows comes with a Virtual Loopback Network Adapter, why not an Audio one? Does anyone here have experience with writing Audio Drivers in Windows?
 
The most popular solution for a PC crossover seems to be using 2 sound cards. All sound applications output to SoundCard1. SoundCard1 routes the stream internally and makes it available at its inputs. A software that runs continuously on the PC picks up the stream from SoundCard1 and does the necessary processing. Usually that is done in a VST host that runs several plug-ins. Then the software sends the processed sound to SoundCard2 which outputs it to the amplifiers.

Media Player -> SoundCard1 -> DSP software -> SoundCard2 -> Amplifier

The hardware of SoundCard1 is not necessary, the sound stream is usually routed in the driver and never reaches the card itself. Another popular solution is the DAW Reaper. It has a very good virtual audio driver called ReaRoute and a VST host simplifying this type of work.

Media Player -> Reaper ReaRoute -> Reaper VST DSPs -> Sound Card -> Amplifier


----
It should be possible to create a standalone Virtual Loopback Audio Driver without attaching it to hardware. It could receive all audio streams, process them and transfer them to the actual Sound Card Driver to output. It can be optimized for minimum overhead and since it's a driver it will run continuously in the background. Windows comes with a Virtual Loopback Network Adapter, why not an Audio one? Does anyone here have experience with writing Audio Drivers in Windows?

I wish I had seen this thread before I started on this sort of thing myself - it would have saved me a lot of head scratching wondering if I was alone in thinking of this as a problem!

I can't quite get my head around the idea of using two sound cards, without there being a problem, somewhere along the line, of their using different sample clocks and a need to resample somewhere in the system. In one experiment I used two sound cards, but went from one to the other via SPDIF - Creative cards are happy to resample from any sample rate to any other, but it's not 'bit perfect'. I also considered removing the crystal from one card and locking its sample master clock to that of the other - I have no reason to think this would not work.

I notice that in the release notes for the commercial product Virtual Audio Cable there is a line
Clock correction precision increased to 0.0000001% (1E-8%).

suggesting that in order to do what it does (very cleverly), it has to do some form of clock matching, implying re-sampling and/or jitter of some kind? (I know that it will be utterly, utterly inaudible, but some posters on here manage to instil in me a fear of any deviation from 'bit-perfect'-ness). I wish I had known of Reaper's ReaRoute as well.

But it turns out that the Creative X-Fi card, at least, will allow you to pick up a stream from it, process it, and route it to the outputs, all locked together and 'bit perfect'. I'm happy to work with that for the time being.
 
Maybe I am wrong but I was under the impression that jitter is strictly a DAC related hardware clock issue. All processing that happens before the DAC would be irrelevant because it's buffered and processed frame-by-frame.
There is of course a problem with resampling but we could do all processing at the sampling rate of the source and if we need to, resample right before the DAC.
 
Maybe I am wrong but I was under the impression that jitter is strictly a DAC related hardware clock issue. All processing that happens before the DAC would be irrelevant because it's buffered and processed frame-by-frame.
There is of course a problem with resampling but we could do all processing at the sampling rate of the source and if we need to, resample right before the DAC.

Maybe wrongly, I was thinking along the lines of there being two types of re-sampling. One is a straightforward file conversion from 44.1 kHz to 48 kHz for example. But another is where I have to do it on a real time stream, and go from 44.098-ish to 44.101-ish kHz, having to measure the relative sample rates in real time and prevent a buffer from emptying or filling excessively. My measurement errors can be suppressed by averaging, but there will always be an error in the sample rate measurement that gives a resampling error which is the direct equivalent of jitter, even if the literal jitter in timing at the DAC is zero. (Not saying it's actually going to be audible, or even measurable, however).
 
J River media center has a loopback function. It grabs the audio sent to the default soundcard (say the mobo sound), processes it, and sends it to a soundcard set within JR (in my case a firewire interface). Within its DSP section is a solid PEQ, a convolution engine, and it can host vst plugins. IMO much simpler than rearoute, vac, etc. It's quite a capable media player as well.
 
Much better is 2 PCs.;)

Surely the best solution has got to be a single sound card so no re-sampling is necessary. From my experience, the Creative X-Fi will do this, 'bit perfect' i.e. the stream being received at the input to the card can be picked up by your xover software, processed and then fed to the six or eight DAC outputs with everything locked to the same sample clock. The supplied applet allows you to disable any direct link from the input to the outputs ('Audio Creation mode').

It would be useful to know which other cards are also capable of this. However, it doesn't seem to be something that you can necessarily deduce from the cards' specs and advertising blurb. Could we assemble a list of cards which can do this?
 
It would be useful to know which other cards are also capable of this. However, it doesn't seem to be something that you can necessarily deduce from the cards' specs and advertising blurb. Could we assemble a list of cards which can do this?

All envy24-based cards with spdif input can do that physically - they can switch the clock from internal to external - the clock recovered from the spdif input stream. Of course the proprietary driver can be buggy. But it should work at least in linux.

I am not sure about usb soundcards with spdif input since the input can behave independent of the outputs, depending on the usb receiver chip. Most inputs run isochronous asynchronous (which is a must for spdif input), most outputs run isochronous adaptive - two different clock domains.
 
Surely the best solution has got to be a single sound card so no re-sampling is necessary.

Many people use now a player in the pc as their one and only source, and yes i agree with your point in this case. If it's not the case, as in my case, all this is moot, and for this reason i prefer to use a second PC as standalone DSP machine as others use a DCX or whatever, and a player PC as one of my sources . But, i admit i'm not a bit obsessed purist...:cool:
 
All envy24-based cards with spdif input can do that physically - they can switch the clock from internal to external - the clock recovered from the spdif input stream. Of course the proprietary driver can be buggy. But it should work at least in linux.

I am not sure about usb soundcards with spdif input since the input can behave independent of the outputs, depending on the usb receiver chip. Most inputs run isochronous asynchronous (which is a must for spdif input), most outputs run isochronous adaptive - two different clock domains.

Hi phofman

That isn't quite what I meant. As I understand it, this thread exists because people need to route audio from any source (SPDIF, CD, Windows media player, Spotify, Youtube) via DSP-based processing and finally out to their speakers, and it isn't immediately obvious that this is possible without resorting to two sound cards linked by SPDIF (jitter, re-sampling), or 'virtual audio cables' (re-sampling).

From my limited experience it is possible to do exactly what they need using only a single sound card and nothing else, although it isn't possible with all sound cards. I'd like to know which cards make it possible, and which don't.

The problem, as far as I can tell, is merely that the default routing of most sound cards is to connect any incoming stream internally to the analogue outputs. The Creative Audigy, for example, seems to do this unavoidably when you're using the Creative drivers. However, the open source Kx Project drivers allow you to turn off this internal routing. Unfortunately the Audigy always re-samples internally to 48kHz, reputedly not particularly well - although it sounds OK.

The more up-market Creative X-Fi can work at a variety of sample rates in 'bit perfect' mode, and its re-sampling (should that be necessary) is supposedly very, very good anyway. The card's standard drivers allow you to connect any input to any output with a sort of matrix arrangement. You can also turn off any internal routing - which is what you need for DSP processing.

Once you have turned off the sound card's internal routing, the setup for bit-perfect grief-free active crossover (in Windows at least) is as follows:

Set the Control Panel->Sounds and Audio Devices->Audio->Sound playback->Default Device to be the sound card in question. From now on, any standard media player will route its audio to the sound card's 'Wave' input, and you can also take in SPDIF or analogue line in if you want.

Set your DSP application's source to be the same sound card's input, and select whichever input you want ('Wave', SPDIF etc.) if you have the choice, or the simply the sound card's mixer as the source.

Set your DSP application's destination(s) to be the sound card's analogue outputs (or SPDIF).

You can now process any input that the sound card is capable of handling, and send your processed audio to the same sound card's outputs, locked to the same sample rate.

I must admit, this is one of situations where I'm slightly baffled as to why anyone would consider any other arrangement than this 'perfect' one, but I am also aware of the fact that some cards won't let you do it without wasting at least two of the outputs due to internal routing.

So which cards will let you do this?
 
Last edited:
So which cards will let you do this?

Most studio grade cards have an ADAT, or Toslink, or SPDIF outputs that can easily be sacrificed for loopback purposes. That what i do with an RME Fireface.

My only worry with sound cards is that whatever their performance in digital domain, the solutions they implement in the analogue domain are done on the cheap, especially for low cost units ( and sadly mine, though not cheap, also plays in that league...).

Audio is basically analogue, and that question is too often overlooked by most digital stuff designers affected by the bit perfect syndrome.
 
Last edited:
Most studio grade cards have ADAT outputs that can easily be sacrificed for loopback purposes. That what i do with an RME Fireface.

Very interesting. So is this done via some sort of 'applet' supplied with the card? Couldn't you simply turn off the link to the output altogether, or do you always have have at least one input->output connection selected?

(You couldn't include a screenshot of the relevant bit of the 'applet' if there is one? Thanks)
 
Hi phofman

That isn't quite what I meant. As I understand it, this thread exists because people need to route audio from any source (SPDIF, CD, Windows media player, Spotify, Youtube) via DSP-based processing and finally out to their speakers, and it isn't immediately obvious that this is possible without resorting to two sound cards linked by SPDIF (jitter, re-sampling), or 'virtual audio cables' (re-sampling).

From my limited experience it is possible to do exactly what they need using only a single sound card and nothing else, although it isn't possible with all sound cards. I'd like to know which cards make it possible, and which don't.

The problem, as far as I can tell, is merely that the default routing of most sound cards is to connect any incoming stream internally to the analogue outputs. The Creative Audigy, for example, seems to do this unavoidably when you're using the Creative drivers. However, the open source Kx Project drivers allow you to turn off this internal routing. Unfortunately the Audigy always re-samples internally to 48kHz, reputedly not particularly well - although it sounds OK.

The more up-market Creative X-Fi can work at a variety of sample rates in 'bit perfect' mode, and its re-sampling (should that be necessary) is supposedly very, very good anyway. The card's standard drivers allow you to connect any input to any output with a sort of matrix arrangement. You can also turn off any internal routing - which is what you need for DSP processing.

Once you have turned off the sound card's internal routing, the setup for bit-perfect grief-free active crossover (in Windows at least) is as follows:

Set the Control Panel->Sounds and Audio Devices->Audio->Sound playback->Default Device to be the sound card in question. From now on, any standard media player will route its audio to the sound card's 'Wave' input, and you can also take in SPDIF or analogue line in if you want.

Set your DSP application's source to be the same sound card's input, and select whichever input you want ('Wave', SPDIF etc.) if you have the choice, or the simply the sound card's mixer as the source.

Set your DSP application's destination(s) to be the sound card's analogue outputs (or SPDIF).

You can now process any input that the sound card is capable of handling, and send your processed audio to the same sound card's outputs, locked to the same sample rate.

I must admit, this is one of situations where I'm slightly baffled as to why anyone would consider any other arrangement than this 'perfect' one, but I am also aware of the fact that some cards won't let you do it without wasting at least two of the outputs due to internal routing.

So which cards will let you do this?

Thanks for the detailed write-up!
It's exactly what I had in mind. I have the software loopback driver idea because as you mentioned it's very hard to guess which sound cards allow to configure their hardware for internal routing. Usually music production sound cards provide some routing control but these often cost >$300.

It would be great if we can generate a list of sound cards that can be used in this fashion. I'm not opposed to using 2 sound cards or 2 PCs as long as costs are kept down and the signal path is well understood. An interesting option for example can be utilizing an onboard sound in addition to a hi-fi sound card. It would be interesting to investigate if the onboard sound driver can provide a loopback function without audible artifacts.

BTW, I'm very familiar with the Creative Audigy2 and I must say your description of the signal flow is precisely correct. With the KX-Project drivers one can actually do DSP in hardware eliminating the need for VST plug-ins. The only issue with it is being stuck with 16/48.
 
This one works pretty good in my set up, though i have had some crashes:

VSTHost

Though i use Console, which is not free, often crashes, and limited to 96khz, but i like better the gui.

PD: I have never had a crash playing music. Always after Console being On and idle during some ( rather long) time. No idea why.
 
You can indeed use as many inputs and outputs that are available on your soundcard but you have to make the routing using the menu Engine Configuration ( Asign Input Channels / Asign Output Channels).
I have been testing this with ConvolverVst with a config file for the xover.

But as i said the gui in Console is much more intuitive.
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.