SketchPad

Some web space to sketch, doodle and make notes. Made using these tools. See more of my work here.

Sketch 2015-06-02

        void ofApp::setup(){
    playing = true;
    note = 60;

    manager.setup();
    manager.toggleDebugUI();
    manager.add(&chain1, "tal-1", ofColor::blue);
    manager.add(&chain2, "tal-2", ofColor::red);

    bpm.setBpm(160);
    ofAddListener(bpm.beatEvent, this, &ofApp::play);
    bpm.start();
}

void ofApp::play(void){
    if(playing) {
        chain1.midi()->sendNoteOn(1, note);
    }
}

void ofApp::togglePlaying() {
    playing = !playing;
    if(!playing) {
        chain1.midi()->sendNoteOff(1, note);
    }
}

void ofApp::update(){
    manager.update();

    val = ofMap(sin(ofGetFrameNum() * 0.04), -1, 1, 30, 59);
    chain1.getReverb()->set(kReverbParam_DryWetMix, val);

    val = ofMap(cos(ofGetFrameNum() * 0.005), -1, 1, 0, 100);
    chain1.getSynth()->set(TALNoiseMaker_osc1tune, val);
    
    val = ofMap(cos(ofGetFrameNum() * 0.0005), -1, 1, 50  , 2 50);
    chain1.getFilter()->set(kLowPassParam_CutoffFrequency, val);
}
    

I don't even remember making this one. I think I'll be as surprised as anyone when I hear it. #eyeo

Sketch 2015-06-01

        void ofApp::setup(){
    manager.setup();
    manager.toggleDebugUI();

    playing = true;
    note = 60;
    
    for(int i = 0; i < 4; i++){
        chains.push_back(chain);
    }
    
    for(int i = 0; i < chains.size(); i++){
        manager.add(&chains.at(i), "tal-" + ofToString(i), ofColor::fromHsb((i * 255 / chains.size()), 255, 255));
        chains.at(i).midi()->sendNoteOn(1, note);
    }
    
    bpm.setBpm(160);
    ofAddListener(bpm.beatEvent, this, &ofApp::play);
    bpm.start();
}

void ofApp::play(void){
    if(playing) {
        for(int i = 0; i < chains.size(); i++){
            val = currentChain == i ? 1 : 0;
            chains.at(i).getSynth()->set(TALNoiseMaker_volume, val);
        }

        currentChain = currentChain == chains.size() - 1 ? 0 : currentChain + 1;
    }
}

void ofApp::togglePlaying() {
    playing = !playing;
    if(!playing) {
        for(int i = 0; i < chains.size(); i++){
            chains.at(i).midi()->sendNoteOff(1, note);
        }
    }
}

void ofApp::update(){
    manager.update();
    
    val = ofMap(cos(ofGetFrameNum() * 0.04), -1, 1, 0, 1);
    chains.at(0).getSynth()->set(TALNoiseMaker_osc1tune, val);
}
    

Time-indexed volume distribution between 4 chains

Sketch 2015-05-31

        void ofApp::setup(){
    manager.setup();
    manager.toggleDebugUI();
    manager.add(&chain1, "tal-one", ofColor::blue);
    manager.add(&chain2, "tal-two", ofColor::blue);

    playing = false;
    note = 60;
    
    ofAddListener(bpm.beatEvent, this, &ofApp::play);
    bpm.start();
    chain1.midi()->sendNoteOn(1, note);
    chain2.midi()->sendNoteOn(1, note);
}

void ofApp::play(void){
    if(playing) {
        if(currentChain == 1) {
            chain1.getSynth()->set(TALNoiseMaker_volume, -10);
            chain2.getSynth()->set(TALNoiseMaker_volume, 0);
            currentChain = 2;
        } else {
            chain1.getSynth()->set(TALNoiseMaker_volume, 0);
            chain2.getSynth()->set(TALNoiseMaker_volume, -10);
            currentChain = 1;
        }
    }
}

void ofApp::togglePlaying() {
    playing = !playing;
    if(!playing) {
        chain1.midi()->sendNoteOff(1, note);
    }
}

void ofApp::update(){
    manager.update();
    
    //Animate everythung based on sin()
    val = ofMap(sin(ofGetFrameNum() * 0.03), -1, 1, 0.4, 0.6);
    chain1.getSynth()->set(TALNoiseMaker_lfo2rate, val);
    
    val = ofMap(sin(ofGetFrameNum() * 0.06), -1, 1, 0.3, 0.8);
    chain1.getSynth()->set(TALNoiseMaker_envelopeeditoramount, val);
    
    val = ofMap(sin(ofGetFrameNum() * 0.45), -1, 1, 6900, 4000);
    chain1.getFilter()->set(kLowPassParam_CutoffFrequency, val);
    
    val = ofMap(sin(ofGetFrameNum() * 0.2), -1, 1, 10, 26);
    chain1.getFilter()->set(kLowPassParam_Resonance, val);
    
    //Exactly the same, but with cos()
    val = ofMap(cos(ofGetFrameNum() * 0.03), -1, 1, 0.4, 0.6);
    chain2.getSynth()->set(TALNoiseMaker_lfo2rate, val);
    
    val = ofMap(cos(ofGetFrameNum() * 0.06), -1, 1, 0.3, 0.8);
    chain2.getSynth()->set(TALNoiseMaker_envelopeeditoramount, val);
    
    val = ofMap(cos(ofGetFrameNum() * 0.45), -1, 1, 6900, 4000);
    chain2.getFilter()->set(kLowPassParam_CutoffFrequency, val);
    
    val = ofMap(cos(ofGetFrameNum() * 0.2), -1, 1, 10, 26);
    chain2.getFilter()->set(kLowPassParam_Resonance, val);
}
    

A simple adjustment, oscillating between two synths

Sketch 2015-05-30

        ofxAudioUnitManager manager;
TALNoiseMakerChain talChain;
ofxBpm bpm;

void ofApp::setup(){
    manager.setup();
    manager.toggleDebugUI();
    manager.add(&talChain, "tal-one", ofColor::blue);

    playing = false;
    note = 60;
    
    ofAddListener(bpm.beatEvent, this, &ofApp::play);
    bpm.start();
    talChain.getFilter()->getUnit()->printParameterList();
}

void ofApp::play(void){
    if(playing) {
        talChain.midi()->sendNoteOn(1, note);
    }
}

void ofApp::togglePlaying() {
    playing = !playing;
    if(!playing) {
        talChain.midi()->sendNoteOff(1, note);
    }
}

void ofApp::update(){
    manager.update();

    val = ofMap(sin(ofGetFrameNum() * 0.03), -1, 1, 0.4, 0.6);
    talChain.getSynth()->set(TALNoiseMaker_lfo2rate, val);

    val = ofMap(sin(ofGetFrameNum() * 0.06), -1, 1, 0.3, 0.8);
    talChain.getSynth()->set(TALNoiseMaker_envelopeeditoramount, val);

    val = ofMap(sin(ofGetFrameNum() * 0.45), -1, 1, 6900, 4000);
    talChain.getFilter()->set(kLowPassParam_CutoffFrequency, val);

    val = ofMap(sin(ofGetFrameNum() * 0.2), -1, 1, 10, 26);
    talChain.getFilter()->set(kLowPassParam_Resonance, val);
}

void ofApp::draw(){
    manager.draw();
}
    

First sound sketch. The result of a long journey finishing my own tools.

Sketch 2015-05-29

        void ofApp::setupAnim() {
    ofEnableSmoothing();
    maskOpacity = 0;
    paused = false;
    maskOpacity = 30;
}

void ofApp::drawAnim() {
    ofEnableAlphaBlending();
    if(ofGetFrameNum() == 0) ofBackground(ofColor::black);
    ofSetColor(0, 0, 0, maskOpacity);
    ofRect(0, 0, width, height);
    
    ofSetColor(ofColor::red);
    for(int i = 0; i < 360; i+=10) {
        for(int j = 0; j < 4; j++) {
            x = ofRandom(0, width);
            y = ofMap(sin(ofGetFrameNum() * 0.06), -1, 1, -20, halfWidth);
            ofLine(x, y, x, y + 50);
        }
        rotateScreen(i);
    }
    
    ofDisableAlphaBlending();
    
    if(ofGetFrameNum() > 96) {
        maskOpacity += 40;
    }
    
    if(maskOpacity > 255) {
        renderGif();
    }
}

void ofApp::rotateScreen(float degrees) {
    ofTranslate(halfWidth, halfHeight, 0);
    ofRotate(degrees);
    ofTranslate(-halfWidth, -halfHeight, 0);
}
    

A little patience.

Daily sketch

Sketch 2015-05-28

        void ofApp::setupAnim() {
    ofEnableSmoothing();
    maskOpacity = 0;
}

void ofApp::drawAnim() {
    ofEnableAlphaBlending();
    
    ofSetColor(0, 0, 0, 30);
    ofRect(0, 0, width, height);
    
    ofSetColor(ofColor::red);
    for(int i = 0; i < 8; i++) {
        for(int j = 0; j < 10; j++) {
            x = ofRandom(0, width);
            y = ofRandom(-40, -20);
            ofLine(x, y, x, y + halfWidth + 50);
        }
        rotateScreen(45);
    }
    
    if(ofGetFrameNum() > 12) {
        ofSetColor(ofColor(ofColor::white, maskOpacity));
        ofRect(0, 0, width, height);
        maskOpacity += 20;
    }
    
    ofDisableAlphaBlending();
    
    if(maskOpacity > 255) {
        renderGif();
    }
}

void ofApp::rotateScreen(float degrees) {
    ofTranslate(halfWidth, halfHeight, 0);
    ofRotate(degrees);
    ofTranslate(-halfWidth, -halfHeight, 0);
}
    

Constraints.

Daily sketch

Sketch 2015-05-27

        void ofApp::setupAnim() {
    ofEnableSmoothing();
    numPerDimension = 3;

    for(int x = 0; x < numPerDimension; x++) {
        for(int y = 0; y < numPerDimension; y++) {
            for(int z = 0; z < numPerDimension; z++) {
                cube = ofxShapeSystem();
                cube.setupCube(2, ofRandom(100, 200), ofColor(ofColor::red, 255));
                cube.setRotation(ofRandom(360), ofRandom(360), ofRandom(360));
                cube.positionX(ofMap(x, 0, numPerDimension-1, 0, width));
                cube.positionY(ofMap(y, 0, numPerDimension-1, 0, height));
                cube.positionZ(ofMap(z, 0, numPerDimension, 250, -250));
                cubes.push_back(cube);
            }
        }
    }
}

void ofApp::updateAnim() {
    for(int i = 0; i < cubes.size(); i++) {
        cubes.at(i).incrementRotateX(2);
        cubes.at(i).incrementRotateY(2);
        cubes.at(i).incrementRotateZ(2);
    }
}

void ofApp::drawAnim() {
    ofBackground(0, 0, 0);

    ofEnableAlphaBlending();
    rotateScreen(ofGetFrameNum() * 2);
    for(int i = 0; i < cubes.size(); i++) {
        cubes.at(i).draw();
    }

    if(ofGetFrameNum() == 180) renderGif();
}

void ofApp::rotateScreen(float degrees) {
    ofTranslate(halfWidth, halfHeight, 0);
    ofRotateX(degrees);
    ofTranslate(-halfWidth, -halfHeight, 0);
}
    

Hmm. Cubes.

Daily sketch