Looping large files


#1

Hello guys, found a tutorial on Discover Juce(http://www.juce.com/doc/tutorial_looping_audio_sample_buffer) how to loop a very short audio. But I faced with a problem how to loop larger audio, that I need to store in AudioBuffer, for ex 15 seconds long. I will be very thankfull if you give me some code example, because I'm very new to JUCE.
 


#2

This is so very vague. Perhaps if you explained the problem someone might be able to help.


#3

Oh, sorry about it. Okay, I'll try. If I use the example given above, I will be able to loop only 2 seconds stereo sound. I need to get rid of limitation. And my question is very simple: "How to do it?"
For example, I'm gonna loop 10 seconds stereo file.


PS:Removing if with length 2 doesn't help.


#4

The tutorial writes, why it is limited, because reading inside the message thread blocks the application.
So keep on reading, later on it is explained, how to read in the background: http://www.juce.com/doc/tutorial_looping_audio_sample_buffer_advanced#tutorial_looping_audio_sample_buffer_advanced_reading_the_audio_background

(jumping directly to that point will probably not help you much. There are several steps explained... It is unfortunately not to be solved by simply adding a parameter...)

HTH


#5

The length of 2 seconds is very arbitrary, it's just there to get you to think about whether loading an entire file into a AudioBuffer is really what you want. For "long" files you should probably stream them and use an AudioTransportSource and related classes http://www.juce.com/doc/tutorial_playing_sound_files

You'll need to modify things a bit to get this to work in a plug-in context but the principles are the same.