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: SetGain works but ShiftGain does not
Page Index Toggle Pages: 1
Minim: SetGain works but ShiftGain does not (Read 1549 times)
Minim: SetGain works but ShiftGain does not
May 17th, 2010, 2:35pm
 
The following code works.

Code:

import ddf.minim.*;

Minim minim;

AudioSnippet soundNoise_loop;

void setup()
{
 
 minim = new Minim(this);

 soundNoise_loop = minim.loadSnippet("waves01_loop.mp3");
 
 soundNoise_loop.loop();    
 
}

void draw()
{
}

void keyReleased()
{
if ( key == 'g' )
{
soundNoise_loop.setGain(-50);
}
}

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



The gain is instantly reduced to -40.  There is an audible, obvious difference.

However, if I change the setGain to shiftGain, like so:

Code:

void keyReleased()
{
if ( key == 'g' )
{
soundNoise_loop.shiftGain(0, -50, 4000);
}
}


...it does not work.  nothing happens.

What am I doing wrong?
Re: Minim: SetGain works but ShiftGain does not
Reply #1 - May 17th, 2010, 4:05pm
 
shiftGain works when I use audioPlayer instead of audioSnippet.

However, this is not ideal, because I want the file to loop and minim has latency issues audioPlayer.
Re: Minim: SetGain works but ShiftGain does not
Reply #2 - May 17th, 2010, 4:11pm
 
It also seems to work for AudioSample...
Page Index Toggle Pages: 1