Created
November 25, 2015 16:28
-
-
Save slambert/28face87b26e2cd5e1ee to your computer and use it in GitHub Desktop.
sample tone generator, with Griffen Tech knob (or whatever)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is a sample sketch I made to work with the Griffen Tech knob. | |
You can alter it to use any input. | |
The sounds are all generated with the sine wave generator in Processing. | |
Steve Lambert November 24, 2015 | |
*/ | |
float sineFreq = 440; | |
float sineFreqPast = 440; | |
float sineAmp = 1; | |
import processing.sound.*; | |
SinOsc sine; | |
void setup() { | |
size(640, 360); | |
background(255); | |
println("sineAmp: " + sineAmp); | |
// Create the sine oscillator. | |
sine = new SinOsc(this); | |
sine.play(); | |
} | |
void draw() { | |
//int i = 1; | |
//if (sineFreqPast == sineFreq){ | |
//if (sineAmp >= .1) { | |
////sineAmp = 1 - (sineAmp * .1); | |
//sineAmp = sineAmp - 1; | |
//sine.amp(sineAmp * .1); | |
//println("bongo " + i + " sineAmp " + sineAmp); | |
//} | |
//} else { | |
// if (sineAmp <= 9){ | |
// sineAmp = sineAmp + 1; | |
// sine.amp(sineAmp * .1); | |
// println("bingo " + i + " sineAmp " + sineAmp); | |
// } | |
//} | |
sine.freq(sineFreq); | |
sine.amp(sineAmp); | |
sineFreqPast = sineFreq; | |
//if (sineAmp <= .9) { | |
// for (int i = 10; i > 0; i--) | |
// sine.amp(i*.1); | |
//} | |
} | |
void mouseWheel(MouseEvent event) { | |
//if (sineAmp == 0) { | |
// for (int i = 10; i < 0; i++){ | |
// sineAmp = (i*.1); | |
// sine.amp(sineAmp); | |
// } | |
//} | |
float e = event.getCount(); | |
sineFreq = sineFreq + e; | |
println("sineFreq: " + sineFreq + " e: " + e + " sineAmp: " + sineAmp); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment