Skip to content

Commit

Permalink
Comment Messier and Cuomo instruments
Browse files Browse the repository at this point in the history
  • Loading branch information
hirthy committed Mar 30, 2011
1 parent f1c6556 commit e96b8a5
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 44 deletions.
44 changes: 22 additions & 22 deletions src/Cuomo.java
@@ -1,16 +1,19 @@
/*
* Mike's Instrument #1: Cuomo
*/

import java.util.*;
import com.softsynth.jsyn.*;

/*
* Cuomo instrument class. Uses Sine and Square Instruments to create
* a sound similar to a synth lead. Uses no envelopes.
* @author Mike Hirth
*
*/

import java.util.*;
import com.softsynth.jsyn.*;

public class Cuomo extends Instrument {



public Cuomo(Instrument... extras)
{
super();
Expand All @@ -25,24 +28,13 @@ public Cuomo(Instrument... extras)
makeTimbre();
startScope();
}

/*
* Defines details of the envelopes. Creates sine oscillators and
* connects the harmonics to the mixer.
*/
public void makeTimbre()
{
mixer = new SynthMixer(harmonics.length + extraneous.size(), 2);
//this can go away since there are no custom harmonics. i'll leave it here in case you want to play around with more
for(int i = 0; i < harmonics.length; i++)
{
SineOscillator sineOsc = new SineOscillator();
sineInputs.add(sineOsc);
freqMods.add(sineOsc.frequency);

//stereo wavves
mixer.connectInput( i, sineOsc.output, 0 );
mixer.setGain( i, 0, amplitude );
mixer.setGain( i, 1, amplitude );

sineOsc.amplitude.set(1 / harmonics[i]); //Full amplitude for sine harmonic, 1/n for the rest
}

int i =0;
for(Instrument extra : extraneous)
Expand All @@ -57,6 +49,9 @@ public void makeTimbre()

}

/*
* Manages envelopes for both the sine wave and the square wave.
*/
public void start()
{
System.out.println("start");
Expand All @@ -71,7 +66,10 @@ public void start()
for(SynthOscillator sineOsc : sineInputs)
sineOsc.start();
}

/*
* Stops the instruments and the sine
* oscillators are stopped.
*/
public void stop()
{
System.out.println("stop");
Expand All @@ -83,7 +81,9 @@ public void stop()
for(SynthOscillator sineOsc : sineInputs)
sineOsc.stop();
}

/*
* Defines frequency and sets depending on the harmonics.
*/
public void adjustFrequencyByOffset(int offset) {
//harmonic mode
for(Instrument extra : extraneous)
Expand Down
43 changes: 21 additions & 22 deletions src/Messier.java
@@ -1,13 +1,17 @@
/*
* Mike's Instrument #2: Messier
*/

import java.util.*;
import com.softsynth.jsyn.*;

/*
* Messier instrument class. Uses Triangle and Noise Instruments to create
* a spacey sound. Uses an envelope with a short duration.
* @author Mike Hirth
*
*/

import java.util.*;
import com.softsynth.jsyn.*;

public class Messier extends Instrument {

public Messier(Instrument... extras)
Expand All @@ -27,7 +31,10 @@ public Messier(Instrument... extras)
makeTimbre();
startScope();
}

/*
* Defines details of the envelopes. Creates sine oscillators and
* connects the harmonics to the mixer.
*/
public void makeTimbre()
{
// envelope for sine wave
Expand All @@ -44,21 +51,6 @@ public void makeTimbre()

mixer = new SynthMixer(harmonics.length + extraneous.size(), 2);

// set the amplitude
for(int i = 0; i < harmonics.length; i++)
{
SineOscillator sineOsc = new SineOscillator();
sineInputs.add(sineOsc);
freqMods.add(sineOsc.frequency);

//stereo wavves
mixer.connectInput( i, sineOsc.output, 0 );
mixer.setGain( i, 0, amplitude );
mixer.setGain( i, 1, amplitude );

sineOsc.amplitude.set(amplitude);
}

int i =0;
for(Instrument extra : extraneous)
{
Expand All @@ -73,7 +65,9 @@ public void makeTimbre()
envPlayer.start();

}

/*
* Manages envelopes for both the triangle wave and the noise wave.
*/
public void start()
{
System.out.println("start");
Expand All @@ -91,7 +85,10 @@ public void start()
for(SynthOscillator sineOsc : sineInputs)
sineOsc.start();
}

/*
* Stops the instruments and the sine
* oscillators are stopped.
*/
public void stop()
{
System.out.println("stop");
Expand All @@ -103,7 +100,9 @@ public void stop()
for(SynthOscillator sineOsc : sineInputs)
sineOsc.stop();
}

/*
* Defines frequency and sets depending on the harmonics.
*/
public void adjustFrequencyByOffset(int offset) {
//harmonic mode
for(Instrument extra : extraneous)
Expand Down

0 comments on commit e96b8a5

Please sign in to comment.