<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with selectinput() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=selectinput%28%29</link>
      <pubDate>Sun, 08 Aug 2021 18:50:47 +0000</pubDate>
         <description>Tagged with selectinput() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedselectinput%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>JSON save/load</title>
      <link>https://forum.processing.org/two/discussion/28048/json-save-load</link>
      <pubDate>Fri, 08 Jun 2018 16:38:38 +0000</pubDate>
      <dc:creator>vjjv</dc:creator>
      <guid isPermaLink="false">28048@/two/discussions</guid>
      <description><![CDATA[<p>hello! im trying to write a kind of user interface to manage JSON files. What i want is user can store data in JSON files. when mousePressed save a new JSON FILE. here`s my code with a null pointer exception:</p>

<pre><code> JSONObject json;
File saving;
File loading;

void setup() {
  json = new JSONObject();

}

void draw(){

}

void mousePressed() {
  selectInput("Select a file to process:", "fileSelected");
  saveJSONObject(json, saving.getAbsolutePath());
}




void fileSelected(File selection) {
  saving = selection;
  if (selection == null) {
    println("Window was closed or the user hit cancel.");
  } else { 
    println("User selected " + selection.getAbsolutePath());
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Open Files</title>
      <link>https://forum.processing.org/two/discussion/7888/open-files</link>
      <pubDate>Fri, 31 Oct 2014 01:32:03 +0000</pubDate>
      <dc:creator>philspitler</dc:creator>
      <guid isPermaLink="false">7888@/two/discussions</guid>
      <description><![CDATA[<p>I'm using the code from this example to open a file.</p>

<p><a href="https://www.processing.org/reference/selectInput_.html" target="_blank" rel="nofollow">https://www.processing.org/reference/selectInput_.html</a></p>

<p>The issue I am having is that the code in my Setup and Draw function is starting to execute before I select a file.</p>

<p>I need my sketch to wait until I choose a file then proceed.</p>

<p>Any ideas?</p>

<p>Thanks.</p>

<p>Phil</p>

<pre><code>    void setup() {
      selectInput("Select a file to process:", "fileSelected");

      size(img.width, img.height);


    }

    void draw() {  



    }




    void fileSelected(File file) {
      if (file == null) {
        println("Window was closed or the user hit cancel.");
      } else {
        println("User selected " + file.getAbsolutePath());
        img = loadImage(file.getPath());  // Load the image into the program  


      }
    }
</code></pre>
]]></description>
   </item>
   <item>
      <title>How can i import files while the sketch is running?</title>
      <link>https://forum.processing.org/two/discussion/25785/how-can-i-import-files-while-the-sketch-is-running</link>
      <pubDate>Tue, 02 Jan 2018 14:16:09 +0000</pubDate>
      <dc:creator>eriktjäder</dc:creator>
      <guid isPermaLink="false">25785@/two/discussions</guid>
      <description><![CDATA[<p>Hi Guys!</p>

<p>Is there a way to import files while the sketch is currently beeing excecuted?
E.g.: I have a button(controlp5) and when pressed it opens my filemanager and lets me pick a picture for instance.</p>

<p>For my application i want to change an 3D object, so a .mtl - File. 
My hopes aren't high, that this is possible but maybe someone has an idea. :D</p>
]]></description>
   </item>
   <item>
      <title>Understanding Callback with respect to selectInput()</title>
      <link>https://forum.processing.org/two/discussion/26196/understanding-callback-with-respect-to-selectinput</link>
      <pubDate>Wed, 31 Jan 2018 14:53:17 +0000</pubDate>
      <dc:creator>GregN</dc:creator>
      <guid isPermaLink="false">26196@/two/discussions</guid>
      <description><![CDATA[<p>Hello all.  I'm new to this, but not so new to basic coding, but it has been a long time since I've done any serious coding...</p>

<p>Here's my issue -- I have a Processing script that loads in a text file, parses it out and sends some info to an Arduino board.  It works great, but I'd like to present the operator with the option of selecting a file, but I'm having trouble getting my head around the concept of "callback" stuff and in specific how to use it with the selectInput() function.</p>

<p>For the purposes of this, I have stripped out all the other stuff and just have the file load bits...</p>

<pre><code>String[] protocol;
String[] fname;
int flag=0;

void setup() {
  selectInput("Select a file to process:", "fileSelected");
  while(flag==0){
    if(protocol!=null){
      flag=1;
    }
  }
  println(protocol[0]);  
}

void fileSelected(File selection) {
  if (selection == null) {
    println("Window was closed or the user hit cancel.");
  } else {
    println("User selected " + selection.getAbsolutePath());
    protocol = loadStrings(selection.getAbsolutePath());
  }
}
</code></pre>

<p>My idea is that by putting the while loop it should hold the code until the variable protocol has something other than null.  I have a feeling that I'm barking up the wrong tree with this and that null is the wrong thing to be checking for?</p>

<p>Any ideas or links to some tutorials or whatever would be greatly appreciated!!</p>

<p>Greg</p>
]]></description>
   </item>
   <item>
      <title>How to save text into new txt everytime you save it</title>
      <link>https://forum.processing.org/two/discussion/25541/how-to-save-text-into-new-txt-everytime-you-save-it</link>
      <pubDate>Tue, 12 Dec 2017 20:24:57 +0000</pubDate>
      <dc:creator>Caseguy</dc:creator>
      <guid isPermaLink="false">25541@/two/discussions</guid>
      <description><![CDATA[<p>This is the code, this code saves the written text into a txt, but it always saves it into the same one, so the older text written in the txt file gets deleted. I would like it to save it into a new txt everytime the program saves it . How do i do so.</p>

<p>and another thing: how do i load the text in txt into the document, by clicking on another button :)</p>

<p>thanks in advance :)</p>

<pre><code>String str = "";

void setup(){
  size(400,400);
}

void draw(){
  background(0);
  fill(255);
  text(str,20,20,100,height-20);
  fill(128);
  if( over() ){
    fill(196);
  }
  rect(width-20,height-20,20,20);
}

boolean over(){
  return( mouseX&gt;width-20 &amp;&amp; mouseY &gt; height-20 );
}

void keyPressed(){
  if( keyCode == DELETE || keyCode == BACKSPACE ){
    if( str.length() &gt; 0 ){
      str = str.substring(0, str.length()-1);
    }
  } else {
    if( key != CODED ){
      str += key;
    }
  }
}

void mousePressed(){
  if( over() ){
    saveIt();
  }
}

void saveIt(){
  String[] strs = { str };
  saveStrings( "text.txt", strs );
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Opening a file with the combination of Command key and 'O' key. Not quite working...</title>
      <link>https://forum.processing.org/two/discussion/25229/opening-a-file-with-the-combination-of-command-key-and-o-key-not-quite-working</link>
      <pubDate>Mon, 27 Nov 2017 15:38:28 +0000</pubDate>
      <dc:creator>akira</dc:creator>
      <guid isPermaLink="false">25229@/two/discussions</guid>
      <description><![CDATA[<p>Hi,
I have a question about a behaviour of opening a file with the combination of Command key and 'O' key. The code is as below. It almost works, but when I open a file or cancel the dialog box after selectInput() method was called, and then immediately after that trying to open another file by pressing <strong>Command+O</strong> it just doesn't work. If I press the command key once before pressing <strong>Command+O</strong> then it works again, so it seems its something to do with Command key. Can anyone tell me what the problem is?</p>

<pre><code>boolean key_command;
boolean key_open;
int COMMAND_KEY = 157; // apple-command key

void setup()
{
  size(100, 100);
  key_command = false;
  key_open = false;
}

void draw() 
{
}

void keyPressed()
{
  if (key == CODED) {
    if (keyCode == COMMAND_KEY) {
      key_command = true;
    }
  }

  if (key == 'o' || key == 'O')
    key_open = true;

  checkComboKeys();
}

void keyReleased()
{    
  println("keyReleased()");
  resetComboKeys();
} 

void checkComboKeys() {
  if (key_command &amp;&amp; key_open) { // command-apple + O
    println("command + O pressed");
    openFile();
  }
}

void resetComboKeys() {
  key_command = false;
  key_open = false;
}

void openFile() {
  selectInput("Select a file to open:", "openSelected");
}

void openSelected(File selection) {
  if (selection == null) {
    println("Window closed or cancelled.");
  } else {
    println("User selected: " + selection.getAbsolutePath());
  } 
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Why can't I get the option pane to show.</title>
      <link>https://forum.processing.org/two/discussion/24430/why-can-t-i-get-the-option-pane-to-show</link>
      <pubDate>Sat, 07 Oct 2017 12:29:01 +0000</pubDate>
      <dc:creator>stumped1</dc:creator>
      <guid isPermaLink="false">24430@/two/discussions</guid>
      <description><![CDATA[<p>A newby and my first time using Processing and I can't see how I can resolve this. I'm trying to set up a CNC drawing setup in arduino uno and the Processing option pane is not displaying correctly. I've attached a screenshot and it appears a fault is shown at line 31. 
Would greatly appreciate any help<img src="https://forum.processing.org/two/uploads/imageupload/412/C67EN4DZYET8.png" alt="Screenshot (5)" title="Screenshot (5)" /></p>
]]></description>
   </item>
   <item>
      <title>How do I add an interactive menu to a code which uploads a picture and uses it in the code?</title>
      <link>https://forum.processing.org/two/discussion/23413/how-do-i-add-an-interactive-menu-to-a-code-which-uploads-a-picture-and-uses-it-in-the-code</link>
      <pubDate>Wed, 12 Jul 2017 12:48:11 +0000</pubDate>
      <dc:creator>aless100</dc:creator>
      <guid isPermaLink="false">23413@/two/discussions</guid>
      <description><![CDATA[<p>The code draws the image with paint splatters. 
Link: <a href="https://www.openprocessing.org/sketch/392202" target="_blank" rel="nofollow">https://www.openprocessing.org/sketch/392202</a>
All credits to Jason Labbe.</p>
]]></description>
   </item>
   <item>
      <title>Program freezing when using Serial out</title>
      <link>https://forum.processing.org/two/discussion/23387/program-freezing-when-using-serial-out</link>
      <pubDate>Mon, 10 Jul 2017 11:28:59 +0000</pubDate>
      <dc:creator>eugval</dc:creator>
      <guid isPermaLink="false">23387@/two/discussions</guid>
      <description><![CDATA[<p>Hi guys,</p>

<p>This program I've made is designed to read data from a csv file and output it to an arduino (which will in turn eventually output it to a motor). Strangely, it runs just fine without the Arduino plugged in, but with the Arduino plugged in it starts freezing every one or two seconds after the first eight seconds or so. I presume some buffer somewhere is being filled up and is not clearing itself fast enough, but I have no idea where. Any thoughts?</p>

<pre><code>/*  CSV_READER
    Version 3.4

    Improvements from last version:
    - 

    Improvements to be made:
    - Begins to freeze when Arduino plugged in

*/

import processing.serial.*;

int xpos=90; // set x servo's value to mid point (0-180);
int ypos=90; // and the same here
Serial port; // The serial port we will be using
Table table;
final int motorPulley = 17; //number of teeth on the pulley
final int enginePulley = 51;
final int calibrationFactor = (2880 * (enginePulley/motorPulley))/360; //2880 = max rpm of motor
int rowCount = 1;
int timeResolution; //the time interval in ms of the chosen data file
boolean fileSelected = false;
boolean run = false;
boolean pause = false;
boolean stop = false;
int time, rpm;
boolean debounce = true; //ensures button is released before it can be pressed again
int stopCount = 0; //how long before program closes
int timeRunning = 0; //time the program has spent running
int timePaused = 0;
String fileName;

void setup() 
{
  size(360, 360, P2D);
  background(50);

  selectInput("Select a file to process:", "fileSelected");
  //table = loadTable(file, "header");

  frameRate(1000); //sets framerate

  //println(Serial.list()); // List COM-ports
  port = new Serial(this, Serial.list()[5], 9600);


}

void fileSelected(File selection) //selects the file
{
  if (selection == null) 
  {
    println("Window was closed or the user hit cancel.");
  } 
  else 
  {
    println("User selected " + selection.getAbsolutePath());
    fileName = selection.getName();
    table = loadTable(selection.getAbsolutePath(), "header");
    fileSelected = true;
    TableRow row1 = table.getRow(1);
    TableRow row2 = table.getRow(2);
    int time1 = row1.getInt("time");
    int time2 = row2.getInt("time");
    timeResolution = time2 - time1;
  }
}

void draw() 
{
  while (fileSelected == false) //Does not run unti a file has actually been selected
  {
    delay(1);
  }

  clear();
  //println(frameRate); //use for testing a specific variable

  if (stop == false) //normal running section of program
  {
      if (run == true) //loads row data
      {
        timeRunning = millis() - timePaused;
        nextRow();
      }

      else
      {
        timePaused = millis() - timeRunning;
      }

      //println(rpm);
      update(0, rpm/calibrationFactor); //update serial signal being sent to arduino

      strokeWeight(10);
      stroke(0, 191, 255);
      fill(0, 0, 0);
      //ellipse(180, 180, rpm/24,rpm/24);
      arc(180,180,180,180, 0, radians(rpm/24)); //draws an arc whic represents the rpm value
      fill(255);
      text(rpm, 163, 185);
      text("rpm",166,195);
      text((float) time/1000, 30, 230);
      text("time (s)", 30, 240); //displays the time and rpm values
      text(fileName,30,30);
      text("timeR: " + (float) timeRunning/1000, 30, 260);

      if (run == false) //displays start button
      {
       strokeWeight(0);
        fill(51,255,51);
       rect(160,320,50,20);
       fill(0);
       text("START",165,332);


      }

      if (run == true) //displays pause button
      {
        strokeWeight(0);
        fill(255,153,51);
       rect(160,320,50,20);
       fill(0);
       text("PAUSE",165,332);

      }

      strokeWeight(0);
        fill(255,0,0);
       rect(230,320,50,20);
       fill(0);
       text("STOP",235,332);  

      if (mousePressed &amp;&amp; overRect(160,320,50,20) &amp;&amp; debounce) //detects if start/pause button has been pressed
       {
         debounce = false;
         if (run == false)
           run = true;
         else if (run == true)
           run = false;
        }

      if (mousePressed &amp;&amp; overRect(230,320,50,20) &amp;&amp; debounce)
      {
        stop = true;
      }

      if (rowCount &gt;= table.getRowCount()) //end program when end of file is reached
      {
        stop = true;
      }
  }

  else if (stop == true)
  {

    fill(255);
    text("Run finished",150,160);
    stopCount++;
    if (stopCount &gt;= 500)
      exit();
  }
}

boolean overRect(int x, int y, int width, int height) //checks to see if the mouse is over the defined rectangle
{
  if (mouseX &gt;= x &amp;&amp; mouseX &lt;= x+width &amp;&amp; 
      mouseY &gt;= y &amp;&amp; mouseY &lt;= y+height) {
    return true;
  } 
  else 
  {
    return false;
  }
}

void nextRow() //loads data from the next row in the table
{
  TableRow row = table.getRow(rowCount);
  time = row.getInt("time");
  if (time &lt;= timeRunning) //loads new rpm if we have reached that time
  {
    rpm = row.getInt("rpm"); 
    rowCount++;
  }
  if(time + timeResolution &lt; timeRunning) //catches up if it falls behind
  {
     rowCount++; 
     println(rowCount);
  }

}

void mouseReleased() //ensures mouse is released before it can be pressed again
{
   debounce = true; 
}

void update(int x) //updates output to arduino
{
  //Calculate servo postion from mouseX
  xpos= x/2;
  ypos = y/2;
  //Output the servo position ( from 0 to 180)
  port.write(xpos+"x");
  port.write(ypos+"y");
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>GUI apply and reset button?</title>
      <link>https://forum.processing.org/two/discussion/23304/gui-apply-and-reset-button</link>
      <pubDate>Tue, 04 Jul 2017 07:44:09 +0000</pubDate>
      <dc:creator>first</dc:creator>
      <guid isPermaLink="false">23304@/two/discussions</guid>
      <description><![CDATA[<p>dear friends,
I am making an app for photo editing, in which apply and reset button are not working correctly. It is required that after choosing a filter, when apply button is clicked the next filter will apply on the current image. Further, when reset button is clicked the image will rest to the previous filtered image, not the original.</p>

<p>Thanks in advance</p>
]]></description>
   </item>
   <item>
      <title>Surface Size dependant on input Image dimensions</title>
      <link>https://forum.processing.org/two/discussion/13484/surface-size-dependant-on-input-image-dimensions</link>
      <pubDate>Wed, 11 Nov 2015 12:16:09 +0000</pubDate>
      <dc:creator>demetrios</dc:creator>
      <guid isPermaLink="false">13484@/two/discussions</guid>
      <description><![CDATA[<p>Hi everybody,</p>

<p>I am rewriting some code for P3. My aim is to fill up a PImage object with input image file data, selected with the new select-methods (such as <a href="https://processing.org/reference/selectInput_.html" target="_blank" rel="nofollow">https://processing.org/reference/selectInput_.html</a>) and afterwards adjust the surface size depending on this PImages width and height.</p>

<p>This is an exampe code:</p>

<pre><code>PImage input;

void setup() {
  size (200, 200);
  surface.setResizable(true);
  selectInput("Select an image to process", "imageSelected");
  surface.setSize(input.width, input.height);
}

void imageSelected(File selection) {
  if (selection == null) {
    println("Window was closed or the user hit cancel.");
  } else {
    input = loadImage (selection.getAbsolutePath());
  }
}
</code></pre>

<p>It seems the interpreter can not wait until an input-file is picked (No clue about the selection window). It instantly neeeeeeds to run the setSize method - and crash (throws NullPointerException, because "input.width" is not available, because he wants it way to soon)! Is there another solution to my attempt? I think it is a decent desire, to set surface properties as a function of selected input. At least it is what my client desires ;)</p>

<p>Cheers!</p>
]]></description>
   </item>
   <item>
      <title>Program freezes on loadTable()</title>
      <link>https://forum.processing.org/two/discussion/23089/program-freezes-on-loadtable</link>
      <pubDate>Fri, 16 Jun 2017 14:34:59 +0000</pubDate>
      <dc:creator>adomarc</dc:creator>
      <guid isPermaLink="false">23089@/two/discussions</guid>
      <description><![CDATA[<p>The following program appears to freeze on the loadTable() line. I can get the program to work fine in debugger mode by stepping through the code but it does not seem to want to execute properly with the normal run mode.</p>

<pre><code>Table dotdata;
String filepath="";
String savefilepath="";
int columncount= 0;
int rowcount=0;

void setup() {
  size(500, 500);
  background(0);
  dotdata=new Table();
}

void draw() {
  selectInput("Select .txt file", "fileSelected");

  while (filepath=="") {
  };

  dotdata = loadTable(filepath, "tsv");
  print("hello");

  for (int i=0; i&lt;7; i++) {
    dotdata.removeRow(0);
  }
  dotdata.removeColumn(5);
  dotdata.removeColumn(4);
  dotdata.removeColumn(1);
  dotdata.removeColumn(0);

  dotdata.addColumn();
  dotdata.addColumn();
  dotdata.addColumn();

  //int columncount= dotdata.getColumnCount();
  int rowcount=dotdata.getRowCount();


  for (int i=0; i&lt;rowcount; i++) {
    dotdata.setFloat(i, 2, dotdata.getFloat(i, 0)+150);
    dotdata.setFloat(i, 3, dotdata.getFloat(i, 1)-150);
  }

  for (int i=0; i&lt;rowcount; i++) {
    dotdata.setString(i, 4, str(dotdata.getFloat(i, 2)) + "," + str(dotdata.getFloat(i, 3)));
  }

  filepathnaming();

  saveTable(dotdata, savefilepath);
  exit();
}



void fileSelected(File selection) {
  if (selection == null) {
    println("Window was closed or the user hit cancel.");
    exit();
  } else {
    filepath=selection.getAbsolutePath();
  }
}

void filepathnaming() {
  savefilepath="";
  String[] filepathlist = split(filepath, "\\");

  for (int i=0; i&lt;filepathlist.length-1; i++) {
    savefilepath +=filepathlist[i]+ "\\";
  }

  savefilepath += filepathlist[filepathlist.length-1].substring(0, filepathlist[filepathlist.length-1].indexOf(".txt"))+"_update.csv";

  println(savefilepath);
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>selectInput and graph</title>
      <link>https://forum.processing.org/two/discussion/22987/selectinput-and-graph</link>
      <pubDate>Thu, 08 Jun 2017 11:44:09 +0000</pubDate>
      <dc:creator>dwill0806</dc:creator>
      <guid isPermaLink="false">22987@/two/discussions</guid>
      <description><![CDATA[<p>Hello all, I want to write a code to select a ".csv" file and graph the corresponding data. So far I've been able to do those separately but not together.</p>

<pre><code>Table table;
String myFilePath;
TableRow row;
float Time;
float Manom;
float Temp;
float P1;
float GV1;
float P2;
float GV2;
float P3;
float GV3;
float P4;
float GV4;
float P5;
float GV5;
float P6;
float GV6;
float x;
int var;
Bubble[] bubbles;


void setup() {
  size(1000, 800);
  surface.setResizable(true);
  selectInput("Select a file to process:", "fileSelected");
  loadData();
}

void fileSelected(File selection) {
  myFilePath = selection.getAbsolutePath();
  table = loadTable(myFilePath, "header");
}

void draw(){
  if(table == null){
    background(0,0,155);
    noLoop();
  } else {
    background(155,50,50);
    for (int i = 0; i &lt; bubbles.length; i++) {
    bubbles[i].display();
    }
  }
}

void loadData(){
  if (table != null){
    background(70);
    table = loadTable(myFilePath, "header");
    bubbles = new Bubble[table.getRowCount()]; 
    for (int i = 0; i &lt; table.getRowCount(); i++){
      row = table.getRow(i);
      Time = row.getInt("Time (s)");
      Manom = row.getFloat("1");
      Temp = row.getFloat("2");
      P1 = row.getFloat("3");
      P2 = row.getFloat("4");
      P3 = row.getFloat("5");
      P4 = row.getFloat("6");
      P5 = row.getFloat("7");
      P6 = row.getFloat("8");
      GV1 = row.getFloat("9");
      GV2 = row.getFloat("10");
      GV3 = row.getFloat("11");
      GV4 = row.getFloat("12");
      GV5 = row.getFloat("13");
      GV6 = row.getFloat("14");
      x = map(Time, 0, table.getRowCount(), 100, 900);
    }
  }
}
</code></pre>

<p>Main code with class Bubble</p>

<pre><code>class Bubble {
  float x,y;
  float diameter;


  Bubble(float x_, float y_, float diameter_) {
    x = x_;
    y = y_;
    diameter = diameter_;
  }


  void display() {
    stroke(0);
    strokeWeight(2);
    noFill();
    ellipse(x,y,diameter,diameter);
  }
}
</code></pre>

<p>running this code gives me this error</p>

<p><img src="https://forum.processing.org/two/uploads/imageupload/696/GD5GX0BCUTQC.png" alt="Untitled" title="Untitled" /></p>
]]></description>
   </item>
   <item>
      <title>Catching InvocationTargetException</title>
      <link>https://forum.processing.org/two/discussion/22891/catching-invocationtargetexception</link>
      <pubDate>Sat, 03 Jun 2017 07:04:15 +0000</pubDate>
      <dc:creator>fedechko</dc:creator>
      <guid isPermaLink="false">22891@/two/discussions</guid>
      <description><![CDATA[<p>need your help, gyus</p>

<p>inb4 i know that code is huge pile of bs but i need it to work</p>

<p>catching a lot of errors trying to pass lorem array into load.dissasemble2array</p>

<p>main</p>

<pre>int lngth = 10000; 
int scaleX = 5;
int scaleY = 2;
String fileName = new String();
String[] lorem = new String[lngth];
int[][] endArray = new int[lngth][10];
int[][] smoothArray = new int[lngth][10];
drawGraph graph;
fileLoad load;
void setup() {
  noLoop();
  size(1800, 600);
  graph = new drawGraph();
  selectInput("Select a file to graph: ", "fileSelected");
}
void fileSelected(File selection) {
  if (selection == null) {
    println("Window was closed or the user hit cancel.");
    exit();   
  } else {
    println(selection.getAbsolutePath());
    fileName = selection.getAbsolutePath();
    println(fileName);
    lorem = loadStrings(fileName);
    endArray = load.disassemble2array(lorem);
    smoothArray = load.smoothen(endArray);
  }
}
void draw() { 
  background(0); 
  stroke(50);
  fill(255);
  for (int i = 0; i &lt; height; i = i+scaleY*10) {
    line(20, height - i, width, height - i);
    text(i / scaleY, 5, height - i);
  }
  stroke(255);
  graph.drawAll(smoothArray, lngth, scaleX, scaleY);
}
void mousePressed() {
  if ((scaleX-1 != 0) &amp;&amp; (scaleY+1 != 0) &amp;&amp; (mouseButton == LEFT)) {
    scaleX--;
    scaleY++;
    redraw();
  } else if ((scaleX+1 != 0) &amp;&amp; (scaleY-1 != 0) &amp;&amp; (mouseButton == RIGHT)) {
    scaleY--;
    scaleX++;
    redraw();
  }
}
</pre>

<p>fileLoad</p>

<pre>
class fileLoad {
  int k = 0;
  int s = 0;
  int p = 0;
  int last_s;
  int[][] disassemble2array(String[] lorem) {
    //String[] lorem = loadStrings(fileName);
    int[][] temp = new int[lorem.length][10];
    for (int i = 0; i &lt; lorem.length - 1; i++) {
      last_s = 0;
      for (s = 0; s &lt; lorem[i].length() - 1; s++) {
        if (lorem[i].charAt(s) == ';') {
          temp[i][p] = int(lorem[i].substring(last_s, s));
          //println(temp[i][p]);
          last_s = s + 1;
          p++;
        }
      }
      temp[i][p] = int(lorem[i].substring(last_s, s+1));
      //println(temp[i][p]);
      //println();
      s = p = 0;
    }
    return temp;
  }
  int[][] smoothen(int[][] arr) {
    for (int i = 12; i &lt; arr[i].length - 12; i++) {
      for (int col = 1; col &lt; arr[i].length-1; col++) {
        arr[i][col] = (arr[i-12][col] + arr[i-11][col] + arr[i-10][col] + arr[i-9][col] + arr[i-8][col] + arr[i-7][col] + arr[i-6][col] + arr[i-5][col] + arr[i-4][col] + arr[i-3][col] + arr[i-2][col] + arr[i-1][col] + arr[i][col] + arr[i+1][col] + arr[i+2][col] + arr[i+3][col] + arr[i+4][col] + arr[i+5][col] + arr[i+6][col] + arr[i+7][col] + arr[i+8][col] + arr[i+9][col] + arr[i+10][col] + arr[i+11][col] + arr[i+12][col])/25;
      }
    }
    return arr;
  }
}
</pre>

<p>errors</p>

<pre>java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at processing.core.PApplet.selectCallback(PApplet.java:6484)
    at processing.core.PApplet.access$0(PApplet.java:6477)
    at processing.core.PApplet$3.run(PApplet.java:6389)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.NullPointerException
    at test_file_sketch.fileSelected(test_file_sketch.java:53)
    ... 21 more
</pre>
]]></description>
   </item>
   <item>
      <title>Problem with RMS Analysis [solved]</title>
      <link>https://forum.processing.org/two/discussion/22456/problem-with-rms-analysis-solved</link>
      <pubDate>Mon, 08 May 2017 10:39:06 +0000</pubDate>
      <dc:creator>raiu</dc:creator>
      <guid isPermaLink="false">22456@/two/discussions</guid>
      <description><![CDATA[<p>Hio.
I'm currently working on an audio visualisation, i had the code running, but since i had time i wanted to implement a GUI (using G4P). Now with the GUI the analysis doesn't seem to work anymore. Here's the relevant code:</p>

<pre><code>import g4p_controls.*;
import processing.sound.*;    

GButton buttonSong, buttonGo;
SoundFile soundfile;
Amplitude rms;

boolean playing, selected = false;
float sum;
int map, frames;

void analyzeSetup(){
    rms = new Amplitude(this);  
    }

void analyzeDraw(){
     if(frameCount%60 == 0 &amp;&amp; playing == true){

      sum += (rms.analyze() - sum) * 0.75;
      map = (int) map(sum, 0, 0.5, 0, 180);

      frames = frames+1;
      println(sum," - ",frames," - ",map);
    }
}

void selectSong(){  
  buttonSong = new GButton(this, 180, 20, 25, 25);
  buttonSong.setText("...");
  buttonSong.addEventHandler(this, "openSong");
 }

public void openSong(GButton source, GEvent event) { 
  selectInput("Please select an .mp3", "pathToString");
}

void pathToString(File selection){
  song = selection.getPath(); 
  selected = true;
  soundfile = new SoundFile(this, song);
  rms.input(soundfile);
}

void startProgram(){
  buttonGo = new GButton(this, 210, 430, 80, 50);
  buttonGo.setText("Go!");
  buttonGo.addEventHandler(this, "Go");
}

public void Go(GButton source, GEvent event) { 
  if(selected == true){
    soundfile.play();
    playing = true;
  }
}
</code></pre>

<p>analyzeSetup(), selectSong() and startProgram() are in the main setup()-method, analyzeDraw() is in the main draw()-Method.
The problem is that the song starts playing when clicking the Go-Button, but it doesn't seem to get analyzed, since sum and map constantly stay 0. My guess is to relocate the assignment of the soundfile and the rms.input. i've already played around a lot, but nothing worked. i hope someone can help me here.</p>

<p>thanks in advance.
best regards, raiu.</p>
]]></description>
   </item>
   <item>
      <title>File selection/save dialog with filter</title>
      <link>https://forum.processing.org/two/discussion/22269/file-selection-save-dialog-with-filter</link>
      <pubDate>Fri, 28 Apr 2017 16:04:00 +0000</pubDate>
      <dc:creator>Lord_of_the_Galaxy</dc:creator>
      <guid isPermaLink="false">22269@/two/discussions</guid>
      <description><![CDATA[<p>After a lot of research, I came up with a better file select (and you can easily figure out a save dialog from this) dialog -</p>

<pre><code>import static javafx.stage.FileChooser.ExtensionFilter;
import javafx.stage.FileChooser;


protected File selectFilteredInput(String title, ExtensionFilter... filters) {

  //my code
  FileChooser fileChooser = new FileChooser();
  fileChooser.setTitle(title);
  fileChooser.getExtensionFilters().addAll(filters);
  File selectedFile = fileChooser.showOpenDialog(null);
  return selectedFile;
}  
</code></pre>

<p>Follow what I say <a rel="nofollow" href="https://forum.processing.org/two/discussion/15897/how-to-import-the-javafx-library#latest">here</a> to install the JavaFX library.</p>
]]></description>
   </item>
   <item>
      <title>audio file from file browser</title>
      <link>https://forum.processing.org/two/discussion/22141/audio-file-from-file-browser</link>
      <pubDate>Sat, 22 Apr 2017 16:23:11 +0000</pubDate>
      <dc:creator>raiu</dc:creator>
      <guid isPermaLink="false">22141@/two/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>i'm pretty new to all this and working on a project for uni i came across a small problem.</p>

<p>the whole thing is an audio visualisation and the user should be be able to choose the song (.mp3) he wants to use for it from the file browser. as far as i know you do this with selectInput() which returns the type "file", to use it with the audio library however, i need it as an audiofile. i haven't found a way to cast a normal file to an audio file or another way to get an audio file via the browser. basically i would only need the path or file name (if the file is in the data folder) saved to a string.</p>

<p>can anyone please help me with this? .-.</p>

<p>-raiu</p>
]]></description>
   </item>
   <item>
      <title>Launching ffmpeg from cmd in sketch?</title>
      <link>https://forum.processing.org/two/discussion/22076/launching-ffmpeg-from-cmd-in-sketch</link>
      <pubDate>Wed, 19 Apr 2017 06:43:07 +0000</pubDate>
      <dc:creator>SnailPropulsionLabs</dc:creator>
      <guid isPermaLink="false">22076@/two/discussions</guid>
      <description><![CDATA[<p>Hi all,
As the title says, i'm trying to launch ffmpeg, which is a command line utility, from within a sketch.
I've tried exec(), and open() and launch(), with no real success that I can see.
The code below prints "the process returned 1" to the processing console, but the command line is never launched.</p>

<p>What do I need to do to make this work?</p>

<p>Thanks in advance.</p>

<p>code:</p>

<pre><code>import processing.video.*;
Movie mov;
String fileName;

void setup() {
  size(800, 800);
}  

void draw() {
}

void keyPressed() {
  if (key == 'p') selectInput("Select movie:", "movieSelected");
}

void movieSelected(File selection) { 
  if (selection == null) {
    println("Window was closed or the user hit cancel.");
  } else {
    fileName = selection.getAbsolutePath();
    mov = new Movie(this, fileName);

    String[] processCommands = {
      "E:/Tertiary/COMP390/Movie Second/ffmpeg/bin/ffmpeg.exe", 
      "ffmpeg", "-i", "mov", "-codec:a", "libmp3lame", "-qscale:a 2", "fileName" + "output.mp3"
    };
    Process p = launch(processCommands);

    try {
      int result = p.waitFor();
      println("the process returned " + result);
    } 
    catch (InterruptedException e) {
    }
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>File Dialog</title>
      <link>https://forum.processing.org/two/discussion/21963/file-dialog</link>
      <pubDate>Wed, 12 Apr 2017 20:01:15 +0000</pubDate>
      <dc:creator>kucky</dc:creator>
      <guid isPermaLink="false">21963@/two/discussions</guid>
      <description><![CDATA[<p>T got found this example....</p>

<pre><code>int io=0;
int counter=0;
PFont myFont;
String[] test;
String[] test2;

void setup(){
  size(512, 512);
  smooth();
  background(0);
  myFont = createFont("xkcd", 64);
  textFont(myFont);
  textAlign(CENTER);
  io = 0;
  counter=0;
}

void draw(){
  background(0);
  text(counter, height/2, width/2);

  text("Test2 "+test2[0], 50, 50);             /// NullPointerException
  println(test2[1]);                                   

  counter++;
}   

void keyPressed() {
  if (key == '1') {
    openData();
  }
}

void openData() {
  println("open data...");
  // stop the draw() function
  noLoop();
  selectInput("Select a file...", "myFile");

  println("...function end.");
}

void Textsichern (String[] _val) {               /// My modifying.
  test2 = _val;  
  text("Test2 "+test2[0], 50, 50);
  println(test2[1]);
}

void myFile(File selection) {
  io=1;
  if (selection == null) {
    println("No file selected.");
  } else  {
    println("File selected: " + selection.getAbsolutePath());
    counter=0;
    Textsichern(loadStrings(selection.getAbsolutePath()));   /// My modifying.
  }
  // restart the draw() function
  loop();
  io=0;
}
</code></pre>

<p>...and modifying them.
Error at line 22</p>

<p>Gruß Willi</p>
]]></description>
   </item>
   <item>
      <title>Is it possible to perform FFT with FilePlayer object? [Minim]</title>
      <link>https://forum.processing.org/two/discussion/21842/is-it-possible-to-perform-fft-with-fileplayer-object-minim</link>
      <pubDate>Wed, 05 Apr 2017 22:19:19 +0000</pubDate>
      <dc:creator>SnailPropulsionLabs</dc:creator>
      <guid isPermaLink="false">21842@/two/discussions</guid>
      <description><![CDATA[<p>I'm trying to affect the playback speed of an mp3 based on the positions of the bars.</p>

<p>The "vanilla" code (from the analyzeSound.pde example) below works with an AudioPlayer object but when I try to combine it with the <a rel="nofollow" href="http://code.compartmental.net/minim/tickrate_class_tickrate.html">tickRate example</a>, it says "the function 'bufferSize()' does not exist" and "the global variable 'mix' does not exist".</p>

<p>I don't understand Minim enough to know how to remedy this.</p>

<p>Is it possible to do it this way?</p>

<p>Thanks.</p>

<p>Vanilla:</p>

<pre><code>import ddf.minim.*;
import ddf.minim.analysis.*;

Minim minim;
AudioPlayer player;
FFT fft;

float spectrumAvg;

void setup() {
  fullScreen();
  //size(512, 200);
  minim = new Minim(this);
  selectInput("Select an audio file:", "fileSelected");
}

void fileSelected(File selection) {
  String audioFileName = selection.getAbsolutePath();
  player = minim.loadFile(audioFileName);
  fft = new FFT(player.bufferSize(), player.sampleRate());
  player.play();
}

void draw()
{
  background(0);
  stroke(255);

  if (player != null) {
    if (fft != null) {
      fft.forward(player.mix);

      for (int i = 0; i &lt; fft.specSize(); i++) {
        float lineStrength = height - fft.getBand(i)*height/2;
        spectrumAvg += lineStrength;
        line(i, height, i, lineStrength);
      }
      spectrumAvg = spectrumAvg / fft.specSize();
      println(spectrumAvg);
    }
  }
}
</code></pre>

<p>Combined with tickRate:</p>

<pre><code>import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.spi.*; // for AudioRecordingStream
import ddf.minim.ugens.*;


Minim minim;
FilePlayer player;
FFT fft;

float spectrumAvg;

void setup() {
  fullScreen();
  //size(512, 200);
  minim = new Minim(this);
  selectInput("Select an audio file:", "fileSelected");
}

void fileSelected(File selection) {
  String audioFileName = selection.getAbsolutePath();
  player = new FilePlayer(minim.loadFileStream(audioFileName));
  fft = new FFT(player.bufferSize(), player.sampleRate()); //error
  player.play();
}

void draw()
{
  background(0);
  stroke(255);

  if (player != null) {
    if (fft != null) {
      fft.forward(player.mix); //error

      for (int i = 0; i &lt; fft.specSize(); i++) {
        float lineStrength = height - fft.getBand(i)*height/2;
        spectrumAvg += lineStrength;
        line(i, height, i, lineStrength);
      }
      spectrumAvg = spectrumAvg / fft.specSize();
      println(spectrumAvg);
    }
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>selectInput() and image import</title>
      <link>https://forum.processing.org/two/discussion/21759/selectinput-and-image-import</link>
      <pubDate>Sun, 02 Apr 2017 09:31:20 +0000</pubDate>
      <dc:creator>gius</dc:creator>
      <guid isPermaLink="false">21759@/two/discussions</guid>
      <description><![CDATA[<p>Hello everyone,</p>

<p>In my small program, the user selects an image file and then the file can be seen in full screen, I have made some mistakes in my code:</p>

<pre><code> import  java.io.File;
 import processing.opengl.*;
 PImage img;

 int mX, mY;



void setup() {
       size(640, 200);
       background(0);
       selectInput("Select a file to process:", "fileSelected");
}

void draw() {
      stroke(255);
      if(mousePressed) {
      line(mouseX, mouseY, pmouseX, pmouseY);
}
}

void fileSelected(File selection) {
      image(img, 0, 0);
      img = loadImage(selection.getAbsolutePath());
}
</code></pre>

<p>but it does not work, where I'm wrong?
Another question: how can I directly open the browser in the folder where is the code?</p>

<p>thanks!</p>
]]></description>
   </item>
   <item>
      <title>loadFile(path)</title>
      <link>https://forum.processing.org/two/discussion/20204/loadfile-path</link>
      <pubDate>Wed, 11 Jan 2017 20:38:57 +0000</pubDate>
      <dc:creator>tawn</dc:creator>
      <guid isPermaLink="false">20204@/two/discussions</guid>
      <description><![CDATA[<p>Hey i want to choose my own mp3 file and i use atm this code here</p>

<pre><code>import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;

Minim minim;
AudioPlayer Player;
int farbe;
PImage playPause;
PImage hintergrund;
void setup() {
  selectInput("Suche einen Song aus","selected");
  size(500,400);
  background(0);
  minim = new Minim(this);
  Player = minim.loadFile(path); // Spielt die Mp3 datei ab
  Player.loop(); // Wiederholt den aktuellen Song
  farbe = 0;
  smooth();
  playPause = loadImage("play3.jpg");
  hintergrund = loadImage("hintergrund2.jpg");
}

void selected(File song){
  path = song.getAbsolutePath();
  }

void interrupt(){
  while(path == null){
      noLoop();
    }
    loop();
  }

void draw()  {
  background(0);
  image(hintergrund,0,0);
  image(playPause,25,25);
  translate(width/2, height/2);
  rotate(radians(frameCount % 360 * 2));
  colorMode(HSB);
  stroke(farbe, 255, 255);
  colorMode(RGB);

  for(int j = 0; j &lt; 360; j++){

    if(Player.mix.get(j)*200 &gt; 50) {
      colorMode(HSB);
      stroke(farbe, 255,255);
      colorMode(RGB);
    }
    else {
      colorMode(HSB);
      stroke(farbe,255,255);
      colorMode(RGB);
    }
    line(cos(j)*100, sin(j)*100, cos(j)*abs(Player.left.get(j))*250 + cos(j)*100, sin(j)*abs(Player.right.get(j))*250 + sin(j)*100);
  }

    //for(int i = 0; i &lt; fft.avgSize(); i++){
    //line((i * w)*3, height/1.1, (i * w)*3, height/1.1 - fft.getAvg(i) * 0.5);

  farbe += 2;
  if( farbe &gt; 255)
  {
    farbe = 0;
  }
// #########MOUSE############
    if (mousePressed &amp;&amp; (mouseButton == LEFT)) {
    Player.pause();
  } else if (mousePressed &amp;&amp; (mouseButton == RIGHT)) {
    Player.play();
  }

  }
</code></pre>

<p>but he says 
The variable "path" does not exist
what should i do to fix this?</p>
]]></description>
   </item>
   <item>
      <title>Visualizer dont work</title>
      <link>https://forum.processing.org/two/discussion/20218/visualizer-dont-work</link>
      <pubDate>Thu, 12 Jan 2017 17:04:03 +0000</pubDate>
      <dc:creator>tawn</dc:creator>
      <guid isPermaLink="false">20218@/two/discussions</guid>
      <description><![CDATA[<p>Hey i got a problem with my visualizer</p>

<p>When i use this code 
I can select a MP3 file but the Visualizer didn´t show the line and only play the Sound</p>

<pre><code>  import ddf.minim.*;
  import ddf.minim.analysis.*;
  import ddf.minim.effects.*;
  import ddf.minim.signals.*;
  import ddf.minim.spi.*;
  import ddf.minim.ugens.*;
  String path;

  Minim minim;
  AudioPlayer Player;
  int farbe;
  PImage playPause;
  PImage hintergrund;

  void setup() {
    size(500,400);
    background(0);
    minim = new Minim(this);
    //Player = minim.loadFile(path); // Spielt die Mp3 datei ab
    //Player.loop(); // Wiederholt den aktuellen Song
    farbe = 0;
    smooth();
    playPause = loadImage("play3.jpg");
    hintergrund = loadImage("hintergrund2.jpg");
  }

  void selected(File song){
    path = song.getAbsolutePath();
    }

  void interrupt(){
    while (path == null){
      loop();
    }
     noLoop();
    }

  void draw()  {
    selectInput("Suche einen Song aus","selected");
    interrupt();
    background(0);
    Player = minim.loadFile(path); // Spielt die Mp3 datei ab
    Player.play();
    image(hintergrund,0,0);
    image(playPause,25,25);
    translate(width/2, height/2);
    rotate(radians(frameCount % 360 * 2));
    colorMode(HSB);
    stroke(farbe, 255, 255);
    colorMode(RGB);

    for(int j = 0; j &lt; 360; j++){

      if(Player.mix.get(j)*200 &gt; 50) {
        colorMode(HSB);
        stroke(farbe, 255,255);
        colorMode(RGB);
      }
      else {
        colorMode(HSB);
        stroke(farbe,255,255);
        colorMode(RGB);
      }
      line(cos(j)*100, sin(j)*100, cos(j)*abs(Player.left.get(j))*250 + cos(j)*100, sin(j)*abs(Player.right.get(j))*250 + sin(j)*100);
    }

      //for(int i = 0; i &lt; fft.avgSize(); i++){
      //line((i * w)*3, height/1.1, (i * w)*3, height/1.1 - fft.getAvg(i) * 0.5);

    farbe += 2;
    if( farbe &gt; 255)
    {
      farbe = 0;
    }
  // #########MOUSE############
      if (mousePressed &amp;&amp; (mouseButton == LEFT)) {
      Player.pause();
    } else if (mousePressed &amp;&amp; (mouseButton == RIGHT)) {
      Player.play();
    }

    }
</code></pre>

<p>But when i use this code Visualizer show me lines and effects why?
here the visualizer got a MP3 in the loadFile but i need a way to choose the mp3 file</p>

<pre><code>      import ddf.minim.*;
      import ddf.minim.analysis.*;
      import ddf.minim.effects.*;
      import ddf.minim.signals.*;
      import ddf.minim.spi.*;
      import ddf.minim.ugens.*;
      String path;

      Minim minim;
      AudioPlayer Player;
      int farbe;
      PImage playPause;
      PImage hintergrund;

      void setup() {
        size(500,400);
        background(0);
        minim = new Minim(this);
        Player = minim.loadFile("bla.mp3"); // Spielt die Mp3 datei ab
        Player.loop(); // Wiederholt den aktuellen Song
        farbe = 0;
        smooth();
        playPause = loadImage("play3.jpg");
        hintergrund = loadImage("hintergrund2.jpg");
      }

     /* void selected(File song){
        path = song.getAbsolutePath();
        }

      void interrupt(){
        while (path == null){
          loop();
        }
         noLoop();
        } */

      void draw()  {
        //selectInput("Suche einen Song aus","selected");
        //interrupt();
        background(0);
       // Player = minim.loadFile(path); // Spielt die Mp3 datei ab
      //  Player.play();
        image(hintergrund,0,0);
        image(playPause,25,25);
        translate(width/2, height/2);
        rotate(radians(frameCount % 360 * 2));
        colorMode(HSB);
        stroke(farbe, 255, 255);
        colorMode(RGB);

        for(int j = 0; j &lt; 360; j++){

          if(Player.mix.get(j)*200 &gt; 50) {
            colorMode(HSB);
            stroke(farbe, 255,255);
            colorMode(RGB);
          }
          else {
            colorMode(HSB);
            stroke(farbe,255,255);
            colorMode(RGB);
          }
          line(cos(j)*100, sin(j)*100, cos(j)*abs(Player.left.get(j))*250 + cos(j)*100, sin(j)*abs(Player.right.get(j))*250 + sin(j)*100);
        }

          //for(int i = 0; i &lt; fft.avgSize(); i++){
          //line((i * w)*3, height/1.1, (i * w)*3, height/1.1 - fft.getAvg(i) * 0.5);

        farbe += 2;
        if( farbe &gt; 255)
        {
          farbe = 0;
        }
      // #########MOUSE############
          if (mousePressed &amp;&amp; (mouseButton == LEFT)) {
          Player.pause();
        } else if (mousePressed &amp;&amp; (mouseButton == RIGHT)) {
          Player.play();
        } 
        }
</code></pre>

<p>Please help me guys i need the filepath way for my university 
plx plx plx  :(</p>
]]></description>
   </item>
   <item>
      <title>How to convert a 1D array with csv entries to a 2D array</title>
      <link>https://forum.processing.org/two/discussion/19888/how-to-convert-a-1d-array-with-csv-entries-to-a-2d-array</link>
      <pubDate>Fri, 23 Dec 2016 02:01:54 +0000</pubDate>
      <dc:creator>BlindAssassin111</dc:creator>
      <guid isPermaLink="false">19888@/two/discussions</guid>
      <description><![CDATA[<p>Okay, so I am trying to figure out how to convert a 1D array, where each entry is a string of 8 comma delimited values, into a 2D array. There number of rows depends on what file the use is reading, so that is not a constant.</p>

<p>A small snippet of the 1D array:</p>

<pre><code>205/55R16,24,5.5-7.5,6.5,8.4,7.6,24.9,837

205/45R17,23,6.5-7.5,7,8.1,7.4,24.3,859

205/50R17,25,5.5-7.5,6.5,8.4,7.5,25.1,830

215/45R17,24,7-8,7,8.4,7.7,24.7,845
</code></pre>

<p>The first entry in every row is a string, and the following 7 are values I want to use later as numbers. So how would I go about storing the first entry into a single column 1D array, and the last 7 entries into another 2D array?</p>

<p>To make it more complicated the third entry needs to be split into two different entries, making the 2D array an [m][8] array, m being the number of rows from the read file. The reason I won't be doing this by hand is I will in the end have a couple thousand lines to split, which is not an efficient process.</p>

<p>Thank you for the help!</p>
]]></description>
   </item>
   <item>
      <title>selectInput() file browser to the TOP</title>
      <link>https://forum.processing.org/two/discussion/19843/selectinput-file-browser-to-the-top</link>
      <pubDate>Tue, 20 Dec 2016 12:14:46 +0000</pubDate>
      <dc:creator>TothProc</dc:creator>
      <guid isPermaLink="false">19843@/two/discussions</guid>
      <description><![CDATA[<p>Hi,</p>

<p>I use selectInput() to find the file what I want to use. Works fine, but the file browser window is always on back. (Full screen mode as well.)
Is there any trick to keep on the top?</p>

<p>Thank you in advance.</p>
]]></description>
   </item>
   <item>
      <title>Creating GUI for music visualizer</title>
      <link>https://forum.processing.org/two/discussion/19004/creating-gui-for-music-visualizer</link>
      <pubDate>Sat, 12 Nov 2016 08:00:40 +0000</pubDate>
      <dc:creator>Sheldon96</dc:creator>
      <guid isPermaLink="false">19004@/two/discussions</guid>
      <description><![CDATA[<p>Cant seem to find any examples on how to create a GUI for music visualizer. The GUI I want to create is just a simple one that can browse music from my computer and play music through it. And also has standard buttons like play, pause and stop. Can anyone guide me or show me some examples ??</p>
]]></description>
   </item>
   <item>
      <title>Getting user prompt for selectInput() to show under Mac OS X</title>
      <link>https://forum.processing.org/two/discussion/19433/getting-user-prompt-for-selectinput-to-show-under-mac-os-x</link>
      <pubDate>Wed, 30 Nov 2016 19:11:33 +0000</pubDate>
      <dc:creator>ajohnsonlaird</dc:creator>
      <guid isPermaLink="false">19433@/two/discussions</guid>
      <description><![CDATA[<p>I'm running El Capitan (Mac OS X 10.11.6) and PDE 3.2.2 and when I run the example sketch given for selectInput() there does not appear to be any user prompt at the top of the file selection dialog box -- what shows at the top of the dialog box is the name of the sketch. (As a side note, it seems to work fine on a Raspberry Pi3):</p>

<pre><code>void setup() {
  selectInput("Select a file to process:", "fileSelected");
}

void fileSelected(File selection) {
  if (selection == null) {
    println("Window was closed or the user hit cancel.");
  } else {
    println("User selected " + selection.getAbsolutePath());
  }
}
</code></pre>

<p>I tripped over this with my own code, so I thought I would test the example sketch and it does the same thing. I'm still relatively new to P3,  so I thought I'd check on the forum before I file a bug report on GitHub.</p>

<p>Andy</p>
]]></description>
   </item>
   <item>
      <title>How to open and display an image via open dialog box</title>
      <link>https://forum.processing.org/two/discussion/19082/how-to-open-and-display-an-image-via-open-dialog-box</link>
      <pubDate>Thu, 17 Nov 2016 00:20:29 +0000</pubDate>
      <dc:creator>SemiProcess</dc:creator>
      <guid isPermaLink="false">19082@/two/discussions</guid>
      <description><![CDATA[<p>Anyone know how?  Various Google searches, and I haven't found anything other than the code below.
I just want to be able to select a .png file to be loaded into a PImage variable.  Easy enough if you want to open a specific image, but I want the user to be able to open what image they want from a folder of images.</p>

<p>void fileSelected(File selection) {
  if (selection == null) {
    println("Window was closed or the user hit cancel.");
  } else {
    println("User selected " + selection.getName());
  }
}</p>

<p>void setup()
{
  selectInput("Select a file to process:", "fileSelected");
}</p>
]]></description>
   </item>
   <item>
      <title>Does anybody have a clue about this very weird color behavior</title>
      <link>https://forum.processing.org/two/discussion/18852/does-anybody-have-a-clue-about-this-very-weird-color-behavior</link>
      <pubDate>Wed, 02 Nov 2016 20:37:29 +0000</pubDate>
      <dc:creator>Matei</dc:creator>
      <guid isPermaLink="false">18852@/two/discussions</guid>
      <description><![CDATA[<p>Hello, so I have noticed a very weird behavior of colors, which will be better explained visually. First a small introduction to what I want to do : first, open a file, which is a 9x9 pixels JPEG image. Then I want to apply the color of each pixel in the first line to all following vertical pixels. Very simple indeed, there's how I did by code :</p>

<pre><code>PImage loadedImgage;
String selectedPath = "";

void fileSelected(File selection) {
  selectedPath = selection.getAbsolutePath();
  loadedImgage = loadImage(selectedPath);
}

String getFileName(String completeFileName) {
  String[] fileNameParts = split(completeFileName, ".");
  fileNameParts = shorten(fileNameParts);
  return join(fileNameParts, ".");
}

void keyPressed() {
  if(key == 's') {
    save(getFileName(selectedPath) + "__.jpg");
    exit();
  }
}

void settings() {
  selectInput("Select a file to process:", "fileSelected");
  while (loadedImgage == null)  delay(100);
  size(loadedImgage.width, loadedImgage.height); 
}

void draw() {
  background(loadedImgage);

  for(int i = 0; i &lt; loadedImgage.width; i++) {
    color imageColor = get(i, 0);

    noStroke();
    fill(imageColor);
    rect(i, 0, 1, 9);
  }

  noLoop();
}
</code></pre>

<p>Here are the visuals :
<img src="https://c6.staticflickr.com/6/5626/30739867845_ba8c9cb93c_o.jpg" alt="" /></p>

<p>So as you can see first column of the modified file should have the same color as the first pixel of the original file (255;242;6), but strangely it doesn't, it's even a totally new color (255;225;75) which doesn't exist in any of the existing pixels !</p>

<p>So do any of you know how is this possible?
Thanx a lot for your help</p>
]]></description>
   </item>
   <item>
      <title>Not displaying graphics on screen when using beginRecord()</title>
      <link>https://forum.processing.org/two/discussion/18839/not-displaying-graphics-on-screen-when-using-beginrecord</link>
      <pubDate>Wed, 02 Nov 2016 11:06:47 +0000</pubDate>
      <dc:creator>Hypersim</dc:creator>
      <guid isPermaLink="false">18839@/two/discussions</guid>
      <description><![CDATA[<p>Hello!</p>

<p>I hope, you can help me with a little problem:
I want to draw something on the screen as well as drawing this into a PDF file.
The PDF file is written correctly, but there is no output on the screen.</p>

<p>Do you have an idea, why it does not work?</p>

<p>Thanks a lot!</p>

<p>Cheers, Sebastian</p>

<pre><code>import processing.pdf.*;

void setup() {
  size(400, 400);
  noLoop();
}

void draw() {
  selectInput("Select a listener file:", "fileSelected");
}


void fileSelected(File selection) {
  if (selection == null) {
    println("Window was closed or the user hit cancel.");
  } else {
    println("User selected " + selection.getAbsolutePath());
    drawGraphic(selection.getAbsolutePath());
  }
}


void drawGraphic(String inputString) {

  // DRAWING
  beginRecord(PDF, "filename.pdf");

  background(127);
  text(inputString, 10, 10);

  endRecord();
}
</code></pre>
]]></description>
   </item>
   </channel>
</rss>