Can JUCE play multiple audio simultaneously?

i’ve tried using superpowered SDK for playing multiple audio simultaneously and it’s really good. But i wonder if JUCE can also do that?

Audio in the digital world is usually passed in callbacks.

So the audio driver/OS/DAW/etc are calling your program with a callback once in a while, and giving it some memory for your program to fill with any kind of audio to play back.

If you write your program in such a way where the memory passed in would contain multiple audio tracks mixed summed into the array, then that’s what you’d hear.

You can look at the different AudioSources juce provides by default, as well as SamplerVoice for a synth, to get some idea on how that could be implemented.

so do u mean, i’ll need some algorithm to play the audios simultaneously in sync? JUCE not out of the box playing simultaneously? i’ve tried using superpowered SDK and it’s working out of the box, but the license was too expensive

You don’t need any special algorithm to play multiple files simultaneously.

You can use the existing mechanisms that play one audio file, and write a for loop or an array of objects that plays many of them and mixes them together.

This is pretty trivial stuff once you get to know how C++/digital audio works, and obviously there are already many commercial plugins and DAWs (like Tracktion Waveform) that play multiple audio files using JUCE.

So, start learning - you can look at the existing JUCE demo runner to see how the code for playing audio files look like, for example with AudioPlaybackDemo.

when using Superpowered, i just create 3 instances of audio player, then assign each file to each audio player then play all of them at the same time in 1 function. That should applied with JUCE too right?

Maybe you need to clarify, what exactly you are trying to do.

Is this a single app that you run multiple times? That works out of the box in juce too.

Do you want to create some kind of instrument, where you play different notes? There are building blocks to achieve that. But there are too many ways to do that to provide a one-fits-all solution.

Do you want to write a DAW for multiple tracks and audio plugins? That is also possible, e.g. Tracktion Waveform is written in JUCE, and quite a few others as well.

It really depends on your use case, how much you need to write yourself.

no, the app i need to create is about, playing some jazz songs, each song has multiple instruments and each instrument recorded into a single mp3 file. when user play the song, it’ll play all of the instruments simultaneously.

Using superpowered is a success, but the problem is the license price. So i want to try JUCE now

Why not just use a DAW, then? Drop the files onto tracks and hit play. There are free versions of several, and cheap versions of others. Look around.

do u mean create something like DAW? i don’t understand