Méthode Processing
IconeProcessingPetithttps://processing.org/
 
Free - Open Source
MacOSX Linux Windows  Supported platforms  
 
Installation sous MacOSX (X.6)

0 "Processing requires OS X 10.5 or later. It may run on 10.4, but we won't be fixing bugs with OS X 10.4, because we only have so much free time. Processing is no longer supported PowerPC machines. I've sold my PowerPC Mac, and you should too."
 
1 Téléchargement de Processing (v1.5.1) -> processing-1.5.1-macosx.zip (50.5Mo) (15 5 2011)
 
2 Installation de Processing
  - 2 x clic processing-1.5.1-macosx.zip -> Processing.app
  - Placer Processing.app dans le dossier Applications du Mac
 
3 Lancement de Processing: un dossier:
   /Users/..vous../Documents/Processing
   est créé. C'est la "Sketchbook location".
   Son emplacement est modifiable dans les Preferences de Processing
 
4 Les exemples sont dans:
   (Sélectionner Processing.app -> Clic droit -> Afficher le contenu du paquet)
   /Applications/Processing.app/Contents/Resources/ Java/modes/java/examples
   et dans:
   /Applications/Processing.app/Contents/Resources/ Java/modes/java/libraries
 
5 Ajout de library ("Contributed library") dans le dossier:
   /Users/..vous../Documents/Processing/libraries/
   Créer au besoin ce dossier "libraries"
   Voir plus bas "Library"
 
 
Installation sous Linux (Ubuntu 10.04)

1 Téléchargement de Processing (v1.5.1) -> processing-1.5.1-linux.tgz (91.2Mo) (15 5 2011)
 
2 Installation de Processing
  - Clic droit processing-1.5.1-linux.tgz -> Extract Here

3 Lancement de Processing:
  - Ouvrir le dossier "processing-1.5.1"
  - 2 x clic processing (Type: shell script)
    -> Run ->
    -> Select (or create new) folder for sketches...
    Un dossier /home/p/sketchbook est créé. C'est la "Sketchbook location".
    Son emplacement est modifiable dans les Preferences de Processing

4 Les exemples sont dans:
               /processing-1.5.1/modes/java/examples/
   et dans  /processing-1.5.1/modes/java/libraries/
 
5 Ajout de library ("Contributed library") dans le dossier:
   /home/p/sketchbook/libraries/
   Créer au besoin ce dossier "libraries"
   Voir plus bas "Library"
 
 
Installation sous Windows (7)

1 Téléchargement de Processing (v1.5.1) -> processing-1.5.1-windows.zip (89.0Mo) (15 5 2011)
 
2 Installation de Processing
  - Clic droit processing-1.5.1-windows.zip -> Extraire tout...
  - Ouvrir le dossier "processing-1.5.1-windows"
  - Glisser le dossier "processing-1.5.1" dans C:\Programmes\
  - Créer un raccourci de C:\Programmes\processing-1.5.1\processing.exe (sur le bureau par exemple)
 
3 Lancement de Processing:
  - 2 x clic processing.exe ou son raccourci
  - Un dossier   C:\Users\p\Documents\Processing
                ou  C:\Utilisateurs\p\Mes documents\Processing
    est créé. C'est la "Sketchbook location".
    Son emplacement est modifiable dans les Preferences de Processing
 
4 Les exemples sont dans:
   C:\Program Files\processing-1.5.1\modes\java\examples\
   C:\Programmes\processing-1.5.1\modes\java\examples\
   C:\Program Files\processing-1.5.1\modes\java\libraries\
   C:\Programmes\processing-1.5.1\modes\java\libraries\
 
5 Ajout de library ("Contributed library") dans le dossier:
   \Mes documents\Processing\libraries\
   Créer au besoin ce dossier "libraries"
 
 
Documentation
 
- Processing - le langage:
    - Par thèmes -> https://processing.org/reference/ ou Processing -> Menu Help -> Reference
    - De A à Z     -> http://processing.org/reference/alpha.html ou Processing -> Menu Help -> Reference -> A-Z
 
- http://processing.org/learning/
 
- flossmanual français
 
- Learning Processing: A Beginner's Guide to Programming Images, Animation, and Interaction de Daniel Shiffman.
 
- Wiki: http://wiki.processing.org/
 
- Forum: http://forum.processing.org/
 
- OpenProcessing
 
 
Début
 
- Sketch (= Croquis) = Programme
  Sketchbook = dossier ou on met tous les programmes
  Voir son emplacement dans Preferences et ci-dessus.
 
- Les fichiers Processing ont l'extension .pde
 
ScreenProcessing

- Attention le nom d'un sketch ne peut pas commencer par un nombre

- Aide interne: Sélectionner une commande -> Clic droit -> Find in reference -> ...
 
- Exemple:
void setup();
{
// Exécuté 1 seule fois
}

void draw()
{
// Exécuté 30 x / sec par défaut
}
setup() "Called once when the program is started. Used to define initial enviroment properties such as screen size, background color, loading images, etc. before the draw() begins executing. Variables declared within setup() are not accessible within other functions, includingdraw(). There can only be one setup() function for each program and it should not be called again after it's initial execution."
 
draw() "Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called...There can only be one draw() function for each sketch and draw() must exist if you want the code to run continuously or to process events such as mousePressed()."

The size() function must be the first line in setup().
 
Menu Edit -> Auto Format
  
 
 
 
Syntaxe
- // Commentaire
- size(500,500);    Defines the dimension of the display window in units of pixels.
- frameRate(3);   
- background(0);    
- smooth();    smooth (anti-aliased) edges (Geometry, Images et Fonts)
- point(200,100);   point(x, y)   point(x, y, z)
- line(0,0,500,500);    line(x1, y1, x2, y2)    line(x1, y1, z1, x2, y2, z2) To color a line, use the stroke() function.
- stroke(126);  stroke(gray) stroke(gray, alpha) stroke(R,V,B) stroke(R,V,B, alpha) Contours
- noStroke();    Pas de contour
- ellipse(250,250,100,500);    ellipse(x, y, width, height)
- rect(30,30,440,60);    rect(x, y, width, height)
- rectMode(CENTER);    CORNER, CORNERS, CENTER, or RADIUS
- fill(255);  fill(255,0,0,1);    fill(gray)    fill(gray, alpha)    fill(R, V, B)    fill(R, V, B, alpha)    (0 < gray R V B <255)
- triangle(150,200,100,300,200,300);    triangle(x1, y1, x2, y2, x3, y3);
- bezier(111,222,333,444,11,22,33,44);    bezier(x1, y1, cx1, cy1, cx2, cy2, x2, y2);
- random(10);   ->   0=< float < 10       (int) random(10);    ->   0=< integer < 10
- tint(255,0,0);   Colorer une image    tint(gray)    tint(gray, alpha)    tint(R,V,B)    tint(R,V,B, alpha)

 
- if (mousePressed == true) {    }
- void mousePressed() {    }

- saveFrame();   saveFrame("image-####.jpg");    Sauve 1 frame dans le Sketch Folder
  On peut le mettre dans: void draw() {    }    --> 1 fichier par frame
  On peut le mettre dans: void mousePressed() {    }
 
- Menu Sketch -> Present -> Full Screen
-
- loadImage("http://www.../xxx.jpg");  xxx.jpg sur le web
- loadImage("Lune3.jpg");    Lune3.jpg dans dossier data du sketch
- Exemple:
PImage monImage, monImage2;

void setup()
{
  monImage = loadImage("Lune3.jpg");   // Lune3.jpg dans dossier data du sketch
  monImage2 = loadImage("http://paresys.pagesperso-orange.fr/Installation/EEG-160x160.jpg");
  size(640,480);
}

void draw()
{
image(monImage,mouseX,mouseY);
image(monImage2,30,30);
}


- Exemple:
char caractere = 'p';
PImage monImage2;
String monImage2Nom = "Lune3.jpg"; // Lune3.jpg dans dossier data
color couleurPixel;
int xPixel = 0, yPixel = 0;

void setup()
{
  monImage2 = loadImage(monImage2Nom);
  size(monImage2.width, monImage2.height);
  smooth();
  background(0);
  noStroke(); // pas de contour
}

void draw()
{
  monImage2.loadPixels();
  xPixel = (int)random(0, monImage2.width);
  yPixel = (int)random(0, monImage2.height);
  couleurPixel = monImage2.get(xPixel, yPixel);
  fill(couleurPixel, 100);
  ellipse(xPixel, yPixel, 40, 40);
}

void keyPressed()
{
  if ( key == 's' )
  {
    saveFrame();
  }
  else
  {
    println("erreur Taper s");
  }
}

 
 
 
 
Font
- "Fonts must be placed within the data directory of your sketch" -> ScreenData.png
 
- "A font must first be created" -> Menu Tools -> Create Font... -> "Use this tool to create bitmap fonts for your program. Select a font and size, and click 'OK' to generate the font. It will be added to the data folder of the current sketch."
 
 - Exemple:
PFont fontA;
void setup()
{
  ...
  smooth();
  fontA = loadFont("CourierNew36.vlw");
  textAlign(CENTER);
  // Set the font and its size (in units of pixels)
  textFont(fontA, 32);
  ...
}
 
 
 
 
 
Export
- Menu File -> Export Applet -> Ouvrable dans Firefox ou Safari
   ATTENTION l'ordinateur doit être connecté à internet pour faire un Applet
   ATTENTION l'ordinateur doit être connecté à internet pour exécuter un Applet
 
- Menu File -> Export Application -> xxx.app sous MacOSX
 
 
 
 
 
Library
Voir: http://processing.org/reference/libraries/
Par exemple:
- oscP5 by Andreas Schlegel. "An OpenSound Control (OSC) implementation for Processing."
- proMIDI by Christian Riekoff. "Allows Processing to send and receive midi information."
 
 
Importation d'une library
    1 Créer au besoin un dossier: (sous MacOS)     /Users/..vous../Documents/Processing/libraries/
                                             (sous Linux)       /home/..vous../sketchbook/libraries/
                                             (sous Windows)  \Mes documents\Processing\libraries\
 
    2 Télécharger une library (par exemple) "generativedesign":
        http://www.generative-gestaltung.de/codes/generativedesign/download/generativedesign.zip
 
    3 Un-zipper (par exemple) generativedesign.zip -> on obtient un dossier "generativedesign"
 
    4 Placer ce dossier dans le dossier libraries (voir 1)
      On obtient: (sous MacOS)         ScreenProcessingLibrary
 
                       (sous Linux)           ScreenProcessingLibraryLinux.png 
 
                       (sous Windows 7)  ScreenProcessingLibraryWindows.png 
 
    5 Redémarrer Processing
       - La library apparaît dans Menu Sketch -> Import Library...
       - Si la library comporte des exemples, ils apparaissent dans Menu File -> Examples...-> Contributed libraries
 
    6 La documentation d'une library importée se trouve souvent dans:
         (sous MacOS)        /home/Documents/Processing/libraries/xxxxx/doc/
                               ou /home/Documents/Processing/libraries/xxxxx/reference/
         (sous Linux)          /home/..vous../sketchbook/libraries/xxxxx/documentation/
                               ou /home/Documents/Processing/libraries/xxxxx/reference/
         (sous Windows) ...
 
    7 La documentation d'une library incluse dans Processing (par exemple Minim) est réduite à ses exemples:
               Processing -> Menu File -> Examples...-> Libraries -> Minim Audio
           ou (MacOS) dans: /Applications/Processing.app/Contents/Resources/ Java/modes/java/libraries/minim/examples/
               Le reste est à chercher sur le web:
                 Pour Minim: http://processing.org/reference/libraries/ -> Minim ... -> minim/javadoc/
               On peut aussi (pour Minim) la telecharger et la placer comme indiquer ci-dessus, la doc (sous MacOS) est alors dans:
                 home/Documents/Processing/libraries/minim/doc/index.html
 
    8 Le numéro de version d'une library se trouve par ex:
        minim sous Processing 2.02 sous MacOSX:
        Processing.app/Contents/Resources/ Java/modes/java/libraries/minim/version.txt

 
 
 
 
Les sound libraries de Processing -> http://processing.org/reference/libraries/  
Included library
Minim de Damien Di Fede.
"Uses the JavaSound API to provide an easy-to-use audio library."
ADSR    AudioBuffer    AudioEffect    AudioInput    AudioListener    AudioMetaData    AudioOut    AudioOutput    AudioPlayer    AudioRecorder    AudioRecording    AudioRecordingStream    AudioResource    AudioSample    AudioSignal    AudioSnippet    AudioSource    AudioStream    Balance    BandPass    BartlettHannWindow    BartlettWindow    BeatDetect    BitCrush    BlackmanWindow    BufferedAudio    ChebFilter    Constant    Controller    Convolver    CosineWindow    Damp    DefaultInstrument    Delay    DFT    Effectable    EffectsChain    FFT    FilePlayer    FourierTransform    Frequency    Gain    GaussWindow    GranulateRandom    GranulateSteady    HammingWindow    HannWindow    HighPassSP    IIRFilter    Instrument    JSMinim    LanczosWindow    Line    LiveInput    LowPassFS    LowPassSP    Midi2Hz    Minim    MinimServiceProvider    MultiChannelBuffer    Multiplier    Noise    Noise.Tint    NotchFilter    NoteManager    Oscil    Oscillator    Pan    PinkNoise    Playable    Polyphonic    PulseWave    Reciprocal    Recordable    RectangularWindow    SampleRecorder    SawWave    SignalChain    SignalSplitter    SineWave    SquareWave    Summer    TriangleWave    TriangularWindow    Triggerable    UGen    UGen.InputType    UGenSignal    Waveform    Waves    WaveShaper    Wavetable    WavetableGenerator    WhiteNoise    WindowFunction
Documentation (MacOS) -> home/Documents/Processing/libraries/minim/doc/index.html
Documentation Web -> http://processing.org/reference/libraries/ -> Minim ... -> minim/javadoc/
 
 
Contributed libraries
Beads by Ollie Bown
"A realtime audio library for computer music and sonic art in realtime performance, installation artworks, web content and more."
Add    AllpassFilter    Analyze    Analyze.AnalysisSettings    AudioContext    AudioContextStopTrigger    AudioFile    AudioFile.OperationUnsupportedException    AudioFileIOImplementation    AudioFormat    AudioIO    AudioSegmenter    AudioUtils    BasicDataWriter    BasicTimeDataWriter    Bead    BeadArray    BiquadCustomCoeffCalculator    BiquadFilter    Buffer    BufferFactory    Change    Clicker    Clip    Clock    CombFilter    Compressor    CosineWindow    CrossFade    CrossoverFilter    CurveBuffer    DataBead    DataBeadReceiver    DelayData    DelayEvent    DelayTrigger    Delta    Envelope    Exp01Buffer    FeatureExtractor    FeatureFrame    FeatureManager    FeatureSet    FeatureTrack    FFT    FloatBead    Frequency    Function    Gain    Glide    GnuplotDataWriter    GranularSamplePlayer    HanningWindow    IIRFilter    IIRFilter.IIRFilterAnalysis    IntegerBead    JavaSoundAudioFile    JavaSoundAudioFileIOImplementation    JavaSoundAudioIO    KillTrigger    Log01Buffer    LPRezFilter    Maximum    MeanFilter    MelSpectrum    MFCC    Minimum    MonoPlug    MouseResponder    Mult    MultiWrapper    NBitsConverter    Noise    NoiseBuffer    NonrealtimeIO    OnePoleFilter    OneWindow    OscillatorBank    Panner    PauseTrigger    PeakDetector    Pitch    Plug    PolyLimit    Power    PowerSpectrum    RampBuffer    RandomPWM    RangeLimiter    ReBin    RecordToFile    RecordToSample    RecordToSample.Mode    Reverb    RMS    Sample    Sample.Regime    Sample.TimedRegime    Sample.TimedRegime.Order    Sample.TotalRegime    SampleManager    SampleManager.SampleGroupListener    SamplePlayer    SamplePlayer.EnvelopeType    SamplePlayer.InterpolationType    SamplePlayer.LoopType    SawBuffer    ScalingMixer    SegmentListener    SegmentMaker    ShortFrameSegmenter    SignalReporter    SineBuffer    SoundEvent    SoundEventManager    Spatial    SpectralCentroid    SpectralDifference    SpectralDifference.DifferenceType    SpectralPeaks    SquareBuffer    StartTrigger    Static    TapIn    TapOut    Throughput    TimeStamp    TriangularBuffer    UGen    UGen.OutputInitializationRegime    UGen.OutputPauseRegime    UGenChain    WavePlayer    WaveShaper    ZeroCross    ZMap  
Documentation (MacOS) -> home/Documents/Processing/libraries/beads/doc/index.html
 
 
Tactu5 by Alessandro Capozzo
"Aids the creation of algorithmic music in real time. Consists of a set of classes focused in defining musical elements, utility classes, and an aggregator."
"Tactu5 has not a built-in synthesis system... Tactu5 has been designed to be quite easily integrated with existing software synthesis systems (Csound, PureData, SuperCollider etc...) through network communication (for instance OSCp5) or by directly using some java binding."
 
 
jm-Etude by Daniel Dihardja
"Provides functions to communicate with jMusic for easier music composition programming."
createScore    addScorePart    getScoreParts    removeScorePart     createPart    addPartPhrase    setPartInstrument    setPartChannel    setPartPan    getPartPhrases    getPartChannel    getPartInstrument    removePartPhrase     createPhrase    addPhraseNote    addPhraseNoteList    setPhraseInstrument    setPhraseStartTime    repeatPhrase    getPhraseNotes    getPhraseStartTime    getPhraseInstrument     setTitle    setTempo    setVolume    transpose    playMIDI    stopMIDI    clear
 
 
Ess by Krister Olsson
Sound library that allows sound sample data to be loaded or streamed, generated in real-time, manipulated, saved, analyzed or simply played back.
Classes:
Ess    AudioChannel    AudioStream    AudioInput    AudioFile    AudioFilter    AudioGenerator    FFT
Quelques Methods:
loadSound    saveSound    volume    gain    smoothPan    pan    mute    fading    fadeTo    stopFade    panning    panTo    stopPan    ms    frames    softClip    Normalize    filter    percent        Reverse    Reverb    filter    damp    predelay    roomSize    updateReverbModel    PitchShift    TempoShift    LowPass    HighPass    BandPass    EQ    PinkNoise    generate    WhiteNoise    SawtoothWave    SineWave    SquareWave    TriangleWave    setupFFT    equalizer    noEnvelope    envelope    spectrum    baseSpectrum    maxSpectrum    getSpectrum       
Documentation
 
 
ttslib by Nikolaus Gradwohl
"ttslib is a wrapper around freetts and can be used to give your sketches a voice."
setPitch    setPitchRange    setPitchShift    speak  
 
 
Sonia by Amit Pitaru
Audio library for sound playback and synthesis. Integrates Jsyn and requires a browser plugin for playback.
 
 
SoundCipher by Andrew R. Brown
SoundCipher provides an easy interface for playing 'notes' on the JavaSound synthesizer and for playback of audio files.
 
 
Echonestp5 by melka
A wrapper to simplify the use of the Echo Nest API.
 
 
 
Les XML libraries de Processing
- XML Import "This library has been moved to the Processing core. To load XML data, check out the reference for XMLElement in the extended reference." Voir: http://processing.org/reference/libraries/
Menu Help -> Reference -> XMLElement ->
"XMLElement is a representation of an XML object. The object is able to parse XML code. The methods described here are the most basic. More are documented in the Developer's Reference."
 
- proXML by Christian Riekoff. Allows Processing to read and write XML files.
 
- Learning Processing: Example 18-9-using-processing's-XML library
 
- wiki.processing.org: XML_parsing_with_JAXB

 
 
 
En cas de problème...
- Sous MacOSX -> Voir:
http://wiki.processing.org/w/Supported_Platforms#Mac_OS_X
/Users/vous/Library/Processing/console/
Les messages de la console sont dans:
/Users/vous/Library/Processing/console/160904_0455.out  (le 04 O9 2016 par exemple)
et les messages d'erreur (Java...) dans:
/Users/vous/Library/Processing/console/160904_0455.err  (le 04 O9 2016 par exemple)
 
- Sous Windows -> Voir:
http://wiki.processing.org/w/Supported_Platforms#Windows
C:\Documents and Settings\vous\Application Data\Processing\console\
 
- http://wiki.processing.org/w/Troubleshooting
 
 
 
 
Compatibilité
- Tout ce qui précéde concerne Processing v1.5.1
- La version v2 pose des problèmes de compatibilité:
- Library minim
- Sous MacOS -> "Only OS X 10.7 and 10.8 are the only supported versions of Mac OS X for Processing 2.0. The minimum system has been set to 10.6.8, because Processing may still run on many OS X 10.6 machines. However, there are OpenGL problems with certain Macs that we cannot fix."
...
 
 
page mise à jour 31 1 2023
 
Méthodes Method