Mixing AudioTransportSources


#1

I’m working on a little desktop application to play back a set of audio files. Currently it sets up several instances of a modified version of the AudioDemo class from JuceDemo, connects the AudioTransportSources to a MixerAudioSource, connects the Mixer to the AudioSourcePlayer, and AudioSourcePlayer to AudioDevice. This all works beautifully.

I’m interested in doing some processing on the AudioTransportSources before they reach the Mixer, as well as processing the composite stream after it’s mixed. For now, I’d like to do a couple of simple things like altering the volume and panning of the individual and composite streams. Maybe also compute the RMS to display a simple VU meter.

I realize I could handle volume using AudioTransportSource::setGain, but I’m instead wanting to set up a framework with which I could later do some more complex processing.

How do you suggest that I go about this so as to properly fit into the Juce model? Should I subclass AudioTransportSource and MixerAudioSource, and, in each, reimplement getNextAudioBlock() ? Or is there some sort of AudioSource filter mechanism I’m not currently seeing?

Any suggestions would be most appreciated. Thanks.


#2

The way to do it is by adding your own AudioSources into the chain - e.g. you could write a simple volume-change audio source and stick it before the output, forming a filter graph.


#3

Hey Jules,
I too am developing an application that seems to be implemented in a similar form to smokris’ app, and I too would like to start building my own effect processors (gain, pan, delay, distortion etc…) classes that I can then apply to individual AudioSource before they have been mixed together.

As I noticed this Thread is 6 years old, I thought I should make sure that your original answer is still the best way of going about this?
Could you please provide a simple of example of where the ‘processing’ code would go?
Thanks


#4

Yes, it’s still a valid answer! Your processing just goes in AudioSource::getNextAudioBlock()


#5

That makes sense. Cheers Jules!


#6