mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
updated minim binaries and examples for Minim release 2.2.0
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
* the frequency content of a signal. You've seen
|
||||
* visualizations like this before in music players
|
||||
* and car stereos.
|
||||
* <p>
|
||||
* For more information about Minim and additional features,
|
||||
* visit http://code.compartmental.net/minim/
|
||||
*/
|
||||
|
||||
import ddf.minim.analysis.*;
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* This sketch demonstrates how to create synthesized sound with Minim using an AudioOutput and
|
||||
* an Instrument we define. By using the playNote method you can schedule notes to played
|
||||
* at some point in the future, essentially allowing to you create musical scores with code.
|
||||
* Because they are constructed with code, they can be either deterministic or different every time.
|
||||
* This sketch creates a deterministic score, meaning it is the same every time you run the sketch.
|
||||
* <p>
|
||||
* For more complex examples of using playNote check out algorithmicCompExample and compositionExample
|
||||
* in the Synthesis folder.
|
||||
* <p>
|
||||
* For more information about Minim and additional features, visit http://code.compartmental.net/minim/
|
||||
*/
|
||||
|
||||
import ddf.minim.*;
|
||||
import ddf.minim.ugens.*;
|
||||
|
||||
Minim minim;
|
||||
AudioOutput out;
|
||||
|
||||
// to make an Instrument we must define a class
|
||||
// that implements the Instrument interface.
|
||||
class SineInstrument implements Instrument
|
||||
{
|
||||
Oscil wave;
|
||||
Line ampEnv;
|
||||
|
||||
SineInstrument( float frequency )
|
||||
{
|
||||
// make a sine wave oscillator
|
||||
// the amplitude is zero because
|
||||
// we are going to patch a Line to it anyway
|
||||
wave = new Oscil( frequency, 0, Waves.SINE );
|
||||
ampEnv = new Line();
|
||||
ampEnv.patch( wave.amplitude );
|
||||
}
|
||||
|
||||
// this is called by the sequencer when this instrument
|
||||
// should start making sound. the duration is expressed in seconds.
|
||||
void noteOn( float duration )
|
||||
{
|
||||
// start the amplitude envelope
|
||||
ampEnv.activate( duration, 0.5f, 0 );
|
||||
// attach the oscil to the output so it makes sound
|
||||
wave.patch( out );
|
||||
}
|
||||
|
||||
// this is called by the sequencer when the instrument should
|
||||
// stop making sound
|
||||
void noteOff()
|
||||
{
|
||||
wave.unpatch( out );
|
||||
}
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
size(512, 200, P3D);
|
||||
|
||||
minim = new Minim(this);
|
||||
|
||||
// use the getLineOut method of the Minim object to get an AudioOutput object
|
||||
out = minim.getLineOut();
|
||||
|
||||
// when providing an Instrument, we always specify start time and duration
|
||||
out.playNote( 0.0, 0.9, new SineInstrument( 97.99 ) );
|
||||
out.playNote( 1.0, 0.9, new SineInstrument( 123.47 ) );
|
||||
|
||||
// we can use the Frequency class to create frequencies from pitch names
|
||||
out.playNote( 2.0, 2.9, new SineInstrument( Frequency.ofPitch( "C3" ).asHz() ) );
|
||||
out.playNote( 3.0, 1.9, new SineInstrument( Frequency.ofPitch( "E3" ).asHz() ) );
|
||||
out.playNote( 4.0, 0.9, new SineInstrument( Frequency.ofPitch( "G3" ).asHz() ) );
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
background(0);
|
||||
stroke(255);
|
||||
|
||||
// draw the waveforms
|
||||
for(int i = 0; i < out.bufferSize() - 1; i++)
|
||||
{
|
||||
line( i, 50 + out.left.get(i)*50, i+1, 50 + out.left.get(i+1)*50 );
|
||||
line( i, 150 + out.right.get(i)*50, i+1, 150 + out.right.get(i+1)*50 );
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,9 @@
|
||||
* If you load WAV file or other non-tagged file, most of the metadata
|
||||
* will be empty, but you will still have information like the filename
|
||||
* and the length.
|
||||
* <p>
|
||||
* For more information about Minim and additional features,
|
||||
* visit http://code.compartmental.net/minim/
|
||||
*/
|
||||
|
||||
import ddf.minim.*;
|
||||
@@ -52,14 +55,3 @@ void draw()
|
||||
text("Publisher: " + meta.publisher(), 5, y+=yi);
|
||||
text("Encoded: " + meta.encoded(), 5, y+=yi);
|
||||
}
|
||||
|
||||
|
||||
void stop()
|
||||
{
|
||||
// always close Minim audio classes when you are done with them
|
||||
groove.close();
|
||||
// always stop Minim before exiting
|
||||
minim.stop();
|
||||
|
||||
super.stop();
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1,12 +1,17 @@
|
||||
/**
|
||||
* This sketch demonstrates how to monitor the currently active audio input
|
||||
* of the computer using an <code>AudioInput</code>. What you will actually
|
||||
* of the computer using an AudioInput. What you will actually
|
||||
* be monitoring depends on the current settings of the machine the sketch is running on.
|
||||
* Typically, you will be monitoring the built-in microphone, but if running on a desktop
|
||||
* its feasible that the user may have the actual audio output of the computer
|
||||
* it's feasible that the user may have the actual audio output of the computer
|
||||
* as the active audio input, or something else entirely.
|
||||
* <p>
|
||||
* When you run your sketch as an applet you will need to sign it in order to get an input.
|
||||
* Press 'm' to toggle monitoring on and off.
|
||||
* <p>
|
||||
* When you run your sketch as an applet you will need to sign it in order to get an input.
|
||||
* <p>
|
||||
* For more information about Minim and additional features,
|
||||
* visit http://code.compartmental.net/minim/
|
||||
*/
|
||||
|
||||
import ddf.minim.*;
|
||||
@@ -22,9 +27,6 @@ void setup()
|
||||
|
||||
// use the getLineIn method of the Minim object to get an AudioInput
|
||||
in = minim.getLineIn();
|
||||
|
||||
// uncomment this line to *hear* what is being monitored, in addition to seeing it
|
||||
in.enableMonitoring();
|
||||
}
|
||||
|
||||
void draw()
|
||||
@@ -38,4 +40,22 @@ void draw()
|
||||
line( i, 50 + in.left.get(i)*50, i+1, 50 + in.left.get(i+1)*50 );
|
||||
line( i, 150 + in.right.get(i)*50, i+1, 150 + in.right.get(i+1)*50 );
|
||||
}
|
||||
|
||||
String monitoringState = in.isMonitoring() ? "enabled" : "disabled";
|
||||
text( "Input monitoring is currently " + monitoringState + ".", 5, 15 );
|
||||
}
|
||||
|
||||
void keyPressed()
|
||||
{
|
||||
if ( key == 'm' || key == 'M' )
|
||||
{
|
||||
if ( in.isMonitoring() )
|
||||
{
|
||||
in.disableMonitoring();
|
||||
}
|
||||
else
|
||||
{
|
||||
in.enableMonitoring();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
* a UGen. In this case, we patch an Oscil generating a sine wave into
|
||||
* the amplitude input of an Oscil generating a square wave. The result
|
||||
* is known as amplitude modulation.
|
||||
* <p>
|
||||
* For more information about Minim and additional features,
|
||||
* visit http://code.compartmental.net/minim/
|
||||
*/
|
||||
|
||||
import ddf.minim.*;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
/**
|
||||
* This sketch demonstrates how to play a file with Minim using an AudioPlayer. <br />
|
||||
* It's also a good example of how to draw the waveform of the audio.
|
||||
* <p>
|
||||
* For more information about Minim and additional features,
|
||||
* visit http://code.compartmental.net/minim/
|
||||
*/
|
||||
|
||||
import ddf.minim.*;
|
||||
@@ -20,7 +23,9 @@ void setup()
|
||||
// sketch folder. you can also pass an absolute path, or a URL.
|
||||
player = minim.loadFile("marcus_kellis_theme.mp3");
|
||||
|
||||
// play the file
|
||||
// play the file from start to finish.
|
||||
// if you want to play the file again,
|
||||
// you need to call rewind() first.
|
||||
player.play();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
/**
|
||||
* This sketch demonstrates how to an <code>AudioRecorder</code> to record audio to disk.
|
||||
* To use this sketch you need to have something plugged into the line-in on your computer, or else be working on a
|
||||
* laptop with an active built-in microphone. Press 'r' to toggle recording on and off and the press 's' to save to disk.
|
||||
* To use this sketch you need to have something plugged into the line-in on your computer,
|
||||
* or else be working on a laptop with an active built-in microphone.
|
||||
* <p>
|
||||
* Press 'r' to toggle recording on and off and the press 's' to save to disk.
|
||||
* The recorded file will be placed in the sketch folder of the sketch.
|
||||
* <p>
|
||||
* For more information about Minim and additional features,
|
||||
* visit http://code.compartmental.net/minim/
|
||||
*/
|
||||
|
||||
import ddf.minim.*;
|
||||
@@ -18,11 +23,9 @@ void setup()
|
||||
minim = new Minim(this);
|
||||
|
||||
in = minim.getLineIn();
|
||||
// create a recorder that will record from the input to the filename specified, using buffered recording
|
||||
// buffered recording means that all captured audio will be written into a sample buffer
|
||||
// then when save() is called, the contents of the buffer will actually be written to a file
|
||||
// create a recorder that will record from the input to the filename specified
|
||||
// the file will be located in the sketch's root folder.
|
||||
recorder = minim.createRecorder(in, "myrecording.wav", true);
|
||||
recorder = minim.createRecorder(in, "myrecording.wav");
|
||||
|
||||
textFont(createFont("Arial", 12));
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* This sketch demonstrates how to use an <code>AudioRecorder</code> to record audio to disk.
|
||||
* Press 'r' to toggle recording on and off and the press 's' to save to disk.
|
||||
* The recorded file will be placed in the sketch folder of the sketch.
|
||||
* <p>
|
||||
* For more information about Minim and additional features,
|
||||
* visit http://code.compartmental.net/minim/
|
||||
*/
|
||||
|
||||
import ddf.minim.*;
|
||||
@@ -19,11 +22,9 @@ void setup()
|
||||
|
||||
out = minim.getLineOut();
|
||||
|
||||
// create a recorder that will record from the input to the filename specified, using buffered recording
|
||||
// buffered recording means that all captured audio will be written into a sample buffer
|
||||
// then when save() is called, the contents of the buffer will actually be written to a file
|
||||
// create a recorder that will record from the output to the filename specified
|
||||
// the file will be located in the sketch's root folder.
|
||||
recorder = minim.createRecorder(out, "myrecording.wav", true);
|
||||
recorder = minim.createRecorder(out, "myrecording.wav");
|
||||
|
||||
// patch some sound into the output so we have something to record
|
||||
Oscil wave = new Oscil( 440.f, 1.0f );
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
* But the end result is convincing enough.
|
||||
* <p>
|
||||
* The positioning code is inside of the Play, Rewind, and Forward classes, which are in button.pde.
|
||||
* <p>
|
||||
* For more information about Minim and additional features,
|
||||
* visit http://code.compartmental.net/minim/
|
||||
*/
|
||||
|
||||
import ddf.minim.*;
|
||||
|
||||
@@ -6,8 +6,11 @@
|
||||
* sketch creates a deterministic score, meaning it is the same every time you run the sketch. It also demonstrates
|
||||
* a couple different versions of the <code>playNote</code> method.
|
||||
* <p>
|
||||
* For more complex examples of using <code>playNote</code> check out algorithmicCompExample and compositionExample
|
||||
* in the Synthesis folder.
|
||||
* For more complex examples of using <code>playNote</code> check out
|
||||
* algorithmicCompExample and compositionExample in the Synthesis folder.
|
||||
* <p>
|
||||
* For more information about Minim and additional features,
|
||||
* visit http://code.compartmental.net/minim/
|
||||
*/
|
||||
|
||||
import ddf.minim.*;
|
||||
@@ -25,6 +28,20 @@ void setup()
|
||||
// use the getLineOut method of the Minim object to get an AudioOutput object
|
||||
out = minim.getLineOut();
|
||||
|
||||
// set the tempo of the sequencer
|
||||
// this makes the first argument of playNote
|
||||
// specify the start time in quarter notes
|
||||
// and the duration becomes relative to the length of a quarter note
|
||||
// by default the tempo is 60 BPM (beats per minute).
|
||||
// at 60 BPM both start time and duration can be interpreted as seconds.
|
||||
// to retrieve the current tempo, use getTempo().
|
||||
out.setTempo( 80 );
|
||||
|
||||
// pause the sequencer so our note play back will be rock solid
|
||||
// if you don't do this, then tiny bits of error can occur since
|
||||
// the sequencer is running in parallel with you note queueing.
|
||||
out.pauseNotes();
|
||||
|
||||
// given start time, duration, and frequency
|
||||
out.playNote( 0.0, 0.9, 97.99 );
|
||||
out.playNote( 1.0, 0.9, 123.47 );
|
||||
@@ -41,15 +58,17 @@ void setup()
|
||||
out.playNote( 7.0, "G4" );
|
||||
|
||||
// the note offset is simply added into the start time of
|
||||
// every subsequenct call to playNote. It's expressed in beats,
|
||||
// but since the default tempo of an AudioOuput is 60 beats per minute,
|
||||
// this particular call translates to 8.1 seconds, as you might expect.
|
||||
// every subsequenct call to playNote. It's expressed in beats.
|
||||
// to get the current note offset, use getNoteOffset().
|
||||
out.setNoteOffset( 8.1 );
|
||||
|
||||
// because only given a note name or frequency
|
||||
// starttime defaults to 0.0 and duration defaults to 1.0
|
||||
out.playNote( "G5" );
|
||||
out.playNote( 987.77 );
|
||||
|
||||
// now we can start the sequencer again to hear our sequence
|
||||
out.resumeNotes();
|
||||
}
|
||||
|
||||
void draw()
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
* these can be calculated: <b>Linearly</b>, by grouping equal numbers of adjacent frequency bands, or
|
||||
* <b>Logarithmically</b>, by grouping frequency bands by <i>octave</i>, which is more akin to how humans hear sound.
|
||||
* <br/>
|
||||
* This sketch illustrates the difference between viewing the full spectrum, linearly spaced averaged bands,
|
||||
* and logarithmically spaced averaged bands.
|
||||
* This sketch illustrates the difference between viewing the full spectrum,
|
||||
* linearly spaced averaged bands, and logarithmically spaced averaged bands.
|
||||
* <p>
|
||||
* From top to bottom:
|
||||
* <ul>
|
||||
@@ -19,6 +19,8 @@
|
||||
* Moving the mouse across the sketch will highlight a band in each spectrum and display what the center
|
||||
* frequency of that band is. The averaged bands are drawn so that they line up with full spectrum bands they
|
||||
* are averages of. In this way, you can clearly see how logarithmic averages differ from linear averages.
|
||||
* <p>
|
||||
* For more information about Minim and additional features, visit http://code.compartmental.net/minim/
|
||||
*/
|
||||
|
||||
import ddf.minim.analysis.*;
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
/**
|
||||
* This sketch demonstrates how to create synthesized sound with Minim
|
||||
* using an AudioOutput and an Oscil. An Oscil is a UGen object,
|
||||
* one of many different types included with Minim. For many more examples
|
||||
* of UGens included with Minim, have a look in the Synthesis
|
||||
* folder of the Minim examples.
|
||||
* one of many different types included with Minim. By using
|
||||
* the numbers 1 thru 5, you can change the waveform being used
|
||||
* by the Oscil to make sound. These basic waveforms are the
|
||||
* basis of much audio synthesis.
|
||||
*
|
||||
* For many more examples of UGens included with Minim,
|
||||
* have a look in the Synthesis folder of the Minim examples.
|
||||
* <p>
|
||||
* For more information about Minim and additional features,
|
||||
* visit http://code.compartmental.net/minim/
|
||||
*/
|
||||
|
||||
import ddf.minim.*;
|
||||
@@ -32,11 +39,62 @@ void draw()
|
||||
{
|
||||
background(0);
|
||||
stroke(255);
|
||||
strokeWeight(1);
|
||||
|
||||
// draw the waveforms
|
||||
// draw the waveform of the output
|
||||
for(int i = 0; i < out.bufferSize() - 1; i++)
|
||||
{
|
||||
line( i, 50 + out.left.get(i)*50, i+1, 50 + out.left.get(i+1)*50 );
|
||||
line( i, 150 + out.right.get(i)*50, i+1, 150 + out.right.get(i+1)*50 );
|
||||
line( i, 50 - out.left.get(i)*50, i+1, 50 - out.left.get(i+1)*50 );
|
||||
line( i, 150 - out.right.get(i)*50, i+1, 150 - out.right.get(i+1)*50 );
|
||||
}
|
||||
|
||||
// draw the waveform we are using in the oscillator
|
||||
stroke( 128, 0, 0 );
|
||||
strokeWeight(4);
|
||||
for( int i = 0; i < width-1; ++i )
|
||||
{
|
||||
point( i, height/2 - (height*0.49) * wave.getWaveform().value( (float)i / width ) );
|
||||
}
|
||||
}
|
||||
|
||||
void mouseMoved()
|
||||
{
|
||||
// usually when setting the amplitude and frequency of an Oscil
|
||||
// you will want to patch something to the amplitude and frequency inputs
|
||||
// but this is a quick and easy way to turn the screen into
|
||||
// an x-y control for them.
|
||||
|
||||
float amp = map( mouseY, 0, height, 1, 0 );
|
||||
wave.setAmplitude( amp );
|
||||
|
||||
float freq = map( mouseX, 0, width, 110, 880 );
|
||||
wave.setFrequency( freq );
|
||||
}
|
||||
|
||||
void keyPressed()
|
||||
{
|
||||
switch( key )
|
||||
{
|
||||
case '1':
|
||||
wave.setWaveform( Waves.SINE );
|
||||
break;
|
||||
|
||||
case '2':
|
||||
wave.setWaveform( Waves.TRIANGLE );
|
||||
break;
|
||||
|
||||
case '3':
|
||||
wave.setWaveform( Waves.SAW );
|
||||
break;
|
||||
|
||||
case '4':
|
||||
wave.setWaveform( Waves.SQUARE );
|
||||
break;
|
||||
|
||||
case '5':
|
||||
wave.setWaveform( Waves.QUARTERPULSE );
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
* <p>
|
||||
* Use 'k' and 's' to trigger a kick drum sample and a snare sample, respectively.
|
||||
* You will see their waveforms drawn when they are played back.
|
||||
* <p>
|
||||
* For more information about Minim and additional features,
|
||||
* visit http://code.compartmental.net/minim/
|
||||
*/
|
||||
|
||||
import ddf.minim.*;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
/* delayExample
|
||||
is an example of using the Delay UGen in a continuous sound example.
|
||||
Use the mouse to control the delay time and the amount of feedback
|
||||
in the delay unit.
|
||||
author: Anderson Mills
|
||||
Anderson Mills's work was supported by numediart (www.numediart.org)
|
||||
*/
|
||||
/* delayExample<br/>
|
||||
* is an example of using the Delay UGen in a continuous sound example.
|
||||
* <p>
|
||||
* For more information about Minim and additional features,
|
||||
* visit http://code.compartmental.net/minim/
|
||||
* <p>
|
||||
* author: Anderson Mills<br/>
|
||||
* Anderson Mills's work was supported by numediart (www.numediart.org)
|
||||
*/
|
||||
|
||||
// import everything necessary to make sound.
|
||||
import ddf.minim.*;
|
||||
@@ -14,47 +16,44 @@ import ddf.minim.ugens.*;
|
||||
// more than one methods (setup(), draw(), stop()).
|
||||
Minim minim;
|
||||
AudioOutput out;
|
||||
Delay myDelay1;
|
||||
Delay myDelay;
|
||||
|
||||
// setup is run once at the beginning
|
||||
void setup()
|
||||
{
|
||||
// initialize the drawing window
|
||||
size( 512, 200, P2D );
|
||||
size( 512, 200 );
|
||||
|
||||
// initialize the minim and out objects
|
||||
minim = new Minim(this);
|
||||
out = minim.getLineOut( Minim.MONO, 2048 );
|
||||
out = minim.getLineOut();
|
||||
|
||||
// initialize myDelay1 with continual feedback and no audio passthrough
|
||||
myDelay1 = new Delay( 0.6, 0.9, true, false );
|
||||
// initialize myDelay with continual feedback and audio passthrough
|
||||
myDelay = new Delay( 0.4, 0.5, true, true );
|
||||
|
||||
// sawh will create a Sawtooth wave with the requested number of harmonics.
|
||||
// like with Waves.randomNHarms for sine waves,
|
||||
// you can create a richer sounding sawtooth this way.
|
||||
Waveform saw = Waves.sawh( 15 );
|
||||
// create the Blip that will be used
|
||||
Oscil myBlip = new Oscil( 245.0, 0.3, Waves.saw( 15 ) );
|
||||
Oscil myBlip = new Oscil( 245.0, 0.3, saw );
|
||||
|
||||
// Waves.square will create a square wave with an uneven duty-cycle,
|
||||
// also known as a pulse wave. a square wave has only two values,
|
||||
// either -1 or 1 and the duty cycle indicates how much of the wave
|
||||
// should -1 and how much 1. in this case, we are asking for a square
|
||||
// wave that is -1 90% of the time, and 1 10% of the time.
|
||||
Waveform square = Waves.square( 0.9 );
|
||||
// create an LFO to be used for an amplitude envelope
|
||||
Oscil myLFO = new Oscil( 0.5, 0.3, Waves.square( 0.005 ) );
|
||||
// our LFO will operate on a base amplitude
|
||||
Constant baseAmp = new Constant(0.3);
|
||||
// we get the final amplitude by summing the two
|
||||
Summer ampSum = new Summer();
|
||||
|
||||
Summer sum = new Summer();
|
||||
|
||||
// patch everything together
|
||||
// the LFO is patched into a summer along with a constant value
|
||||
// and that sum is used to drive the amplitude of myBlip
|
||||
baseAmp.patch( ampSum );
|
||||
myLFO.patch( ampSum );
|
||||
ampSum.patch( myBlip.amplitude );
|
||||
Oscil myLFO = new Oscil( 1, 0.3, square );
|
||||
// offset the center value of the LFO so that it outputs 0
|
||||
// for the long portion of the duty cycle
|
||||
myLFO.offset.setLastValue( 0.3 );
|
||||
|
||||
// the Blip is patched directly into the sum
|
||||
myBlip.patch( sum );
|
||||
myLFO.patch( myBlip.amplitude );
|
||||
|
||||
// and the Blip is patched through the delay into the sum.
|
||||
myBlip.patch( myDelay1 ).patch( sum );
|
||||
|
||||
// patch the sum into the output
|
||||
sum.patch( out );
|
||||
// and the Blip is patched through the delay into the output
|
||||
myBlip.patch( myDelay ).patch( out );
|
||||
}
|
||||
|
||||
// draw is run many times
|
||||
@@ -73,7 +72,10 @@ void draw()
|
||||
// draw a line from one buffer position to the next for both channels
|
||||
line( x1, 50 + out.left.get(i)*50, x2, 50 + out.left.get(i+1)*50);
|
||||
line( x1, 150 + out.right.get(i)*50, x2, 150 + out.right.get(i+1)*50);
|
||||
}
|
||||
}
|
||||
|
||||
text( "Delay time is " + myDelay.delTime.getLastValue(), 5, 15 );
|
||||
text( "Delay amplitude (feedback) is " + myDelay.delAmp.getLastValue(), 5, 30 );
|
||||
}
|
||||
|
||||
// when the mouse is moved, change the delay parameters
|
||||
@@ -81,8 +83,8 @@ void mouseMoved()
|
||||
{
|
||||
// set the delay time by the horizontal location
|
||||
float delayTime = map( mouseX, 0, width, 0.0001, 0.5 );
|
||||
myDelay1.setDelTime( delayTime );
|
||||
myDelay.setDelTime( delayTime );
|
||||
// set the feedback factor by the vertical location
|
||||
float feedbackFactor = map( mouseY, 0, height, 0.0, 0.99 );
|
||||
myDelay1.setDelAmp( feedbackFactor );
|
||||
float feedbackFactor = map( mouseY, 0, height, 0.99, 0.0 );
|
||||
myDelay.setDelAmp( feedbackFactor );
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
/* filterExample
|
||||
is an example of using the different filters
|
||||
in continuous sound.
|
||||
|
||||
author: Damien Di Fede, Anderson Mills
|
||||
Anderson Mills's work was supported by numediart (www.numediart.org)
|
||||
*/
|
||||
/* filterExample<br/>
|
||||
* is an example of using the different filters
|
||||
* in continuous sound.
|
||||
* <p>
|
||||
* For more information about Minim and additional features,
|
||||
* visit http://code.compartmental.net/minim/
|
||||
* <p>
|
||||
* author: Damien Di Fede, Anderson Mills<br/>
|
||||
* Anderson Mills's work was supported by numediart (www.numediart.org)
|
||||
*/
|
||||
|
||||
// import everything necessary to make sound.
|
||||
import ddf.minim.*;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
/* frequencyModulation
|
||||
<p>
|
||||
A simple example for doing FM (frequency modulation) using two Oscils.
|
||||
Use the mouse to control the speed and range of the frequency modulation.
|
||||
<p>
|
||||
Author: Damien Di Fede
|
||||
*/
|
||||
<p>
|
||||
A simple example for doing FM (frequency modulation) using two Oscils.
|
||||
<p>
|
||||
For more information about Minim and additional features,
|
||||
visit http://code.compartmental.net/minim/
|
||||
<p>
|
||||
Author: Damien Di Fede
|
||||
*/
|
||||
|
||||
// import everything necessary to make sound.
|
||||
import ddf.minim.*;
|
||||
@@ -62,6 +64,9 @@ void draw()
|
||||
line( x1, 50 + out.left.get(i)*50, x2, 50 + out.left.get(i+1)*50);
|
||||
line( x1, 150 + out.right.get(i)*50, x2, 150 + out.right.get(i+1)*50);
|
||||
}
|
||||
|
||||
text( "Modulation frequency: " + fm.frequency.getLastValue(), 5, 15 );
|
||||
text( "Modulation amplitude: " + fm.amplitude.getLastValue(), 5, 30 );
|
||||
}
|
||||
|
||||
// we can change the parameters of the frequency modulation Oscil
|
||||
@@ -71,6 +76,6 @@ void mouseMoved()
|
||||
float modulateAmount = map( mouseY, 0, height, 220, 1 );
|
||||
float modulateFrequency = map( mouseX, 0, width, 0.1, 100 );
|
||||
|
||||
fm.frequency.setLastValue( modulateFrequency );
|
||||
fm.amplitude.setLastValue( modulateAmount );
|
||||
fm.setFrequency( modulateFrequency );
|
||||
fm.setAmplitude( modulateAmount );
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
* a file from the data folder into a MultiChannelBuffer and then modifies that sample data before
|
||||
* using it to create a Sampler UGen. You can hear the result of this modification by hitting
|
||||
* the space bar.
|
||||
* <p>
|
||||
* For more information about Minim and additional features,
|
||||
* visit http://code.compartmental.net/minim/
|
||||
*/
|
||||
|
||||
import ddf.minim.*;
|
||||
|
||||
Reference in New Issue
Block a user