mame.ini settings:
sound portaudio
audio_latency 1
pa_api "Windows WDM-KS"
pa_device none
pa_latency 0.001
If you don't have WDM-KS support or it runs poorly on your machine, WASAPI performs almost the same.
pa_api "Windows WASAPI"
pa_device none
pa_latency 0.003334
Remember to set sleep to 0 in the mame.ini and do not run any unnecessary background tasks when using this. Ideally, MAME will be the only program running. You can run MAME with the -verbose argument to see which API support you have for the various audio devices on your machine.