I’m currently working on my first JUCE library, targeting both Android and iOS.
I try to understand how to play a simple white noise, so I read this tutorial.
But reading the demo project, I can see that the main class inherits from
juce::AudioAppComponent which, as far as I understand, provides a user interface.
But since I’m working on a library, I don’t want that user interface, so I’m looking for a way to play that white noise as shown in that tutorial, but without user interface.
I found out that there are also
AudioProcessor that could help me do the job, but I don’t really know what to use and where to start.
So how can I write a very basic white noise generator for a library (without any user interface, then)?
The AudioAppComponent is simply a Component having an AudioDeviceManager and an AudioSourcePlayer.
What I would do in your case is creating a class/struct that doesn’t inherit Component:
source = std::make_unique<juce::ToneGeneratorAudioSource>();
player = std::make_unique<juce::AudioSourcePlayer>();
deviceManager.initialise (0, 2);
And then just replace the ToneGeneratorSource with a custom AudioSource that creates the sound you want to have.
Hope that helps
I can’t try that yet because of this, but I will as soon as I find a solution.