Skip to content

Commit 49c6fb8

Browse files
author
Nemo2.0
committed
updates week 8
1 parent 5b65f4c commit 49c6fb8

File tree

18 files changed

+46
-2
lines changed

18 files changed

+46
-2
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,8 @@ Class repository for Advanced Creative Coding
3535
## Week 7 core learning:
3636
- Introduction to sound
3737
- [sign up for laser cutter training at Tandon Makerspace](http://makerspace.engineering.nyu.edu/training/)
38+
39+
## Week 8 core learning:
40+
- Sound, continued
41+
- Key terminology, envelopes, and synthesis
42+
- [Intro to Synthesis Part 1 - The Building Blocks of Sound & Synthesis](https://www.youtube.com/watch?v=atvtBE6t48M)

SoundEnvelopes/src/ofApp.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,18 @@ void ofApp::setup(){
1717
mGui.add(&mTriggerSoundBtn);
1818
// 2 output channels (stereo), 0 input channels
1919
// 512 samples per buffer, 2 buffers
20-
ofSoundStreamSetup(2, 0, sampleRate, 512, 2);
20+
//old way of setting up soundstream
21+
//ofSoundStreamSetup(2, 0, sampleRate, 512, 2);
22+
23+
24+
//new way of setting up soundstream
25+
ofSoundStreamSettings settings;
26+
settings.setOutListener(this);
27+
settings.sampleRate = sampleRate;
28+
settings.numOutputChannels = 2;
29+
settings.numInputChannels = 0;
30+
settings.bufferSize = 512;
31+
soundStream.setup(settings);
2132
}
2233

2334
//--------------------------------------------------------------

SoundEnvelopes/src/ofApp.h

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class ofApp : public ofBaseApp{
2424
void dragEvent(ofDragInfo dragInfo);
2525
void gotMessage(ofMessage msg);
2626
//our audio output stream
27+
ofSoundStream soundStream;
2728
void audioOut( ofSoundBuffer &outBuffer );
2829
void onButtonPress();
2930
double mPhase = 0;

SoundSimpleOscillator/src/ofApp.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,17 @@ void ofApp::setup(){
1111
mGui.add(&mVolumeSlider);
1212
// 2 output channels (stereo), 0 input channels
1313
// 512 samples per buffer, 2 buffers
14-
ofSoundStreamSetup(2, 0, sampleRate, 512, 2);
14+
//old way of setting up soundstream
15+
//ofSoundStreamSetup(2, 0, sampleRate, 512, 2);
16+
17+
//new way of setting up soundstream
18+
ofSoundStreamSettings settings;
19+
settings.setOutListener(this);
20+
settings.sampleRate = sampleRate;
21+
settings.numOutputChannels = 2;
22+
settings.numInputChannels = 0;
23+
settings.bufferSize = 512;
24+
soundStream.setup(settings);
1525
}
1626

1727
//--------------------------------------------------------------

SoundSimpleOscillator/src/ofApp.h

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class ofApp : public ofBaseApp{
2323
void gotMessage(ofMessage msg);
2424
//our audio output stream
2525
void audioOut( ofSoundBuffer &outBuffer );
26+
ofSoundStream soundStream;
2627
double mPhase = 0;
2728
ofxFloatSlider mFreqSlider;
2829
ofxFloatSlider mVolumeSlider;

WebcamCV_ColorBW/src/ofApp.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ void ofApp::setup(){
55
mVideoGrabber.setup(320, 240);
66
//we need to allocate exactly the number of pixels in our ofxCvColor and Grayscale images
77
//as in our VideoGrabber
8+
9+
//if this were an fbo, we would need to describe pixel ordering
10+
811
mColorImage.allocate(int(mVideoGrabber.getWidth()), int(mVideoGrabber.getHeight()));
912
mGrayscaleImage.allocate(int(mVideoGrabber.getWidth()), int(mVideoGrabber.getHeight()));
1013

WebcamFbo/src/ofApp.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
void ofApp::setup(){
55
mVideoGrabber.setup(320, 240);
66
mVideoGrabber.setVerbose(true);
7+
78
mFbo.allocate(mVideoGrabber.getWidth(), mVideoGrabber.getHeight(), GL_RGBA);
89

10+
911
//now we add lines to our path
1012
mPath.lineTo(mVideoGrabber.getWidth()/4, mVideoGrabber.getHeight());
1113
mPath.lineTo(mVideoGrabber.getWidth()/2, mVideoGrabber.getHeight()/ 2);

opencvContoursExample1/src/ofApp.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ void ofApp::update(){
3535

3636
colorImg.setFromPixels(vidPlayer.getPixels());
3737

38+
3839
grayImage = colorImg;
40+
3941
if (bLearnBakground == true){
4042
grayBg = grayImage; // the = sign copys the pixels from grayImage into grayBg (operator overloading)
4143
bLearnBakground = false;
@@ -101,12 +103,14 @@ void ofApp::keyPressed(int key){
101103
case '+':
102104
threshold ++;
103105
if (threshold > 255) threshold = 255;
106+
104107
break;
105108
case '-':
106109
threshold --;
107110
if (threshold < 0) threshold = 0;
108111
break;
109112
}
113+
ofLogNotice() << threshold << endl;
110114
}
111115

112116
//--------------------------------------------------------------

opencvExampleDrawing/src/ofApp.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,16 @@ void ofApp::draw(){
6363
colorImg.draw(0,0);
6464
}
6565
for (int i = 0; i < contourFinder.nBlobs; i++){
66+
ofNoFill();
67+
ofSetColor(ofColor::blue);
68+
ofDrawRectangle(contourFinder.blobs[i].boundingRect);
69+
70+
ofPushStyle();
6671
ofSetColor(ofColor::fuchsia);
6772
ofFill();
73+
6874
ofDrawEllipse(contourFinder.blobs[i].boundingRect.getCenter(), 20,20);
75+
ofPopStyle();
6976
}
7077
ofPopMatrix();
7178

0 commit comments

Comments
 (0)