Annonce

>>> Bienvenue sur codelab! >>> Première visite ? >>> quelques mots sur codelab //// une carte des membres//// (apéros) codelab


#1 2011-01-10 11:23:24 processing et Jsyn

oyster_twiter
membre
Lieu: saint-herblain
Date d'inscription: 2008-04-01
Messages: 444
Site web

processing et Jsyn



pour ceux qui souhaiterai utiliser la lib jsyn (http://www.softsynth.com/jsyn/) avec processing, j'ai trouvé ce tuto sur la liste jsyn :

citation :

* find the "libraries" folder in your master Processing sketches folder:
/myProcessingSketchesFolder/libraries

* make a "jsyn" folder inside of libraries:
/myProcessingSketchesFolder/libraries/jsyn

* make a "library" folder inside of jsyn:
/myProcessingSketchesFolder/libraries/jsyn/library

* put the pure jsyn.jar inside of library
/myProcessingSketchesFolder/libraries/jsyn/library/jsyn.jar


Now run Processing, start a new sketch and do Sketch->Import Library and you should see jsyn as an option. Select it and it'll do a dumb import of everything in JSyn. You don't need this, it's just to verify that Processing sees JSyn.

Now you can just use JSyn as usual. Here's an example sketch:

import com.jsyn.engine.SynthesisEngine;
import com.jsyn.unitgen.LineOut;
import com.jsyn.unitgen.SineOscillator;

SynthesisEngine synth;
SineOscillator osc;
LineOut lineOut;

boolean jsynRunning = false;

void setup()
{
  size(1000, 100);
  smooth();

  //Create a context for the synthesizer.
  synth = new SynthesisEngine();
  //Add a tone generator.
  synth.add( osc = new SineOscillator() );
  //Add an output mixer.
  synth.add( lineOut = new LineOut() );
  //Connect the oscillator to the output.
  osc.output.connect( 0, lineOut.input, 0 );
  // Start synthesizer using default stereo output at 44100 Hz.
  synth.start();
  //We only need to start the LineOut. It will pull data from the oscillator.
  lineOut.start();
  jsynRunning = true;
}

void draw()
{
  if (mousePressed)
    fill(0);
  else
    fill(255);

  osc.frequency.set(mouseX);

  ellipse(mouseX, mouseY, 20, 20);
}


void mousePressed()
{
    if (jsynRunning)
    {
      lineOut.stop();
      jsynRunning = false;
    }
    else
    {
      lineOut.start();
      jsynRunning = true;
    }

}

void stop() {
  print("killing jsyn...");
  synth.stop();
  print("bye.");
}

merci douglas irving !

citation :

............................................... http://artbots.org
.....douglas.....irving........................ http://dorkbot.org
.......................... http://music.columbia.edu/cmc/music-dsp
.......... repetto............. http://music.columbia.edu/organism
............................... http://music.columbia.edu/~douglas

Hors ligne

 

fil rss de cette discussion : rss

Pied de page des forums

Powered by FluxBB

codelab, graphisme & code : emoc / 2008-2024