Loading...
Logo
Processing Forum
Hi all,

I'm having a bit of trouble with setting the pan on an AudioSample object using Minim. Whenever I try to get the controls available for the object, it says that it only has gain and mute controls, although the documentation states that AudioSample, AudioSnippet and AudioPlayer should have pan controls. Am I doing something wrong here?

Replies(2)

Hi ceebux,
I'm fairly new to using processing and the minim library, but i noticed your question and i think i figured out a way of setting pan control to each audio sample.

I quickly loaded up the AudioSample (Drum Machine example sketch from the minim library), and i adapted some of the code from the sinewave example sketch.

The Drum Machine example has 3 sounds,  kick, hat and snare. I managed to set the pan of each sound to left, right or center.

As you probably know, the pan value range is from -1.0 (left)     0.0 (centre)  and 1.0 (right)

I added the following code to the Drum Machine (minim example). Hopefully you can adapt it for your code, you'll need to replace the kik/hat/snare names with the names of the samples you want to pan.

//add the following code before void setup
float pankick = 0.0;  // Kick drum panned to the centre, using value 0.0
float panhat = 1.0;  // hihat panned to the right, using the value 1.0

float pansnare = -1.0;  // snare panned to the left using the value -1.0

//add the following code to the void setup section
kick.setPan(pankick); 
snare.setPan(pansnare);
hat.setPan(panhat);


Once again i'm not an experienced programmer and still have a lot to learn, but hopefully the code above will help you.

The controls provided by all of the classes you mention are a Control class that Javasound defines. There are a set of controls that *could* be available, but it is not guaranteed that they will all be available on all systems. If you are finding that you don't have a Pan control, then I can only assume there just isn't one available for the version of Java you are using. It does seem weird, though, I agree. It's been in the back of my mind to fix this by not using the Controls that are automatically created and to simply implement my own versions of the Controls so that they are all always available. It's been a bit low on the priority list, though.