KVM+Qemu+VFIO+Sound Latency - the last one is the problem :)

Hi there, maybe I porsue something that cannot be done by now… (please forgive my english I’m not native)

Summary: I want to use my Traktor Pro 3 DJ software with my Traktor Kontrol S2 MK3 controller in a Virtual Machine without cracks

So the story:
I use evertything on linux what I need for work, buuut my DJ controller and its software is not working with lutris or the alternatives (mixxx) is not an option here.

Made a PC with KVM+Qemu Passed through PCIe VGA (Shapphire radeon RX460) works like a charm. But the Traktor Pro 3 and the controller (Traktor Control S2 MK3 USB2.0) has some cracking and probably latency issues.

The PC config: It is an R930 Fujitsu Workstation with 2x2630L-v2 CPU, 64 GB ECC 1333 MHz RAM Fujitsu motherboard c600/x79 chipset. Some HDD and SSD for the host OS which is Kubuntu 20.04 64 bit and changed the kernel to 5.4.0-40-lowlatency (because “maybe that will help”… not so much)

Guest OS win 8.1 64 bit, HW: tried 8-16-32 Gigs of RAM and various cpu topology, the best is when core count is above 4 (like 2 cores / 4 threads) I use it with 6 core/12 threads, but I changed every possibility and nothing helped with latency.

I figured out to passthrough the whole USB2.0 controller not just the DJ controller, USB 2.0 is better then the USB 3.0 passthrough (With the Texas instrument USB 3.0 controller the latency was worse, also the traktor controller is USB2.0 so does not matter)
I also passthrough a LAN card from the two on the mainboard, for easier networking.
I got separate monitors and keyboard and mouse, so no need for the QXL and SPICE things I removed them from the default machine. The HDD is an image with the virtio driver runs cool from and SSD. Also no emulated sound card added.

In the guest os (win8.1) the latency monitor program said that the USB and occasionally the NET drivers are the weakest links in latency, everything updated :slight_smile:

Obviously want to use the controllers sound interface, does not matter if some settings add some latency if the crackling will gone.

Tried the followings, without success

  • CPU core count variations as mentioned above
  • USB 3.0
  • USB drivers and energy saving settings in guest os
  • Low Latency kernel in HOST OS
  • Frequency, sample and USB buffers settings variations in the guest OS and in Traktor pro 3
  • Tried Traktor kontrol s2 mk3 's ASIO drivers and the reckognized WASAPI drivers too
  • Tried windows 10 too for guest OS
  • Sacrificed some goats and virgins for the latency gods
  • read the “how to improve audio in KVM” threads those are usually for (donno) emulated soundcards

Will try:

  • update the cpu for a bit faster MHz (I’ve a 2670 V1, I will give 2 cores for the WM so they can jump up to 3.2 GHz probably
  • make a bare metal install of windows … maybe that machine is not capable of that what I wanna do :smiley: :smiley:
  • remove any kind of network adapter from the guest, USB must have :\
  • Will try other dj program maybe Traktor pro 3 does not like virtualisation

Thinkings:

  • Do I need this XD (yeah I really wanna do because of the joy and fight and overcried nights and similar)
  • Maybe WM-s does not capable such a low latency, at least with my shity hardware…
  • Need more virgins :smiley: (definiatelly)
  • Need a faster clocked CPU ( 4Xample a 1620 v1 but I will lose the fantastic of the dual CPU system :frowning: )
  • Need a wizard ! :slight_smile:
  • Please be kind, My only knowledge is Ctrl+C and CTRL+V :smiley:

Thanx, Ask freely … what do you need for this investigation, I like reading if ya have a good link that I have not found yet …

Peace and love!
Kenny

1 Like

If nuking everything is an option, maybe try Ubuntu Studio. I hear it has JACK sorcery properly built in.

Curious why you need audio stuff in a VM and not in bare metal. I mean bare metal audio latency is already hard to perfect for profession use.

Also you may need to try virgin goats. If that fails you may also need to try a virgin with goatie.

@regulareel
Thanx … This is for just “how far we can go in VM-s” :slight_smile:
Also I was dumb enough to watch LTT where they build a NAS with VM gaming machine :smiley: :smiley: So I made the same because this machine is a Linux Workstation with "huge " SMB folders for other computers, and an owncloud server and many more lil stuff (netradio, apache server, DLNA server, etc…) and I try to not involve more machine into my room, for occasional DJ parties and music productions. Also I know there are lot of cool Linux audio DAW-s that I 'll intend to learn, but not in the near future, and mixxx is not have that precise BPM counter as traktor, and we are lazy to sync beats by hearing, that is why we sold our turntables :smiley: :smiley:

The jack system is not for us, we need the Traktor Kontrol’s audio output to the sound system, a jack system more than likely add more latency.
Ubuntu studio is cool, but because of the low latency kernel as I already installed, maybe I can try the Realtime Kernel patch but I read that is not for everyday use sooooo that will be the last thing I 'll try.

Also orderd virgin goats from aliexpress they should be here in no time :smiley: :smiley:

Update:

Faster processor still cracks, 4 cores/8 thread (started from 2C/NO HT then 2c/4 HT to build up) from a 2670 v1 to VM at 3000 MHz did no change, but latency monitor get fewer errors :\ more faster CPU needed perhabs… Seeking for a 1620…
Latency monitor also sais that the USBport.sys is the main latency issue …

Update 2
Bare metal win8.1 and traktor stuff works greatly on the same machnie with the 2x2630L-V2

Thanx
What else do I suggested to try ?
Gandalfs ? Where are U ? :smiley: :smiley:

1 Like

Some update …

In Windows Guest (8.1) I set the traktors priority up to realtime i task manager, seems to be fair but longer test needed… So still waiting for some triks If ya have :slight_smile: Also need that where can I modify that whenever traktor starts use this priority level, because I need to switch on every start.

So no longtime test still, but I’ve read an article about mitigations in kernel, what is some kinda hardware vulnerability patches, obviously we don’t need this, because we do not store data like banks or CIA :smiley: I also read that if I turn off those I can gain a bit more of a performance, but can those decrease latency time ? :smiley: :smiley:

I’ll nevermind, at wednesday I have a bit of time to make a 2 -3 hour mixing session so we will see how those two settings are works?
(mitigations=off and priority emerge in windows guest for traktor)

Peace

I think if you had a Ryzen 3000 system (3700x or above) with 2x16 GB RAM (get 3600 rated 16-16-16-36 and run at 3733 with tightened timings) and passed through the built-in Matisse USB 3.0 Host Controller you would get good results using a pds kernel with a windows 7 guest.
Something like attach 6 CPUs to the guest (no hyperthreading) and then use cpus 7 and 8 (and their hyperthread pairs) for the emulator pin and iothread. Here is an example of something I tested with good latency results on 3950x and I did a similar setup also on 3900x ITX machine. (both single gpu passthrough)

<vcpu placement="static" cpuset="0-5">6</vcpu>
  <iothreads>1</iothreads>
  <cputune>
    <vcpupin vcpu="0" cpuset="0"/>
    <vcpupin vcpu="1" cpuset="1"/>
    <vcpupin vcpu="2" cpuset="2"/>
    <vcpupin vcpu="3" cpuset="3"/>
    <vcpupin vcpu="4" cpuset="4"/>
    <vcpupin vcpu="5" cpuset="5"/>
    <emulatorpin cpuset="6,22"/>
    <iothreadpin iothread="1" cpuset="7,23"/>
  </cputune>

Note I use the special windows 7 ovmf with hyperV, and also that in some cases the other drives or storage access could still cause hickups in the audio latency test. So on windows you need to make heavy use of process lasso and also use the MSI tool. BE CAREFUL with the MSI tool and create a restore point before you use it. Change one setting at a time then reboot and do thorough testing. Some drivers go nuts if you enable MSI. Then if you boot without that hardware attached, you must manually change it back in the windows registry. You could test recording first using a virtual RAM drive in windows guest before storage to rule out any possible storage latency issues. For audio you might want to consider passing through an nvme drive and use that for recording in the VM if virtio SCSI or virtio storage had issues.

Also in windows by default it will do audio processing on the first cpu only. There is a way to change this somewhere in the registry. CPU 2-4 might work best if you have a typical CCD in ryzen 3000. This might not apply to your pro audio setup however.

Thanx those are usefull info, I’ll try to play with them.

I think assigning a USB controller to the VM (rather than just the USB device) will likely yield rather better results - you might need to buy one as a pcie card to do this.

Really though I do share the bafflement at why you would do this.

If you are gigging you really ought have a laptop that is running bare metal with Traktor (with as little else on the laptop as possible) - pretty much any laptop can run Traktor fine nowadays so it really doesn’t need to be anything special.

If you want to use Linux, you should probably use Mixxx which runs natively (or something else that runs on linux).

Have you looked at running Traktor using Wine? Might give better results?
https://appdb.winehq.org/objectManager.php?sClass=application&iId=8727

Hi, this is for "how can it be done " situation, I have a laptop with windows10 and traktor. But I do not want to switch on my laptop at home but my machine and workflow is on a linux machine. And our music production is for our joy not for anything else :slight_smile: (as mentioned above)
As mentioned above too, I use one of the mainboards USB 2.0 controller of the R930 (have 3 ) and not passthrough the USB DJ controller as like a mouse device, the problem with wine is that it is not see the controller on the USB when I start Traktor from it, however traktor runs greatly in wine. Mixxx is great I love, but my friends are hardened windows users with little motivation for changes, and differences, also the bpm counter in traktor is far more precise than in mixxx and dnb music requires that :slight_smile:

An alternative half solution made by the way…

I bought a cheap asus Xonar PCI32 card and put into the only PCI32 slot, I passed trough to the WM and the traktor can handle that (also have ASIO and Wasapi Driver, used wasapi) with increased buffer limit to 2048 … so overall latency is around 85 ms that is fine for a home party with a controller. Also the Xonar has many outputs so the monitor channel is no problem.

Later I’ll try the above mentioned MSI and CPU configuration.

But if somebody have some other ideas, I’m open to it.

Peace

85ms seems a tad high for a PCI device. Ideal be below 60ms?

What latency do you get on these devices under native Window or Linux so we can understand the overhead the passthrough-VM is causing. (sorry if you’ve already said and I missed it)

I’m also running Traktor in a QEMU VM but for the opposite reason, to reverse engineer the communication between Traktor and the Kontrol S4 Mk3 so I can get the S4 Mk3 working with Mixxx. From my experiments and reading what you have tried I am doubtful it is possible to get performance from any DJ software in a VM that is usable for anything other than reverse engineering. For your case, I recommend using Mixxx which already has a mapping for the Kontrol S2 Mk3.

I have spent all weekend trying various VM configurations and documented my findings on the Mixxx wiki. I thought I would need OpenGL support in the Windows guest. I have a handful of audio interfaces lying around, but I don’t have any spare GPUs nor video monitors to pass through to a VM, so I tried running Traktor using Intel GVT-g. Unfortunately, the performance was terrible. When I turned on the motors for the jogwheels on my Kontrol S4 Mk3, the wheels moved with big jerks, sometimes jerking back and forth like they were scratching on their own. I tried VirtIO for the VM video output. Even though there is no VirtIO OpenGL driver for Windows yet, the performance is good enough for reverse engineering.

I have to use the Kontrol S4 Mk3’s audio interface with WASAPI Exclusive Mode. Using ASIO, it crackles so much that it’s unusable even for reverse engineering. With WASAPI, it still crackles so much that it’s unusable for a performance. Curiously, the option to use the S4 Mk3 with WASAPI disappears from Traktor after installing the optional ASIO driver, so I uninstalled the ASIO driver.

I’ll see it when I’m there, but I remember overall latency in Traktor something like 20-30 ms probably good in native environment.

Yea, so like as in mine …

But have a kind of a sollution here, still need to experimented…

OSX86 :smiley:

By an other reason (curiosity) dug my head into this kind of stuff (MAC OS in VM) not so hard to install a Catalina and it is good with Traktor 3 out of the box with the emulated sound card :smiley: :smiley: Serioussly … No cracks no too much latency, and I expect that if I connect the S2 controller to the passedthrough USB controller it can be so low that almos feels like bare metal :slight_smile:

So some testin’ will be, and I write my opinions about it :slight_smile: