Latency issues using VST in Wine on mac osx

Discussion in 'Mac / Hackintosh' started by William C, Aug 8, 2023.

  1. William C

    William C Newbie

    Joined:
    Nov 7, 2022
    Messages:
    18
    Likes Received:
    1
    I need to run a windows vst on a Mac through wine

    I have successfully installed the vst in wine. The issue I have is latency and how to solve it.

    I think it’s to do with the fact I’m using ‘direct sound’ rather than an asio driver.

    I have tried to get wineasio to work however this is far from straight forward. There is no prebuilt DLL and so far my attempts to compile the DLL from a built wine source instance have been unsuccessful.

    is there another solution someone can point me to or any suggestions to how I can resolve the latency issue.

    I believe it’s all to do with that im using direct sound and this causes the latency
     
  2.  
  3. 6ixcore

    6ixcore Producer

    Joined:
    Apr 4, 2016
    Messages:
    190
    Likes Received:
    92
    Hey ive tried doing that with wine but was never able to, got it working with parallels desktop and audiogridder (no latency issues). At first, also wanted to use wine as its probably lighter than parallels on the cpu.
     
  4. clone

    clone Audiosexual

    Joined:
    Feb 5, 2021
    Messages:
    7,356
    Likes Received:
    3,245
    What is the plugin you are trying to use? When I see you mention compiling it yourself, i get the feeling this will not end well.
     
  5. Slavestate

    Slavestate Platinum Record

    Joined:
    Jul 28, 2019
    Messages:
    442
    Likes Received:
    199
    You wait for quantum cpus to become available.

    You're trying to run a real time audio process, which already has enough overhead and latency as it is, 'translated' through a wrapper to Windows code and back, and expect it to not have any more latency?
     
  6. William C

    William C Newbie

    Joined:
    Nov 7, 2022
    Messages:
    18
    Likes Received:
    1
    The plug-in is East West Play Pianos. The particular VST client software I am using only has a windows release.

    im fairly sure the compiling of wine from source went fine as was following instructions and went without a hitch. I can run things in the compiled wine prefix without issue.

    the problem came when I tried to proceed then to build wineasio from source. I had to build wine from source because it has the headers necessary . It’s not as simple as download a folder and run a few commands, there’s all sorts of issues like there are ‘include’ statements in the c source code which is looking for files in the wrong place. I don’t know when someone successfully ever built wineasio for osx . I can’t see any posts anywhere in the past few years at least of someone successfully achieving this.

    For anyone who's looking for how to build Wineasio on macos (some fresh version like Ventura).
    First of all, now Wine installed using brew/cask doesn't have additional header files and tools needed for development. So you need to download wine sources (they usually add link to download them to release https://www.winehq.org/news/).
    Then you need to build it on your machine using instructions here: https://wiki.winehq.org/MacOS/Building


    Basically, you install needed tools brew install --formula bison flex mingw-w64 pkgconfig, then manually add bison to your PATH (homebrew will log a message on how to do this).

    Then unpack wine sources, go to the folder in Terminal and run ./configure CC="clang" CXX="clang++" --enable-win64 (it won't work without the last flag on new systems).
    After configure just run make and wait

    1. I’m not sure wineasio can be built for osx anymore.
    2. I’m not sure whether the instructions are the correct procedure to build wineasio for osx
    3. Is there a better or alternative way I can achieve the objective of low latency from the wine windows VST to the host osx system on which it all runs.
    4. I’ve heard of jack and tried to set this up but confused what I’m supposed to be doing where. Like whether I run the windows jack software on the wine instance. Then run the osx jack on my main system, then somehow magically they are supposed to be able to communicate when you click the start back on jack . I’ve also heard of Alsace and pulse audio and have a basic idea of what they are, but confused how to put it all together.

    I’m sure someone out there has been through the pain of figuring this out and could give me a few helpful hints so I’m not barking up the wrong tree

    for reference the instructions I’m following for building wineasio are from here - https://github.com/wineasio/wineasio/issues/49


    many thanks in advance. Even if someone here can’t provide me a full solution, even a few pearls of wisdom can help me narrow my attention
     
    Last edited: Aug 21, 2023
  7. William C

    William C Newbie

    Joined:
    Nov 7, 2022
    Messages:
    18
    Likes Received:
    1
    I expect there to be latency, but understand there is a way to resolve the problem . Something to do with how sound is routed from the wine instance to the host operating system

    I understand the higher the sample rate , the higher the latency. According to the app the latency if it were running in its natural environment would be say 10ms for 512 sample rate. However in practise its behaving like how I’d expect if I had it on a much higher sample rate. I think this is caused because of how wine sends the audio over
     
  8. clone

    clone Audiosexual

    Joined:
    Feb 5, 2021
    Messages:
    7,356
    Likes Received:
    3,245
    if you are getting sound already, but it is just laggy/high latency I wouldn't suspect your wineasio make64 build is done incorrectly. I checked if anyone was using ASIO4ALL driver to get around this. I found an old thread on winehq where the user reported similar performance issue. The guy fixed it and then marked his own thread solved without posting the solution he found. or if he even did figure it out. cute. https://forum.winehq.org/viewtopic.php?t=24941

    I do think that not using an ASIO driver is the most likely cause of lag/latency.

    this one is going to be difficult for someone to solve who is not actually doing it on their computer. imagine the difficulty you are having, and then trying it remotely one command at a time and awaiting response. Some amount of latency should be expected when virtualizing anything; but it shouldn't make your mac come to a screeching halt. just a little slower/higher latency than normal, maybe even double the latency would not shock me.

    it looks like most of the users into wineasio are using it on Linux, which seriously cuts down the number of ppl who could help you with it running on MacOS.

    Maybe a lot of trial and error required, but getting to use all the r2r stuff for PC (without bootcamp, etc.) could be worth the effort. I would "accept" your build as being good, and work from there on the driver part of the puzzle. Also, since are trying to run a Midi Instrument; the only real addition to latency should be the Midi data coming in to Wine and the audio being piped back out. Nothing even close to a normal realtime audio FX plugin. That probably would be horrible.
     
    Last edited: Aug 9, 2023
  9. William C

    William C Newbie

    Joined:
    Nov 7, 2022
    Messages:
    18
    Likes Received:
    1
    Yeah agree.

    Yeah I gave this a go. It installs in wine and can see and select it in the audio settings for the vst. From what I understand asio4all is more abt using ASIO rather than direct sound on a bare metal machine. I dont believe it supports jack or similar to send the sound over to the host machine. From what I understand thats what's so special about WINEASIO is its support of jack.

    Yep

    . The host macOS machine is fast and powerful and isn't struggling in anyway. I can even see the cpu/memory usage in the GUI for the VST and that shows barely touching the hardware.



    Yeah I noticed that too. I tried on linux this morning to (1) see if I could get wineasio built (2) see if it worked (3)see if it helped

    I still wasn't able to build it from source myself but was able to pull a working instance from I think It was kvr audio who have a repo for it . I was able to register the dll in wine and could see it in the drop down in audio devices. some things of note. I had to run wine as root in order for the wineasio to show. I could see activity in wine terminal log when running as root, that wasn't happening when run as non root. although I could see wineasio however it didn't seem to be consistently connecting to my Yamaha keyboard . I judged this by the fact of it also showing sample rates in the boxes beneath ( or not ). however even when it did, I still didn't find that I was getting audio through to the host linux machine.

    yeah absolutely a lot of trial and error needed. ive learnt lots on the way and will keep persevering till I crack it one day
     
  10. Zoketula

    Zoketula Guest

    Hi William C,
    you wrote you installed a VST in wine. How do you host it? Do you mean you have installed a standalone app that uses direct sound?
    In that case direct sound is going to have buffer underruns around 100 ms I guess. That's my experience with it on different platforms.
    By default wine on Mac uses the winecoreaudio.drv, which is capable of low latency audio. In the Linux world you would direct wine to ALSA as the default driver to get low latency. Pulse Audio is for managing multiple audio apps at the same time and is not low latency. Pipewire is a more recent "sink-in" solution for PulseAudio. JACK is for routing audio and MIDI. You don't need those on Mac. If that app doesn't support ASIO directly, then you also don't need WineASIO. That's at least my understanding of it.
    I could very well be wrong about this and it happened before more than once, but I don't think there is a way to force an app that only supports direct sound natively to get low latency. I tried to do something like that with a old program called Rebirth RB-338 on Linux, but without success. Again, I might be wrong about this and there is a way.
    To use a Windows VST on a Mac host (DAW) you probably need a wrapper like yabridge (https://github.com/robbert-vdh/yabridge). If you manage to port that to Mac, then it should be no problem to host a lot of stuff in any DAW, because the Mac host will treat the "translated" Windows plugin just like a native one. I am not a coder and have no idea how difficult porting a wrapper is, but I have a hunch that it's not for the faint of heart.
    By the way, it's not my business but that's a lot of trouble to get a piano plugin going on Mac. There are plenty. But I appreciate your adventurous spirit ;)
    All the best and good luck!
     
  11. clone

    clone Audiosexual

    Joined:
    Feb 5, 2021
    Messages:
    7,356
    Likes Received:
    3,245
    Oh, it is not just a simple piano plugin at all ;) It is the PC platform R2R released versions of the software titles which of are interest. We have basically none of their iLok releases for Macs directly; so they require *alternative solutions such as running Windows inside a VM, Audiogridder, Bootcamp. Massive libraries of samples for VST instruments like EastWest, UVI Falcon2, and others. There are also FX plugins, but the content of real interest is mostly the instruments. Effects can always be pretty easily substituted for something else based on MacOS.
     
  12. Zoketula

    Zoketula Guest

    Whoopsie, I saw "piano" and assumed it was just some run of the mill rompler ;) I think William C is almost there, if he has WineASIO registered and it's showing up. I wonder what buffer sizes and periods winecoreaudio.drv uses. Maybe the default ones are just too high. Just speculation. The other way would be a wrapped plugin in a DAW instead of using the ASIO-aware standalone app and wiring the audio back. I used plenty of R2R ilok-liberated wrapped audiowarez on Linux, so it should work on Mac. This topic is interesting, but I am out of clues unfortunately.
     
  13. William C

    William C Newbie

    Joined:
    Nov 7, 2022
    Messages:
    18
    Likes Received:
    1
    Yeah- it's the 'Play 6' standalone app.
    Yeah latency dreadful with direct audio. You could reduce the latency somewhat by reducing the sample rate but knew from experience problem was due to using direct audio rather than having an ASIO driver or other low latency solution.
    Thankyou thats helpful information to know.

    Yeah ill have a look a bit more about yabridge and see if it would help

    Update

    I was able to build wine from source, and then get wineasio.dll and wineasio.dll.so files built. I built on a ryzentosh Ventura 13.4. I was then able to get the aforementioned VST working with the imported wineasio driver. Massive difference. No latency whatsoever. I couldn't get the inbuilt ASIO settings working yet, however I have some idea why it's not working. I can see its a python program using pyqt5 and might need some path amendments , as its been built with linux in mind rather than Mac OS. MacOS seems to have different paths such as /USR/LOCAL rather than /USR

    I wasn't able to get audiogridder working, but I think this is more due to the fact that audiogridder doesn't allow me to incorporate the usage of wineasio.

    As way of advise for anyone coming across this post and trying to do the same.

    MFC42 and vcrun2013 required

    The missing fonts issue is resolved by deleting the fonts listed in this key
    HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Fonts
     
    Last edited: Aug 21, 2023
  14. Melodic Reality

    Melodic Reality Rock Star

    Joined:
    Feb 18, 2023
    Messages:
    631
    Likes Received:
    408
    Didn't read whole thread, why not use Parallels with AudioGridder?
     
  15. William C

    William C Newbie

    Joined:
    Nov 7, 2022
    Messages:
    18
    Likes Received:
    1
    Thanks for suggestion

    I cannot at present run virtual machines on my hackintosh as haven't figure out how to get it to recognise my amd cpus SVM capability
    However even if I could I'd rather a leaner solution than having a full windows install virtualised :)

    I have got wineasio working , it just would be the icing on cake to be able to use it in my vst something like crossgridder or yabridge, so I can use say a violin for treble clef notes and piano for bass
     
  16. Zoketula

    Zoketula Guest

    That's really cool you got it working so far. You may be the first on macOS to have such a setup. :) I haven't checked on WineHQ for a long time, but I remember there was some problem with current wine builds for Mac and Crossoverr uses a ancient version. One of these day I have to try and build one for Catalina.

    Yup, I dabbled with the EastWest Player to see what it is about and it needs those. It even says so in the nfo *cough*. There is a tool on Linux called "wine-tricks" to download dlls, runtimes and also MS fonts called "core fonts" like Arial,MS Times etc. The dll can just be dropped in the install where it looks for it given it is the right version, the runtimes could be added with the official MS installer. The MFC42 might be available as a native build for wine. The dll type can be changed in the wine config to skip the build in one with the manually installed one.
     
  17. William C

    William C Newbie

    Joined:
    Nov 7, 2022
    Messages:
    18
    Likes Received:
    1
    yeah I tried the core fonts, all fonts winetricks but they didn't solve the problem for me.
    mfc42 isn't mentioned but a quick google of the error you get when try to run setup.exe
    the only solution I found thus far was to remove all the font entries in the registry key.
    HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Fonts

    yeah have a go sorting it for older macOS and post your results as I know there are others looking for 32bit wineasio.dll and wineasio.dll.so files

     
  18. William C

    William C Newbie

    Joined:
    Nov 7, 2022
    Messages:
    18
    Likes Received:
    1
    I have been able to get it working now through audiogridder inside a wineskin winery bottle. however only if I manually launch the program. I've create a batch file and link the icon to the batch file . if I link directly to the exe get looping issues/latency problems.

    I'm not sure even if it's using wineasio inside this winery bottle because when I access the plugin with Logic Pro through audio grinder I can't see what the audio settings are.
    If I try either crossover, or launching program from an icon, it either has dreadful latency or the problem gets in a loop of loading and reloading the instrument selected in the player.

    I'm not just putting this info out there in case anyone else trying to achieve the same
     
  19. Zoketula

    Zoketula Guest

    One thing I forgot: the ESYNC option might do something. It's supposed to provide better synchronization. In other news Crossover 23 was just released updating wine to 8.0.1 I heard someone called "TNT" provides a trial version.
     
  20. William C

    William C Newbie

    Joined:
    Nov 7, 2022
    Messages:
    18
    Likes Received:
    1
    Thanks for the heads up @Zoketula . I’ll make a point to try it

    im going to post a complete guide / video to getting wineasio working from fresh osx system

    I had to reinstall my system recently and it wasn’t quite as straight forward to just plop the prebuilt wineasio files into the folders

    I was surprised to find I was able to get an instance of the play 6 app running with audiogridder without latency and without wineasio …it’s really fussy and fiddly to get working but it’s possible .
     
  21. William C

    William C Newbie

    Joined:
    Nov 7, 2022
    Messages:
    18
    Likes Received:
    1
    Update

    I was able to build, install and register wineasio from source. It is necessary to build wine from source first and have a working wine environment.

    I was able to register wineasio on a host of different wine setups from crossover, wine skin winery and just a bog standard wine install. I did find however it necessary to jump through some hoops to get wineasio to register for example in crossover, whether that be registering wineasio with both the wine I built from source as well as within the particular software eg crossover. This can be achieved by calling the wine binary and additionally supplying the path of your prefix eg WINEPREFIX=path/to/prefix

    if I skipped this and tried just to register regsvr32 wineasio.dll in crossover , it wouldn’t register.

    i did find that there is some strange permission / command interpreter issue, whereby you need to either run cmd , THEN call your VST programs exe. Some of the other ways around the problem seem to be to either make a batch file which in effect makes the VSTs exe a child process of the cmd . Or you can make an autohotkey script ( and compile it to an exe even ). For example cmd /k c:\path\to\vst.exe

    the above advice may not be entirely clear unless you are experiencing these problems but helpful information to give you an idea what area you need to be addressing if having problems

    System:AMD Hackintosh
    oSX : Ventura 13.4.1
    Wineskin Version : 2.9.1.9
    Engine : WS11WineCX64Bit22.1.1-10
    https://github.com/Gcenx/WineskinServer

    Winetricks

    MFC42
    CMD ( this resolves the issue with the Play6/Audiogridder crashing or not loading )

    INSTALLATION

    Part 1 - Install and configure homebrew and wineskin winery

    Run these commands in terminal:-

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    brew install --formula bison flex mingw-w64 pkgconfig freetype
    export PATH="$(brew --prefix bison)/bin:$PATH"

    brew install --cask --no-quarantine gcenx/wine/wineskin


    Part 2 - Building and installing wine from source code

    You must have homebrew installed and the packages above mentioned installed before proceeding.

    1. Dowload and extract https://dl.winehq.org/wine/source/8.x/wine-8.13.tar.xz
    2. Open a terminal at the location you extracted wine-8.13.tar.xz
    3. Run in terminal ./configure CC="clang" CXX="clang++" --enable-win64
    4. Check that you see the line - configure: Finished. Do 'make' to compile.
    5. Run in terminal make -j16 ( replace this number with your processor thread count).
    6. Run in terminal make install -j16 ( this also takes a couple of minutes)
    7. Close all terminal windows once this process has completed - it took me about 10 mins as a rough idea.
    8. Open a terminal window and check you can run wine64 and winebuild globally ( i.e you dont need to be in the wine source folder). If you cant you need to address this before moving on.


    Part 3 - Building WINEASIO

    You must have built and installed wine from source and be able to run wine64, winebuild globally. If you have to browse to the wine folder to run these binaries then its not installed globally (that is terminal doesnt have the directory where wine is installed in the $path environemnt variable. You can also check by running command 'which wine' or 'which winebuild'.

    1. Download and extract https://github.com/wineasio/wineasio/releases/download/v1.1.0/wineasio-1.1.0.tar.gz
    2. You will need to amend the PREFIX in Makefile.mk of wineasio source code to PREFIX = /usr/local . This is because the INCLUDE folder it needs is at this location on OSX rather than /usr.
    3. Open a terminal at the root of where you extracted wineasio.
    4. Run the command make 64 -j16 (replace 16 with your processors thread count).
    5. Check that wineasio.dll and wineasio.dll.so are in the build64 subfolder of wineasio folder. In my case the wineasio.dll was 2KB and the wineasio.dll.so was 340KB.

    Part 4 - Registering WINEASIO

    You must have have successfully built wineasio.dll and wineasio.dll.so following the steps above before proceeding.

    The following shows the path that the wineasio.dll wineasio.dll.so files needs to go and the commands you need to run to use particular prefixes. You will need to amend some of the names/usernames as appropriate.


    [​IMG]

    I found it was necessary to
    (A) use the wine64 binary we built earlier to register the wineasio.dll file in the prefix you want to use. (This presumes that that prefix is not .home in the users folder)

    eg WINEPREFIX="/Users/username/Library/Application Support/CrossOver/Bottles/NAMEOFBOTTLE" wine64 cmd
    then run regsvr32 wineasio.dll ( I didn't get a message of failure or success)

    In the above example I am using my wine built from source and applying it to the crossover bottle

    (B) then go ahead and just pull up a regular command prompt from crossover/wineskin winery and then run regsvr32 wineasio.dll here too ( you get a success message)

    If you skip step A I found that step B fails.

    You need to have jackd / qjackctl installed from https://jackaudio.org and have the server in a 'started' state. You can start it with the QJACKCTL app. You can change the output interface in the settings tab. If you change outout interface it is likely you will need to reload everything, eg kill jackd process in activity monitor, restart qjackctl gui, restart the vst etc.

    If you are using a VST which is built using JUCE you need to EITHER

    delete all fonts in the following reg key HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Fonts

    reg delete "HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Fonts" /va /f

    or

    amend the ms sans serif font so it has the full path and not just the filename! The cause of problem seems to come from the system.reg which is also missing the full path.
     
    Last edited: Nov 10, 2023

    Attached Files:

Loading...
Similar Threads - Latency issues using Forum Date
Latency issues : need help for cheap pc upgrade PC Jul 8, 2020
Latency issues with Ableton PC Jan 23, 2016
help needed - latency issues with UVIengine (plugsound vst) FL Studio Aug 6, 2014
Logic Pro 11: Latency Off-Set Dilemma Logic Monday at 8:51 PM
Latency Advice Needed! DAW Oct 18, 2024
Loading...