Closed limikael closed 13 years ago
Hi Mikael
Unfortunately it is a limitation of the library right now, that all Performances and most Sources want to be played sequentially, from the beginning.
In most implementations of things like this, what people do is have another data structure that represents the actual sequence, or score. Every time the user hits play, you realize a new ListPerformance for that playback. You would create that performance so that it starts at the right time, and has the right sources in it for the immediate context.
In some cases, that realization continues to happen dynamically just in time, ie if the sequence loops endlessly.
If you are mainly sequencing simple samples, it may also help you to create a wrapper Source around Sample that can understand that it should play only a small section of it, and serve the right sample frames.
Thanks for the quick reply!
Thinking about it a bit further, that's probably a good limitation since it makes it easier to implement filters and such, if the filters can assume that things starts to play form the start.
I ended up doing as you suggested, by creating a class that I called RandomAccessSequence where it is possible to sequence IRandomAccessSource objects at various positions, and it is inself a IRandomAccessSource. This works fine SoundSource objects implement IRandomAccessSource.
I also created a class class RandomAccessPerformer which implements IAudioSource, in order to acuallt play it, and possible add effects. This class also has a settable offset to be used in this case.
Also as you suggested I created such a wrapper class (actually I have it implemented also). This one is called TrimmedSoundSource, and has properties to cut the sound in both ends.
If you want I'm happy to send you these classes in case it is something that can be included in future versions.
// Micke
On Fri, Jul 8, 2011 at 4:39 PM, maxl0rd reply@reply.github.com wrote:
Hi Mikael
Unfortunately it is a limitation of the library right now, that all Performances and most Sources want to be played sequentially, from the beginning.
In most implementations of things like this, what people do is have another data structure that represents the actual sequence, or score. Every time the user hits play, you realize a new ListPerformance for that playback. You would create that performance so that it starts at the right time, and has the right sources in it for the immediate context.
In some cases, that realization continues to happen dynamically just in time, ie if the sequence loops endlessly.
If you are mainly sequencing simple samples, it may also help you to create a wrapper Source around Sample that can understand that it should play only a small section of it, and serve the right sample frames.
Reply to this email directly or view it on GitHub: https://github.com/maxl0rd/standingwave3/issues/14#issuecomment-1532799
Good approach. I'm sure that will work well!
Enjoy.
I would like to start the playback from a random position, when I'm using a ListPerformer to sequence a number of samples.
I.e. what I have is a ListPerformer object (here called _listPerformance), and I'm doing something like:
var audioPerformer:AudioPerformer=new AudioPerformer(_listPerformance,new AudioDescriptor()) var audioPlayer:AudioPlayer=new AudioPlayer(); var audioPlayer.play(audioPerformer);
And I would like the playback to start, not from the beginning but from a time later in the list.
I have read about the CacheFilter and thought that this could be a possible option, but my understanding of the CacheFilter is that it will have to process all the audio up to the point I want to play, probably causing some notable delay.
So what is the best way to go about this?
Thanks for a great lib!