Advanced VAC (Virtual Audio Cable) Guide
I already talked about several ways to use VAC in my previous Guides. Just check the Streaming Guides Audio section. This time I want to show you how to start VAC repeaters with a batch file and of course some more stuff which could be interesting to some virtual audio device users!
Let´s start with the batch file creation, I like to note which devices are available and what they are called inside VAC. So start up a repeater and check the Input and Output Area:
As you can see in the picture VAC offers us two different repeaters, the MME and the KS one. The first one uses mainly Software to do its job (WDM), the second one uses the Kernel System of Windows(KS) and thus, if I understand everything correct, the Hardware(Wiki). I personally always ran into problems using the KS repeater. So I will use the MME repeater in this example.
start /min "audiorepeater" "%programfiles%\Virtual Audio Cable\audiorepeater.exe" /Input: "Stereomix (Realtek High Definit" /Output: "Front Output (Realtek High Defi" /BufferMs:100 /SamplingRate:44100 /Priority:high /Autostart
The above code, saved as .bat file will start an active and minimized repeater:
/Input: /Output: /SamplingRate: /BitsPerSample: /Channels: /ChanCfg: /BufferMs: /Buffers: /Priority: /WindowName: /min /AutoStart /CloseInstance:
- /min allows you to start the Repeater minimized and in the background, together with /AutoStart it will also be active.
- /CloseInstance option has a special meaning. Instead of specifying a parameter for a newly started Audio Repeater instance, it instructs to close an existing instance that has a specified window name (specified earlier by /WindowName option). If used, it must be the only option in command line. If a named window exists (even if hidden), the window close message is sent to it. The option can be used to close any application window, not only Audio Repeater‘s.
- Option names are case-insensitive. means a number, means a string. Specify option values as you see these parameters in Audio Repeater window.
- There are two counters, Overflows and Underflows. Overflows counter is incremented when Audio Repeater has no free buffers for recorded data. Underflows counter is incremented when Audio Repeater has no buffers to play back. Overflows and underflows can occur as a result of a clock difference effect, heavy system load (when Audio Repeater does not receive enough CPU time) etc.
- To optimize audio transfer, you can vary the buffering time (total buffer) and number of buffers. The total buffering time (in milliseconds) defines how much audio data reserve a device driver will have. The larger is buffering time, the more robust is the transfer, the less is chance of sound interruption due to task switching, disk operations etc. But the larger is the buffering time, the larger is latency value, and the larger is a delay between incoming and outgoing audio data. Typical buffering times are from 200-300 to 1000-2000 ms.
- The number of buffers defines how many parts of the total buffering memory will be used. The more buffers are used, the smoother is the transfer even the total buffering time is small. But large number of buffers raises a system overhead and use of more than 15..20 buffers will not make transfer smoother.
- The priority field controls priority of the Audio Repeater process. The higher is priority value, the smoother a process is executing, the less time is rest for another processes. Most processes have Normal priority value, Audio Repeater has Normal value by default. Be careful setting the Realtime priority value because it can cause Windows to freeze.
- Cables – number of cables created by the driver. Changing this value causes driver restart.
- Max inst – maximum number of pin instances (number of times the pin can be instantiated). A first pin instance is always reserved for the Windows kernel-mode mixer (KMixer). Other instances are available for client applications. A driver that provides more than one pin instance is considered “hardware-accelerated” and can be used in extended DirectSound playback. See the DirectSound issues chapter for details. Changing this value causes driver restart.
- Ms per int – a number of milliseconds per software timer signals (interrupts). 20 ms per interrupt means 50 interrupts per second, 10 ms per interrupt means 100 interrupts per second, and so on. It also represents a frequency with which audio data are transferred from playback cable side to its recording side (many applications use the “latency time” term). The more interrupts per second, the less latency time, the more system overhead. Typical audio cards use 5-15 milliseconds per interrupt; DirectSound subsystem uses 10 as a default.
- SR, BPS, NC – sampling rate, bits per sample and number of channels ranges for the cable format range.
- Stream fmt – a stream format limiting mode.
- Volume control – a state of the cable volume control mode.
- Connected source lines – currently connected source lines. Checked source lines are exposed lines are reported as “connected” (plugged in). Connected lines must be a subset of the “Source line types mask” configuration parameter.
- Clock corr – a clock correction value, in percents. When a Virtual Cable is used in a path containing another audio device (a hardware device or a software device other than Virtual Cable), clock difference effect occurs. To minimize it, change cable clock correction multiplier until cable internal clock speed becomes closest to another device clock. f the value is 100%, cable clock rate exactly matches a sampling rate value of the cable format. If the correction value is more than 100%, cable clock goes faster, otherwise it goes slower. For example, if the value is 100.25, cable clock goes 0.25% faster; if the value is 99.98, cable clock goes 0.02% slower. Clock correction precision is 1/65536 so, for example, 100.001% is rounded to 100.002%.
Most infos about the different options are taken off the VAC help file.