Audio Unit wrong sample rate in NI Maschine

I’m using JUCE 4.3. Some users reported that the Audio Unit of our plug-in instruments are detuned in Machine 2.6. I think that they work with the wrong sample rate, because the users work with 48000Hz and the pitch is around a semitone higher, but not exactly.
The VST works fine. We update the sample rate in the process block (getSampleRate()) and we don’t have any issues in other hosts.

Anyone noticed the same?

We’ve not had any similar reports.

I’m curious why you’re updating the sample rate in your process block, rather than using the sample rate provided to prepareToPlay. Have you found situations where this was required?

Thanks for the fast response. I do this the last 10 years :slight_smile: It was recommended a few years back. Always thought that getSampleRate() returns the actual used sample rate. I will try to use the sample rate from prepareToPlay.

Getting the sample rate in processBlock should work correctly; I just wanted to find out if you were working around a specific problem that we might be unaware of.

I don’t have a machine 2.6 installed, so i can’t reproduce it at the moment. Not sure if all users are affected, but it seems that it wasn’t an issue the last years. Maybe it has to do with the latest Maschine update.
Does JUCE always have the same sample rate reported in prepareToPlay or do they have different sources and can they be different?

It’s possible that they could be different, but I’m fairly confident that JUCE users would have reported that before now.

Not sure, maybe most users set the sample rate in prepareToPlay… i will try to find out more about it.

Moving the sample rate code into prepareToPlay didn’t help. The AU tuning is still off. I just wonder how it can be that in two user reports the Audio Unit is detuned and the VST not… i have to get maschine and test it by myself.

I had time to reproduce the issue by myself installing the maschine 2 demo.
The JUCE framework delivers the wrong sample rate with the AU instruments. It’s always 44100Hz. The debugger shows that


always returns 44100Hz in my AU instrument plugins. Didn’t check the FX. The bus configuration of my plugins is the simple {2, 2} config. It works in other hosts. Any help is welcome!

Maybe Machine 2 is reporting the wrong (fixed 44.1kHz) sample rate to AU plugins. IIRC NI Reaktor is a non-JUCE based plugin that reports the sample rate provided by the host. Use Reaktor to figure out if Machine 2 reports the correct sample rate.

Audacity is a host that reports the wrong sample rate to plugins, by the way.

Hi Samuel

Thanks for pointing me into the right direction, I already have an open bug report at NI since a few weeks.
Don’t have reactor to test it, but what could be better than using apples AU plugins and AUSampler also have the same issue, while DLSMusicDevice works and changes the sample rate. I have reported this new infos and hope NI will fix that.

I just got the same issue reported by a user, and I can reproduce it with the latest juce develop version with the AudioPluginDemo, and Maschine 2.9.0.

Maschine is configure for a 48kHz sample rate, so the AU plugin should be running at 48kHz, but its prepareToPlay is always be called with 44kHz as the sample rate. The VST plugin receives the correct sample rate.

Also, older versions of my AU plugin (build with JUCE v3) run fine, with the correct sample rate. Maybe it is a problem with the CoreAudioUtilityClasses embedded with juce.