<?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 #minim - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=%23minim</link>
      <pubDate>Sun, 08 Aug 2021 19:43:35 +0000</pubDate>
         <description>Tagged with #minim - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/tagged%23minim/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>minim: detect peaks in amplitude while sound being played</title>
      <link>https://forum.processing.org/two/discussion/26979/minim-detect-peaks-in-amplitude-while-sound-being-played</link>
      <pubDate>Thu, 22 Mar 2018 02:20:07 +0000</pubDate>
      <dc:creator>plux</dc:creator>
      <guid isPermaLink="false">26979@/two/discussions</guid>
      <description><![CDATA[<p>Hi there,
I was wondering if there's a way to detect amplitude peaks in a sound file while being played. I don't need anything fancy really, I just need to find when the "volume" is above a certain level.</p>

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

Minim minim;
AudioPlayer player;

void setup()
{
  minim = new Minim(this);
  player = minim.loadFile("/data/samples/sample02.mp3");
  player.play();
}

void draw()
{  
  println("Gain: " + player.getGain()); //always prints 0.0 but I guess it's because it's not what I'm looking for
  println("Volume: " + player.getVolume()); //Minim error: Volume is not supported
}
</code></pre>

<p>Thank you!</p>
]]></description>
   </item>
   <item>
      <title>A For Loop Question: How to play, record, save in sequence</title>
      <link>https://forum.processing.org/two/discussion/26433/a-for-loop-question-how-to-play-record-save-in-sequence</link>
      <pubDate>Mon, 19 Feb 2018 12:53:33 +0000</pubDate>
      <dc:creator>amycroft</dc:creator>
      <guid isPermaLink="false">26433@/two/discussions</guid>
      <description><![CDATA[<p>Can anyone help -I am new to processing and I am trying to create an experiment protocol which includes a part in the draw function that when called will loop through a sequence of play-&gt; record -&gt;save etc. until a set number of recorded files are saved.</p>

<p>This is part of a longer code so I have simplified it here to just the minim play/record issue, but it is why I am trying to keep the draw function clear.</p>

<p>Current Problems:
1. I'm at a complete loss how to control the play-&gt;record-&gt;save loop for a set number of times before returning to the Draw function. At the moment it moves through twice and then stops?</p>

<p>I hope someone can help -I've been trying for days now :/</p>

<p>&lt;</p>

<p>pre lang="javascript"&gt;</p>

<p>import ddf.minim.*;
import ddf.minim.AudioPlayer;</p>

<p>Minim minim;
Minim record;
AudioInput In;</p>

<p>static final int SONG = 5;
final AudioPlayer[] audio = new AudioPlayer [SONG];</p>

<p>static final int RECORDED = 5;
final AudioRecorder[] recorder = new AudioRecorder [RECORDED];</p>

<p>boolean pressSave;
PFont f;</p>

<p>int audioidx = 0;
int audiocount = 0;
int recorderidx = 0;
int recordercount = 0;</p>

<p>int saved;
static final int SAVED = 5;</p>

<p>void setup() {
  size (512, 200, P3D);
  f= createFont ("Georgia", 16);</p>

<p>minim = new Minim(this);
  audio [0] = minim.loadFile ("Audio_01.mp3");
  audio [1] = minim.loadFile ("Audio_02.mp3");
  audio [2] = minim.loadFile ("Audio_03.mp3");
  audio [3] = minim.loadFile ("Audio_04.mp3");
  audio [4] = minim.loadFile ("Audio_05.mp3");
  printArray (audio);</p>

<p>record = new Minim(this);
  In = record.getLineIn();
  recorder [0] = record.createRecorder(In, "myrecording1.wav");
  recorder [1] = record.createRecorder(In, "myrecording2.wav");
  recorder [2] = record.createRecorder(In, "myrecording3.wav");
  recorder [3] = record.createRecorder(In, "myrecording4.wav");
  recorder [4] = record.createRecorder(In, "myrecording5.wav");
  printArray (recorder);
}</p>

<p>void keyPressed(){
   if ( keyCode == TAB ){
        recorder[recorderidx].save();
        recordercount = recordercount+1;
        recorderidx =recorderidx+1;
        audiocount = audiocount+1;
        audioidx = audioidx+1;
        //recorderidx = recorderidx+1;
        pressSave = true;
        println ("recorder count", recordercount,"recorderidx", recorderidx);
        println ("audio count", audiocount,"audioidx", audioidx);
   }
}</p>

<p>void draw() {
  background (255);
  textFont (f, 16);
  fill (0);
  playrecord();
}</p>

<p>void playrecord(){</p>

<p>for (int i=0; i&lt;audio.length;i++) { 
    for (int r=0; r&lt;recorder.length;r++) {</p>

<pre><code>  if (audioidx==i &amp;&amp; !audio[audioidx].isPlaying()){
  audio[audioidx].play();
  audiocount = audiocount+1;
  println ("variable i", i);

  }     
  else if (audiocount==i+1){
  recorder[recorderidx].beginRecord();
  println ("variable r", r);
  //println ("recording", recorderidx);
    if(pressSave){
    println("Done saving.");
    pressSave = true;
     } else { 
     text ( "Press TAB to save", 10, 100);
     pressSave = false;
     }
     if (!pressSave){
     return;
     }           
     }
  else if (audiocount == i+1 &amp;&amp; recordercount == r+1){
  audio[audioidx = (audioidx + 1) % SONG].play();
  recorderidx = recorderidx+1 ;
  println ("variable r", r);
  }
  else{
    return;
}
}
</code></pre>

<p>}
}</p>

<p></p>
]]></description>
   </item>
   <item>
      <title>Minim/Tuio combination</title>
      <link>https://forum.processing.org/two/discussion/26269/minim-tuio-combination</link>
      <pubDate>Wed, 07 Feb 2018 12:43:54 +0000</pubDate>
      <dc:creator>PoYo</dc:creator>
      <guid isPermaLink="false">26269@/two/discussions</guid>
      <description><![CDATA[<p>I have some question regarding the Minim library,</p>

<p>I tried the setVolume or setGain instances both didn't change anything. I am trying to start with no sound till tuioCursorList.size is bigger than 0 and when it is, sound can fade in with a simple for loop but all my attempts on changing the volume failed so couldn't implement it to the code.</p>

<p>I got part of the code from Minim &gt; Synthesis &gt; realtimeControlExample and some stuff are out of my reach. In the code below. The out.PlayNote takes 3 parameter I got the idea of them first is the start point, second is the duration and thirds is the note which will be played. How can I set so that the note plays not just for defined time but as long as program is running?</p>

<p>And the I tried calling out.playNote in draw and didn't work, works only when its called setup which makes it harder for me to change the parameters.</p>

<pre><code>// import everything necessary to make sound.
import ddf.minim.*;
import ddf.minim.ugens.*;

import ddf.minim.effects.*;

import TUIO.*;
TuioProcessing tuioClient = new TuioProcessing(this);
ArrayList&lt;TuioCursor&gt; tuioCursorList = new ArrayList&lt;TuioCursor&gt;();


Minim minim;
AudioOutput out;
NoiseInstrument myNoise;
float x = 0;
float y = 0;
float xPos;
float yPos;
void setup()
{
  size( 500, 500, P2D );


  minim = new Minim( this );
  out = minim.getLineOut( Minim.MONO, 512 );
  myNoise = new NoiseInstrument( 1.0, out );

  out.playNote( 0, 100.0, myNoise );
}


void draw()
{
  background( 0 );
  tuioCursorList = tuioClient.getTuioCursorList();

  for (int i=0; i&lt;tuioCursorList.size(); i++) {

    TuioCursor tc = tuioCursorList.get(i);
    xPos = tc.getScreenX(width);
    yPos = tc.getScreenY(height);
    if ( tuioCursorList.size() &gt; 0) {
      float freq = map( yPos, 0, height, 200, 120 );
      float q = map( xPos, 0, width, 15, 25 );
      myNoise.setFilterCF( freq );
      myNoise.setFilterQ( q );
      println(tuioCursorList.size());
    }
  }
}



// Every instrument must implement the Instrument interface so 
// playNote() can call the instrument's methods.

// This noise instrument uses white noise and two bandpass filters
// to make a "whistling wind" sound.  By changing using the methods which
// change the frequency and the bandwidth of the filters, the sound changes.

class NoiseInstrument implements Instrument
{
  // create all variables that must be used throughout the class
  Noise myNoise;
  Multiplier multiply;
  AudioOutput out;
  BandPass filt1, filt2;
  Summer sum; 
  float freq1, freq2, freq3;
  float bandWidth1, bandWidth2;
  float filterFactor;

  // constructors for this intsrument
  NoiseInstrument( float amplitude, AudioOutput output )
  {
    // equate class variables to constructor variables as necessary 
    out = output;

    // give some initial values to the realtime control variables
    freq1 = 150.0;
    bandWidth1 = 10.0;
    filterFactor = 1.7;

    // create new instances of any UGen objects
    myNoise = new Noise( amplitude, Noise.Tint.WHITE );
    multiply = new Multiplier( 0 );
    filt1 = new BandPass( freq1, bandWidth1, out.sampleRate() );
    filt2 = new BandPass( freq2(), bandWidth2(), out.sampleRate() );
    sum = new Summer();

    // patch everything (including the out this time)
    myNoise.patch( filt1 ).patch( sum );
    myNoise.patch( filt2 ).patch( sum );
    sum.patch( multiply );
  }

  // every instrument must have a noteOn( float ) method
  void noteOn( float dur )
  {
    // set the multiply to 1 to turn on the note
    multiply.setValue( 1 );
    multiply.patch( out );
  }

  // every instrument must have a noteOff() method
  void noteOff()
  {
    // set the multiply to 0 to turn off the note 
    multiply.setValue( 0 );
    multiply.unpatch( out );
  }

  // this is a helper method only used internally to find the second filter
  float freq2()
  {
    // calculate the second frequency based on the first
    return filterFactor*freq1;
  }

  // this is a helper method only used internally 
  // to find the bandwidth of the second filter
  float bandWidth2()
  {
    // calculate the second bandwidth based on the first
    return filterFactor*bandWidth1;
  }

  // this is a method to set the center frequencies
  // of the two filters based on the CF of the first
  void setFilterCF( float cf )
  {
    freq1 = cf;
    filt1.setFreq( freq1 );
    filt2.setFreq( freq2() );
  }

  // this is a method to set the bandwidths
  // of the two filters based on the BW of the first
  void setFilterBW( float bw )
  {
    bandWidth1 = bw;
    filt1.setBandWidth( bandWidth1 );
    filt2.setBandWidth( bandWidth2() );
  }

  // this is a method to set the Q (inverse of bandwidth)
  // of the two filters based on the  
  void setFilterQ( float q )
  {
    setFilterBW( freq1/q );
  }
}

// called when a cursor is added to the scene
void addTuioCursor(TuioCursor tcur) {
}

// called when a cursor is moved
void updateTuioCursor (TuioCursor tcur) {
}

// called when a cursor is removed from the scene
void removeTuioCursor(TuioCursor tcur) {
}

// --------------------------------------------------------------
// these callback methods are called whenever a TUIO event occurs
// there are three callbacks for add/set/del events for each object/cursor/blob type
// the final refresh callback marks the end of each TUIO frame

// called when an object is added to the scene
void addTuioObject(TuioObject tobj) {
}

// called when an object is moved
void updateTuioObject (TuioObject tobj) {
}

// called when an object is removed from the scene
void removeTuioObject(TuioObject tobj) {
}

// --------------------------------------------------------------
// called when a blob is added to the scene
void addTuioBlob(TuioBlob tblb) {
}

// called when a blob is moved
void updateTuioBlob (TuioBlob tblb) {
}

// called when a blob is removed from the scene
void removeTuioBlob(TuioBlob tblb) {
}

// --------------------------------------------------------------
// called at the end of each TUIO frame
void refresh(TuioTime frameTime) {
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>How can I run input audio into this script?</title>
      <link>https://forum.processing.org/two/discussion/25751/how-can-i-run-input-audio-into-this-script</link>
      <pubDate>Fri, 29 Dec 2017 17:08:18 +0000</pubDate>
      <dc:creator>daddydean</dc:creator>
      <guid isPermaLink="false">25751@/two/discussions</guid>
      <description><![CDATA[<p>Hey there, im running this oscilloscope looking processing script from: <a href="https://github.com/worosom/Lissajou" target="_blank" rel="nofollow">https://github.com/worosom/Lissajou</a><br />
Im having difficulty understanding how to get it to make proper shapes. Right now im basically getting the white canvas with a flat line like: <a href="https://ibb.co/b1uLwb" target="_blank" rel="nofollow">https://ibb.co/b1uLwb</a><br />
I have the mic turned on and the minim library installed. Maybe it needs audio in instead of the mic? How would I go about that? Im sure the answer is fairly obvious here, I just cant figure it out.<br />
Thanks :)</p>
]]></description>
   </item>
   <item>
      <title>why wont my music load.</title>
      <link>https://forum.processing.org/two/discussion/25704/why-wont-my-music-load</link>
      <pubDate>Sun, 24 Dec 2017 21:34:56 +0000</pubDate>
      <dc:creator>ctrembla</dc:creator>
      <guid isPermaLink="false">25704@/two/discussions</guid>
      <description><![CDATA[<p>OK, I converted a youtube video to mp3 then placed it in the program, I'm making but it say can't load.
<a href="https://paste.ofcode.org/EcHFNHzudGWJ7GZcnVaqqg" target="_blank" rel="nofollow">https://paste.ofcode.org/EcHFNHzudGWJ7GZcnVaqqg</a></p>

<p>=== Minim Error ===
=== Couldn't load the file oChristmasTree.mp3</p>

<p>any advice?
minim library</p>
]]></description>
   </item>
   <item>
      <title>(Minim) How to Limit Spectrum Range in FFT?</title>
      <link>https://forum.processing.org/two/discussion/25037/minim-how-to-limit-spectrum-range-in-fft</link>
      <pubDate>Thu, 16 Nov 2017 01:21:08 +0000</pubDate>
      <dc:creator>Rammschnev</dc:creator>
      <guid isPermaLink="false">25037@/two/discussions</guid>
      <description><![CDATA[<p>I have a successful FFT visualizer up and running, but I notice that with all the audio I test it with, the right half of the spectrum (roughly) is almost never being used, and it makes the thing look tacky. I am surprised to find there's not a straightforward method in the FFT object (to my awareness) for specifying the highest and lowest frequencies I'm interested in. Is there a feasible way to accomplish this? I am attempting to filter the results in other ways with no success.</p>

<p><strong>Edit:</strong> I should also mention that I am getting linear averages, not accessing actual bands, and other components rely on the number of averages in an array being an exact value.</p>
]]></description>
   </item>
   <item>
      <title>Saving the results of inverse FFT as an audio file</title>
      <link>https://forum.processing.org/two/discussion/24655/saving-the-results-of-inverse-fft-as-an-audio-file</link>
      <pubDate>Fri, 20 Oct 2017 15:12:05 +0000</pubDate>
      <dc:creator>LokiBear</dc:creator>
      <guid isPermaLink="false">24655@/two/discussions</guid>
      <description><![CDATA[<p>Hi there,
I have just recently (last night, really) started using Processing and the Minim library with the intention to do some sound processing. The idea is to load an audio file (both for live and offline analysis), use FFT, adjust some frequencies, use inverse FFT and produce and audio file both for immediate playback and writing to disk.
I'm really struggling with saving the results of the buffer that the IFFT populates! I can see in the spectrum visualization that the right frequencies are adjusted and all seems fine, but this is the part where I'm not exactly sure what to do.
Currently I am mostly looking into the offlineAnalysis example, because doing these things offline is a bit more important for now than doing them live.</p>

<p>Edit------
The issue with live playback still stands - what I have done is create a huge float array containing data from the IFFT. I have a MultiChannelBuffer and using setSample I replace the original samples with the ones from the float array and then it black using a sampler. I know this works because the audio is just fine, but the moment I modify something using scaleFreq or so, I hear a lot of clicking noise. I'm not exactly sure what I am doing wrong, I'm sure there is some common practice how people would approach this?</p>
]]></description>
   </item>
   <item>
      <title>Exporting Windows Application Issues</title>
      <link>https://forum.processing.org/two/discussion/23338/exporting-windows-application-issues</link>
      <pubDate>Fri, 07 Jul 2017 03:11:36 +0000</pubDate>
      <dc:creator>bujbot</dc:creator>
      <guid isPermaLink="false">23338@/two/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>I'm having issues exporting my processing program into a self contained application.  I'm hoping someone here can help, and I apologize if I am asking this in the wrong place.</p>

<p>I have two instances of my program; one using the sound library and the other the minim library.  Both run fine in the processing environment.  I've tried exporting these in all possible formats (full screen, not full screen, with Java included, without)</p>

<p>When I export the version using the sound library, it crashes/hangs once a sound file is called.  I tried commenting out the first couple of sound files and the program keeps going until the next sound file is called.</p>

<p>When I export the minim version, it just shows a grey screen and never starts the program.</p>

<p>I'm hoping someone out there might have an idea or two I can try to fix this.</p>

<p>The program is for an exhibit this weekend and will run in the background.  I'm trying to export it as it's own application because I assume it will use less system resources than running it in processing.  Is this assumption correct?</p>

<p>Thanks!</p>

<p>Nik</p>
]]></description>
   </item>
   <item>
      <title>How to modify an audio file's frequency</title>
      <link>https://forum.processing.org/two/discussion/21938/how-to-modify-an-audio-file-s-frequency</link>
      <pubDate>Tue, 11 Apr 2017 16:30:39 +0000</pubDate>
      <dc:creator>PassTheSoap</dc:creator>
      <guid isPermaLink="false">21938@/two/discussions</guid>
      <description><![CDATA[<p>I have to use Processing to make a program for school. It's very simple (a basic piano), but I'm running into some problems here. The people I'm working on this program with and I have already made it by creating a different audio file for each piano key, but that's not exactly a very elegant way to make this, since all these audio files combined weigh 13.5 Mo.</p>

<p>I'm thinking of fixing this by using only one audio file corresponding to any piano key, then somehow modify its frequency so that it makes pretty much the same sound as any piano key I want it to. I think this is doable with Minim, which we use.
I've seen these kinds of things :</p>

<p>Frequency currentFreq
currentFreq = Frequency.ofPitch( "A4" );</p>

<p>But I assume the object "Frequency" is not the same as an audio file. I couldn't make it work, anyway.</p>

<p>So I'd be really happy if someone could help, thanks a lot in advance. If there are any alternative, easier solutions (or if my idea isn't even doable in the first place), I'll definitely take them. In case this wasn't obvious enough, my Processing skills aren't exactly excellent. :P</p>

<p>(apologies if I asked this question in the wrong category)</p>
]]></description>
   </item>
   <item>
      <title>use audio in processing</title>
      <link>https://forum.processing.org/two/discussion/21758/use-audio-in-processing</link>
      <pubDate>Sun, 02 Apr 2017 08:27:02 +0000</pubDate>
      <dc:creator>JDev</dc:creator>
      <guid isPermaLink="false">21758@/two/discussions</guid>
      <description><![CDATA[<p>im trying to do a simple video chat. for the video part im ok, i can manipulate and compress the pixel raster and send it over the net, as for audio for now im sending serialized wavs, which is no good.
Is there some way to aquire the microphone input just like the camera input so that i can try and sync it with video?
for now im using recorder(minim) to save a wav and play it on the other side.
Im programming in eclipse IDE.</p>
]]></description>
   </item>
   <item>
      <title>How to create a audioinput generated line art?</title>
      <link>https://forum.processing.org/two/discussion/20914/how-to-create-a-audioinput-generated-line-art</link>
      <pubDate>Tue, 21 Feb 2017 03:33:41 +0000</pubDate>
      <dc:creator>KHA</dc:creator>
      <guid isPermaLink="false">20914@/two/discussions</guid>
      <description><![CDATA[<p>Hi Everyone,</p>

<p>I have been trying to learn Processing for the past few days as Im trying to create a interactive audio(Microphone) generated line art for my school final year project.</p>

<p><strong>So, first the lines are randomly generated by audio and I want it to move from left to right slowly.
The speed of the lines are not affected by audio, but when there is a audioinput, it will "disturb" the lines making it change its course by a bit while still moving to the right and more lines would be generated according to the input Volume.</strong></p>

<p>I saw Daniel's perlin noise flow field video(managed to find the code for Processing) and also found processing files that are based on mouse movement mapping.</p>

<p>Please help me with this one, I don't have much time left with this project but I really want to use processing in it.
Perlin noise is not a must if there is another possible way, it's just the closest thing I have found so far that I want.</p>

<p>I’m really a newbie in Processing and I have a deadline soon, I’ve been checking out many tutorials and have also coded myself but I just couldn’t solve those errors.</p>

<p>Do anyone have codes that gets similar results?</p>

<p>Do tell me if you need the codes that I have tried.</p>

<p>Thank You.</p>

<p>This is the kind of line waves I wanted (perlin noise flow field) but I don't know how to use a audioinput to make it interactive.
<img src="https://forum.processing.org/two/uploads/imageupload/684/YCCGV1M6X08Z.png" alt="Screen Shot 2017-02-20 at 12.29.03 pm" title="Screen Shot 2017-02-20 at 12.29.03 pm" /></p>

<p>Mouse mapping generated art.
<img src="https://forum.processing.org/two/uploads/imageupload/302/QIMIFKUNZKMB.png" alt="Screen Shot 2017-02-20 at 12.32.12 pm" title="Screen Shot 2017-02-20 at 12.32.12 pm" /></p>

<p>Generates circles when there is an audio input.
<img src="https://forum.processing.org/two/uploads/imageupload/422/QTRMM54PR7LU.png" alt="Screen Shot 2017-02-21 at 11.27.09 am" title="Screen Shot 2017-02-21 at 11.27.09 am" /></p>
]]></description>
   </item>
   <item>
      <title>how to draw a waveform for an entire sound file ?</title>
      <link>https://forum.processing.org/two/discussion/20672/how-to-draw-a-waveform-for-an-entire-sound-file</link>
      <pubDate>Mon, 06 Feb 2017 00:21:44 +0000</pubDate>
      <dc:creator>mxloizix</dc:creator>
      <guid isPermaLink="false">20672@/two/discussions</guid>
      <description><![CDATA[<p>Hello, 
I would like to draw the waveform of an entire sound file. <br />
I have seen the example from the <a rel="nofollow" href="http://code.compartmental.net/minim/audioplayer_class_audioplayer.html">documentation</a>, but this is an osciloscope, which works with a buffer, whereas I would like to draw the waveform for the entire file, like in <a rel="nofollow" href="https://fr.wikipedia.org/wiki/Audacity#/media/File:Interface-audacity.gif">audacity for example</a></p>

<pre><code>import ddf.minim.*;
Minim minim; 
AudioPlayer sound; 

void setup() {
  size(300, 200);
  minim = new Minim(this);
  sound = minim.loadFile("mySound.wav");

  println(sound.length());

  for (int i=0; i &lt; sound.length()-1024; i+=16) {
   println( sound.mix.get(i));
  }
  exit();
}
</code></pre>

<p>this did not work because <code>get(i)</code> "Gets the i sample in the buffer", wich size is 1024...<br />
how to have all the sample value inside the file ? <br />
==&gt; <strong>answer is</strong> <code>getChannel()</code>with AudioSample (cf <a rel="nofollow" href="http://code.compartmental.net/minim/audiosample_class_audiosample.html">AudioSample</a> )</p>

<p>thx.</p>
]]></description>
   </item>
   </channel>
</rss>