Can a sampler play multiple audio files simultaneously?

In a sampler/synth, is it possible to have each midi note play two audio files and determine the volume of each of those audio files? For example, user hits MIDI note C and the sampler would play audiofile1 at 40% and audiofile2 at 60%.

So, with some code such as this:

juce::OwnedArray<juce::Synthesiser> synth;

juce::SynthesiserSound::Ptr sound1 = new juce::SamplerSound ("audiofile1", *formatReader, midiNotes, 0x40, 0.0, 0.0, 5.0);
juce::SynthesiserSound::Ptr sound1 = new juce::SamplerSound ("audiofile2", *formatReader, midiNotes, 0x40, 0.0, 0.0, 5.0);

synth[channel]->addSound(sound1);

What would I do next to get sound2 to be played simultaneously and how can I blend the two audio files?

Thank you in advance.

Two Synth objects into a mixer object… or create your own copy of the Synth class and add a second file, but you will still need to mix them. btw, there is bug in the code you posted. you are reusing sound1 for audiofile2

I haven’t used a mixer object yet. Do you know of any examples or tutorials that would show how to use it to blend synth objects?

You can start with the docs: JUCE: MixerAudioSource Class Reference

I’ll post again if I find any example code for you.

This post has some code along with it’s question. I don’t know if it will be helpful.