<?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 input() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=input%28%29</link>
      <pubDate>Sun, 08 Aug 2021 19:47:56 +0000</pubDate>
         <description>Tagged with input() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedinput%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>TIS/TSM ERROR &amp; crash while looping()</title>
      <link>https://forum.processing.org/two/discussion/27904/tis-tsm-error-crash-while-looping</link>
      <pubDate>Wed, 02 May 2018 12:43:57 +0000</pubDate>
      <dc:creator>je5c</dc:creator>
      <guid isPermaLink="false">27904@/two/discussions</guid>
      <description><![CDATA[<p>anyone know why this is crashing right when it should loop?</p>

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

// Declare the processing sound variables 
SoundFile sample;
Amplitude rms;

// Declare a scaling factor
float scale=1;

// Declare a smooth factor
float smooth_factor=0.25;

// Used for smoothing
float sum;

PImage img;       // The source image
int cellsize = 2; // Dimensions of each cell in the grid
int columns, rows;   // Number of columns and rows in our system

public void setup() {
  size(800, 1000, P3D); 
  //fullScreen(P3D);
  img = loadImage("...");  // Load the image
  columns = img.width / cellsize;  // Calculate # of columns
  rows = img.height / cellsize;  // Calculate # of rows

    //Load and play a soundfile and loop it
    sample = new SoundFile(this, "...");
    sample.loop();

    // Create and patch the rms tracker
    rms = new Amplitude(this);
    rms.input(sample);

}

void draw() {
  background(255,0,255);
  // Begin loop for columns
  for ( int i = 0; i &lt; columns; i++) {
    // Begin loop for rows
    for ( int j = 0; j &lt; rows; j++) {
      int x = i*cellsize + cellsize/2;  // x position
      int y = j*cellsize + cellsize/2;  // y position
      int loc = x + y*img.width;  // Pixel array location
      color c = img.pixels[loc];  // Grab the color
      // Calculate a z position as a function of mouseX and pixel brightness
      //float z = width/2 * brightness(img.pixels[loc]) - 20.0;
        float rms_scaled=sum*width/10 * brightness(img.pixels[loc]) - 20.0;

     // smooth the rms data by smoothing factor
    sum += (rms.analyze() - sum) * smooth_factor;  

    // rms.analyze() return a value between 0 and 1. It's
    // scaled to height/2 and then multiplied by a scale factor


      // Translate to the location, set fill and stroke, and draw the rect
      pushMatrix();
      //translate(x + 300, y + 250, rms_scaled);
      translate(x + 200, y + 200, rms_scaled);
      fill(c, 204);
      noStroke();
      rectMode(CENTER);
      rect(0, 0, cellsize, cellsize);
      popMatrix();
    }
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to use input with (python) processing running on a mac ?</title>
      <link>https://forum.processing.org/two/discussion/23646/how-to-use-input-with-python-processing-running-on-a-mac</link>
      <pubDate>Mon, 31 Jul 2017 07:40:55 +0000</pubDate>
      <dc:creator>bcastagnetto</dc:creator>
      <guid isPermaLink="false">23646@/two/discussions</guid>
      <description><![CDATA[<p>Hi,</p>

<p>I just downloaded processing and installed python mode. I am running processing 3.3.5 on a Macbook Air (OS Sierra 10.13.6).</p>

<p>I'm trying to run a very basic code :</p>

<pre><code>a=input()
print(a)
</code></pre>

<p>But it won't work I got the error:</p>

<pre><code> processing.app.SketchException: EOFError: raw_input()
    at jycessing.mode.run.SketchRunner.convertPythonSketchError(SketchRunner.java:248)
    at jycessing.mode.run.SketchRunner.access$4(SketchRunner.java:227)
    at jycessing.mode.run.SketchRunner$3.run(SketchRunner.java:122)
    at java.lang.Thread.run(Thread.java:748)
</code></pre>

<p>What should I do please ?</p>
]]></description>
   </item>
   <item>
      <title>sound library in Python Mode</title>
      <link>https://forum.processing.org/two/discussion/24839/sound-library-in-python-mode</link>
      <pubDate>Wed, 01 Nov 2017 18:51:05 +0000</pubDate>
      <dc:creator>laiclil</dc:creator>
      <guid isPermaLink="false">24839@/two/discussions</guid>
      <description><![CDATA[<p>Hi All,</p>

<p>Apologies right off the bat for what may be a stupid question - but I'm working in Python mode and would like to be able to use the sound library. Specifically, I have an FFT visualization script from Java mode that I'd like to be able to adapt for something I'm working on in Python mode. I'm not sure how to go about translating the code that references the library, though (I'm pasting some for example here). Are there any resources out there that might help with this? I've looked for documentation on the sound library within Python mode but haven't found anything yet. Any other suggestions? Thanks!</p>

<p>// Create an Input stream which is routed into the Amplitude analyzer
  fft = new FFT(this, bands);
  in = new AudioIn(this, 0);</p>

<p>// start the Audio Input
  in.start();</p>

<p>// patch the AudioIn
  fft.input(in);</p>
]]></description>
   </item>
   <item>
      <title>Storing User Input inside a Variable</title>
      <link>https://forum.processing.org/two/discussion/25115/storing-user-input-inside-a-variable</link>
      <pubDate>Mon, 20 Nov 2017 22:47:19 +0000</pubDate>
      <dc:creator>kimelbert</dc:creator>
      <guid isPermaLink="false">25115@/two/discussions</guid>
      <description><![CDATA[<p>Hi, I'm trying to store user input inside a variable. The following is my code:</p>

<p><code>var input;
 var string;
 function setup(){
    input = createInput();
    string = input.value();
 }</code></p>

<p>When I print string it is empty. Why isn't it storing the value for input? Is there a way to store input inside a variable?</p>
]]></description>
   </item>
   <item>
      <title>How to check if dom slider is currently in use</title>
      <link>https://forum.processing.org/two/discussion/24033/how-to-check-if-dom-slider-is-currently-in-use</link>
      <pubDate>Tue, 05 Sep 2017 05:23:33 +0000</pubDate>
      <dc:creator>animatebig</dc:creator>
      <guid isPermaLink="false">24033@/two/discussions</guid>
      <description><![CDATA[<p>I want to know if the dom slider is currently used. I.e if the slider is currently moving or not.
Any idea how to do it?</p>
]]></description>
   </item>
   <item>
      <title>I could not find INPUT in the python reference page?</title>
      <link>https://forum.processing.org/two/discussion/23786/i-could-not-find-input-in-the-python-reference-page</link>
      <pubDate>Sat, 12 Aug 2017 19:22:43 +0000</pubDate>
      <dc:creator>netrate</dc:creator>
      <guid isPermaLink="false">23786@/two/discussions</guid>
      <description><![CDATA[<p>Is there a way to get input in processing for python?  If not, how would one input information?</p>
]]></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>How do I reset the value inside an input box?</title>
      <link>https://forum.processing.org/two/discussion/20076/how-do-i-reset-the-value-inside-an-input-box</link>
      <pubDate>Thu, 05 Jan 2017 00:10:12 +0000</pubDate>
      <dc:creator>BleuBox</dc:creator>
      <guid isPermaLink="false">20076@/two/discussions</guid>
      <description><![CDATA[<p>I am trying to make a quiz in p5.js where the user types the answer in an input box and then submits it using a button. The question changes to a different one if the user has the right answer, but I cannot find out how to make the input box reset so that it has no text in it.</p>
]]></description>
   </item>
   </channel>
</rss>