How to get multiple audio outputs with minim?

edited February 2014 in Library Questions

Hi there,

for the art project Global Sounds (http://www.picaroon.eu/work.html ) I would need 7 separated audio outputs, so that every pyramid has one speaker and plays one instrument (=one mp3). I was wondering if I could use the minim library together with an audio interface somehow? Any ideas/suggestions?

Thank you very much in advance!! Rebecca

Tagged:

Answers

  • edited March 2014

    If we had something like asio implemented for Processing, this would become easier. I'm not sure how it would work with directsound or anything other than asio really. It is most probably possible with minim though. Either way, interesting question... If you're dealing with audio files, Minim by default creates a stereo output in the AudioPlayer class. It is possible to reconfigure the AudioPlayer class and create seven individual channels. It requires a little bit of Java code but is relatively straight forward to pick up on if you know the basics of Java. An issue I think you would be dealing with here is deciding how your buffer is going to process the audio for seven speakers simultaneously in real-time. You inevitably would have to put some thought into the DAC. Basically you have to go through the classes you want and implement a surround option. The audioutils which is part of the toxiclibs library is also something you might want to play with. You might be able to use instances to solve the problem. Hope this helped!

  • Thanks for your reply! Actually, I resolved the problem by using 7 external USB-Sound Cards and a code based on the setOutputMixer-example.

    That's the code:

    import ddf.minim.*;
    import ddf.minim.signals.*;
    import controlP5.*;
    import javax.sound.sampled.*;
    import ddf.minim.ugens.*;
    
    Minim              minim;
    Minim              minim2;
    Minim              minim3;
    MultiChannelBuffer sampleBuffer;
    MultiChannelBuffer sampleBuffer2;
    MultiChannelBuffer sampleBuffer3;
    
    AudioOutput        output;
    AudioOutput        output2;
    AudioOutput        output3;
    Sampler            sampler;
    Sampler            sampler2;
    Sampler            sampler3;
    
    Mixer.Info[] mixerInfo;
    
    AudioPlayer player;
    AudioPlayer player2;
    AudioPlayer player3;
    void setup()
    {
      size(512, 200, P3D);
    
      // create Minim and an AudioOutput
      minim  = new Minim(this);
      minim2  = new Minim(this);
      minim3  = new Minim(this);
    
      mixerInfo = AudioSystem.getMixerInfo();
    
      for(int i = 0; i < mixerInfo.length; i++)
      {println(i + " = " + mixerInfo[i].getName());} 
    
      Mixer mixer = AudioSystem.getMixer(mixerInfo[2]);
      minim.setOutputMixer(mixer);
      output = minim.getLineOut();
    
      Mixer mixer2 = AudioSystem.getMixer(mixerInfo[3]);
      minim2.setOutputMixe1r(mixer2);
      output2 = minim2.getLineOut();
    
      Mixer mixer3 = AudioSystem.getMixer(mixerInfo[1]);
      minim3.setOutputMixer(mixer3);
      output3 = minim3.getLineOut();
    
      sampleBuffer     = new MultiChannelBuffer( 1, 1024 );
      player = minim.loadFile("1.mp3"); player.play();
    
      sampleBuffer2     = new MultiChannelBuffer( 1, 1024 );
      player2 = minim2.loadFile("2.mp3"); player2.play();
    
      sampleBuffer3     = new MultiChannelBuffer( 1, 1024 );
      player3 = minim3.loadFile("3.mp3"); player3.play();
    
    }
    
  • Hi Picaroon, Which USB cards did you use? I found some on amazon but they are so cheap (<£2) that I sceptical whether I found the right ones. Are you using them on a mac/linux/windows? Thanks

  • Hey guys,

    I need to some help... I would like to send audio from Max to Processing (using Minim) by SoundFlower. I need to use 4 in/out but i can set only the device and not the single outputs and inputs. Is there any possibility to set each in and out? Thank you so much

  • don't post questions in multiple places, it just confuses people, they don't know which one to answer.

    and don't hijack other people's threads. nobody's looking at a thread last update 18 months ago.

Sign In or Register to comment.