Sample Buffer Manipulation and C++ Noobs


#1

Hello Juce,

I've discovered the Juce library a few months ago while trying to figure out how to do GUis in C++ and I have to say this stuff is fantastic! Since I'm a relative noob (not a complete noob) in C++, this was very useful for me to get my feet wet and I've learned a great deal since I started but now, I admit I've hit a snag and I need a bit of help: I've been through the forums, I've been in the API, I've walked through the sample code, but alas no clear answer...

Here is my problem: I'm building a stand-alone application that will enable me to modify sounds files in real time. It's not a plugin, but I consider it close enough to have added my question in the plugin section of the forum...

I've managed to create a basic gui with sliders and buttons, and using the method described in the "getting started with juice" ebook, managed to implement a basic audio file player; It selects, plays, stops, starts again, hooray! What I'm now trying to do is the basic and common thing: "woudln't it be cool if I could modify the samples in real time? How educational and exciting!" So my problem is simple enough, how do I access this buffer? Like I said, I looked at the forum, the APi, the demo code, I saw some answers coming close, but I still can't get my hands on it...

I tried extending the audioSourcePlayer class and the AudioIODeviceCallback but I'm not going anywhere with that, because the function relies on private members. The way the objects interact to produce sound is still quite shady...

I'm stumped; can someone show me a step by step? This audio buffer is my White Whale... I'd like to stay as close as possible to the demo code from the book, as it works well for me up to now...

Thanks! smiley

 


#2

To do it in real time you want to get a stream of AudioSampleBuffers, probably in a dedicated audio processing thread.  I suppose you could inheret the AudioSource base class, implement a file reader and your manipulation routines inside it. 

In your AudioSource derivation you might try using AudioFormatManager and AudioFormatReader to give you access to your input data ...

BufferingAudioReader also looks useful, but I've never used it. 

Hope that's a start ... ! J. 


#3

If it starts to get complicate there are a bunch of other classes to look at too: AudioProcessor and AudioProcessorGraph. I've also just noticed AudioTransportSource which might be useful... 

Sorry - it's not a very specific reply :)