Latency in audio app, but not in plug-in

Hey, I’m quite new to Juce, and I’m building my first application with the framework.

I started out just following a tutorial making a gain slide, and when I made a vst plugin, it came out great! However, later I tried making an Audio application, being based on the AudioAppComponent. I followed this tutorial on spectrum analysis and the code is running fine. I’ve also got an AudioDeviceSelectorComponent, so I can change the buffer size, etc. My problem is that there’s significant latency in my output, and I’m not even doing anything with the audio yet! My plan is to make a audio to midi converter, acting as a virtual midi port, and this kind of latency will render the application useless. What am I doing wrong? I’ve tried playing with the buffer size and tried using Windows low latency audio device as driver.

Edit: Adding a pastebin link :slight_smile:

SOLVED:

The solution was to simply use ASIO. I used this Juce forum thread for help.

especially on Windows. if your host uses ASIO and the standalone uses some basic Windows API there will be major difference.

For adding ASIO to standalone you need to download and sign an agreement with Steinberg.

1 Like

What do you mean by host here?

I use a Focusrite Scarlett audio card, and have tried setting both output and input to it in my AudioDeviceSelectorComponent, with latency still. Also, I just tried to set everything to Windows native (with that I mean Realtek) drivers, after reading your comment. Still no change in latency.

Do you think ASIO still could be the solution, though?

I started out just following a tutorial making a gain slide, and when I made a vst plugin, it came out great!

So you’ve made a VST… where did you run it? (aka Host)

1 Like

Ableton Live 10. But I’ve since abandoned that, since I wanted to make a service type software, and not a plug-in. Thus, now my host is itself (?), i guess. I do not run the standalone program together with any DAW or anythinng.

Ok, some basics to understand.

You got your audio processing code block.
It gets an array of floats types.

Those actually being pulled/pushed from an audio device.

With Ableton Live:

  • Ableton communicates with the Audio Interface → does its things → passes it to you → gets it back → pushes back to audio interface.

With Standalone:

JUCE needs to communicate with hardware by itself. so the latency is directly affected with this communication. I’m pretty sure your Scarlett uses ASIO with Ableton and on Standalone you used what JUCE gave you, and the defaults will have much worse latency.

1 Like

Ah, yes, I see! Yeah my Scarlett uses ASIO, I just figured if I set both my input and output to the Scarlett in my Juce program, there should be no latency. But I understand that there are some underlying issues.

Thanks for your help! I will try to set up my program with an ASIO driver. Do you by any chance know if this will create issues with using a build of my program on other hosts? Will I need to install ASIO on e.g. my laptop to be able to run my program, or will it be integrated in the code?