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.
Page Index Toggle Pages: 1
synthesized samples (Read 618 times)
synthesized samples
Apr 1st, 2008, 6:14pm
 
Hello !

I'm working on a project that needs about 10 generated small samples (about 1 or 2 seconds long each) to be played from time to time, and sometimes generated again with some modifications.
I first tried to use ess but had a lot of problems with it, especially of latency. Now, I want to try with Minim.


With Ess, I would do something like this :

Quote:

float[] sound = new float[50000];
AudioChannel chan= new AudioChannel();

void generateASound() {
 //generates a sound here
 //and puts it into sound[]
 setTheSound();
}

void setTheSound() {
 chan.initChannel(sound.length);
 for (int i=0;i<sound.length;i++) {
   chan.samples=son[i];
 }
}

void playTheSound() {
 chan.play(1);
}


And then call generateASound() and playTheSound() when needed.


Is there an equivalent of this in Minim ? (Note that I want to synthesize the sounds, not to load them from files).
I tried to put separate parts of the sounds directly in each successive AudioOutput buffers but I heard a little clic between each buffer.
Is there a way to set arrays of values between -1 & 1 into AudioSample objects and then simply trigger them when they have to be played ?

Re: synthesized samples
Reply #1 - Apr 2nd, 2008, 4:06am
 
Oh, no, there isn't a way to do that. But there should be. This is where I wish that I had a standard feature request thingy for Minim because I never remember this kind of shit when I'm working on it.
Re: synthesized samples
Reply #2 - May 30th, 2008, 2:47am
 
I have also been wanting to do that.
The closest I've come was using ESS to create an audio channel  and using the stop() and play() methods. This is not good, though, because the sounds can't overlap and it creates a pop in the sample.
Page Index Toggle Pages: 1