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 mixer ( try to use a arbitrary audio channel
Page Index Toggle Pages: 1
minim mixer ( try to use a arbitrary audio channel (Read 962 times)
minim mixer ( try to use a arbitrary audio channel
Apr 16th, 2010, 10:08am
 
Hi, im try to use the mixer in mimi to send sond to different output

here a small sample (a little cut up of aother sample find on the net)

import ddf.minim.*;
import ddf.minim.signals.*;

import javax.sound.sampled.*;

Minim minim;
AudioOutput out;
MouseSaw msaw;
Mixer.Info[] mixerInfo;
Mixer.Info mi;


int m;


void setup()
{
size(512, 200);

minim = new Minim(this);

mixerInfo = AudioSystem.getMixerInfo();
for(int i = 0; i < mixerInfo.length; i++) {println (i+" "+mixerInfo[i].getName());}
m=3;
println("info mixer:"+m);
Mixer mixer = AudioSystem.getMixer(mixerInfo[m]);
mi=mixer.getMixerInfo();
println ("desc:"+mi.getDescription());
println ("name:"+mi.getName());

minim.setOutputMixer(mixer);

out = minim.getLineOut(Minim.STEREO, 2048);
msaw = new MouseSaw();  
out.addSignal(msaw);

}

void draw()
{
background(0);
}



void stop()
{
if ( out != null ) {out.close();}
minim.stop();

super.stop();
}



class MouseSaw implements AudioSignal
{
void generate(float[] samp)
{
  float range = map(mouseX, 0, width, 0, 1);
  float peaks = map(mouseY, 0, height, 1, 20);
  float inter = float(samp.length) / peaks;
  for ( int i = 0; i < samp.length; i += inter )
  {
    for ( int j = 0; j < inter && (i+j) < samp.length; j++ )
    {
      samp[i + j] = map(j, 0, inter, -range, range);
    }
  }
}

// this is a stricly mono signal
void generate(float[] left, float[] right)
{
  generate(left);
  generate(right);
}
}


i got

processing.app.debug.RunnerException: IllegalArgumentException: Line unsupported: interface SourceDataLine supporting format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian

BUT...
if i comment out the red line all works.

Any hints?
Page Index Toggle Pages: 1