We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSound,  Music Libraries › Minim loop() problems
Page Index Toggle Pages: 1
Minim loop() problems (Read 1199 times)
Minim loop() problems
Dec 11th, 2008, 2:49am
 
I'm having a problem looping from an AudioSnippet in Minim. If I call loop() with a small value (i.e. snip.loop(1) or snip.loop(0) ) I get a continuing tiny fragment of sound playing at a regular interval -- it sounds like a tiny chunk from the looped audio. Looping anything more than three times, however (i.e. snip.loop(3) ) works fine. This occurs regardless of:

a) the location of the loop() call in the file
b) the length of the audio file
c) the length of the looped segment

The code below produces the error on my machine (just replace 'sample.wav' in the loadSnippet() call with a file longer than 1000ms).

What I would like to do is play specific short samples (or excerpts) from a longer AudioSnippet, *once through*. I have tried using cue() and then play() but I can't figure out a reliable way to trigger a pause() event at the desired end point of the sample.



import ddf.minim.signals.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;

Minim minim;
AudioSnippet snip;
int startPoint;
int endPoint;


void setup(){
 size(100,100);
 background(255);
 fill(0);
 
 minim = new Minim(this);
 snip= minim.loadSnippet("sample.wav");
 
 startPoint = 500;
 endPoint = 1000;
 
 snip.setLoopPoints(startPoint, endPoint);
 snip.loop(1);
}

void draw(){
 background(255);
 fill(0);
}

void stop(){
 minim.stop();
 snip.close();
 super.stop();
}


I'd be really grateful if anyone could help me out with this -- or point out another way to do what I'm trying to do.

Thanks.
Re: Minim loop() problems
Reply #1 - Dec 12th, 2008, 4:52am
 
On a different machine, it seems to not occur. Machine 1 (problem) is slower, Windows 2K; Machine 2 (no problem) is a fast Intel Mac running Leopard. Would love to hear from anybody who can / cannot reproduce the issue on their machine to help figure out what's causing this...
Re: Minim loop() problems
Reply #2 - Dec 14th, 2008, 8:21am
 
In case it's useful to anyone else, using (snip.isPlaying() == false) in the draw() loop to trigger the next sample to play seems to actually be working so far...
Page Index Toggle Pages: 1