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 audioplayer volume change
Page Index Toggle Pages: 1
minim audioplayer volume change (Read 8542 times)
minim audioplayer volume change
Oct 23rd, 2008, 6:10pm
 
hello,

how does minim work to set the volume in runtime for a audioplayer object? or even a AudioSample ?

ive tried setVolume and setGain, but none of them works directly.
Re: minim audioplayer volume change
Reply #1 - Oct 28th, 2008, 2:01am
 
One of those two *should* work, but whether or not either control is available depends on the Java implementation you are running on. You call the method on the AudioPlayer you want to change the volume of:

AudioPlayer play;

...

play.setVolume(0.5);
Re: minim audioplayer volume change
Reply #2 - Oct 28th, 2008, 9:34pm
 
ive check the range values for the gain and i was able to use setGain to change the volume for the application.

as for setVolume, didnt work for the wavesignals or even audioplayer.

it said that setvolume was not supported or so, in a error message.

where is it supported after all ?
Re: minim audioplayer volume change
Reply #3 - Oct 29th, 2008, 2:56am
 
I'm having the same problem on Leopard 10.5.5 using Processing 0154 - setVolume() doesn't work. What Java implementation should I be using in order for this to work?

Also, when using setGain(), I get clicks as I change the gain. Any way to interpolate more smoothly?

best,
Zachary
Re: minim audioplayer volume change
Reply #4 - Nov 7th, 2008, 9:16am
 
Like zseldess says,

What Java implementation should we be using?

Tnx alot.
Re: minim audioplayer volume change
Reply #5 - Nov 18th, 2008, 5:45am
 
bump...

Well, I've switched to Sonia for this. Volume changes and panning are far smoother (click free).

Still wondering if there's a way to fade and pan in minim without clicks (guessing the cause of this is that the signal is not being modified at the sample rate).

Zachary
Re: minim audioplayer volume change
Reply #6 - Nov 25th, 2008, 4:50am
 
Yes, if all you are doing is setting volume or pan directly, you risk clicks. If you want it to change smoothly, you either need to interpolate the value over time yourself, or try using shiftPan or shiftVolume.

As far as which Java version to use to get a Volume control, I don't really know. I can't keep tabs on those things. At some point I may do my own implementations of these controls so that it won't be JVM dependent, we'll see.
Re: minim audioplayer volume change
Reply #7 - Jun 2nd, 2010, 11:23pm
 
i tryed the code:


import ddf.minim.*;

Minim minim;
AudioPlayer player;

void setup(){
   minim = new Minim(this);
   player = minim.loadFile("foo.mp3");
   player.loop();

   println(player.getControlls());
}



and then, i got messages below:


[0] Master Gain with current value: 0.0 dB (range: -80.0 - 13.9794)
[1] Mute Control with current value: False
[2] Pan with current value: 0.0  (range: -1.0 - 1.0)
[3] Sample Rate with current value: 44100.0 FPS (range: 0.0 - 48000.0)


these messages mean that Gain, Mute, Pan and Sample Rate are available on AudioPlayer.

According to [0],

   player.shiftGain(-80.0, 0.0, 10000);

   player.setGain(-10.0);

   player.mute();

   player.unmute();

will go fine Smiley


Gain's unit is dB and range is -80.0 to 14.0. Note that it has very large range in contrast to Volume (0.0 to 1.0). (the range maybe depends on your environment)
Page Index Toggle Pages: 1