SlideShare a Scribd company logo
openFrameworks、サウンド機能・音響合成、ofxMaxim, ofxOsc, ofxPd, ofxSuperCollider
‣


‣
    ‣
    ‣



‣

‣
    ‣
    ‣
    ‣
openFrameworks、サウンド機能・音響合成、ofxMaxim, ofxOsc, ofxPd, ofxSuperCollider
‣
‣
‣


‣


‣
‣
‣
‣


‣
    ‣
    ‣
    ‣

‣
‣
‣


‣
‣
‣
#pragma once
#include "ofMain.h"

class testApp : public ofBaseApp{

public:
   void setup();
   void update();
   void draw();

     ofSoundPlayer mySound;

     float * fft;

     int nBandsToGet;
};
‣
#pragma once
#include "ofMain.h"

class testApp : public ofBaseApp{

public:
   void setup();
   void update();
   void draw();

     ofSoundPlayer mySound;

     float * fft;

     int nBandsToGet;
};
‣
‣
#include   "testApp.h"

void testApp::setup(){!
   ofSetFrameRate(60);
   ofSetVerticalSync(true);
   ofSetCircleResolution(32);
   ofEnableBlendMode(OF_BLENDMODE_ADD);
   ofBackground(0, 0, 0);

    nBandsToGet = 1024;

    mySound.loadSound("sounds/drumLoop.aif");
    mySound.setLoop(true);
    mySound.play();
}

void testApp::update(){
   ofSoundUpdate();
   fft = ofSoundGetSpectrum(nBandsToGet);
}
‣
‣
#include   "testApp.h"

void testApp::setup(){!
   ofSetFrameRate(60);
   ofSetVerticalSync(true);
   ofSetCircleResolution(32);
   ofEnableBlendMode(OF_BLENDMODE_ADD);
   ofBackground(0, 0, 0);

    nBandsToGet = 1024;

    mySound.loadSound("sounds/drumLoop.aif");
    mySound.setLoop(true);
    mySound.play();
}

void testApp::update(){
   ofSoundUpdate();
   fft = ofSoundGetSpectrum(nBandsToGet);
}
‣
‣
#include   "testApp.h"

void testApp::setup(){!
   ofSetFrameRate(60);
   ofSetVerticalSync(true);
   ofSetCircleResolution(32);
   ofEnableBlendMode(OF_BLENDMODE_ADD);
   ofBackground(0, 0, 0);

    nBandsToGet = 1024;

    mySound.loadSound("sounds/drumLoop.aif");
    mySound.setLoop(true);
    mySound.play();
}

void testApp::update(){
   ofSoundUpdate();
   fft = ofSoundGetSpectrum(nBandsToGet);
}
‣
‣
#include   "testApp.h"

void testApp::setup(){!
   ofSetFrameRate(60);
   ofSetVerticalSync(true);
   ofSetCircleResolution(32);
   ofEnableBlendMode(OF_BLENDMODE_ADD);
   ofBackground(0, 0, 0);

    nBandsToGet = 1024;

    mySound.loadSound("sounds/drumLoop.aif");
    mySound.setLoop(true);
    mySound.play();
}

void testApp::update(){
   ofSoundUpdate();
   fft = ofSoundGetSpectrum(nBandsToGet);
}
‣
‣
#include   "testApp.h"

void testApp::setup(){!
   ofSetFrameRate(60);
   ofSetVerticalSync(true);
   ofSetCircleResolution(32);
   ofEnableBlendMode(OF_BLENDMODE_ADD);
   ofBackground(0, 0, 0);

    nBandsToGet = 1024;

    mySound.loadSound("sounds/drumLoop.aif");
    mySound.setLoop(true);
    mySound.play();
}

void testApp::update(){
   ofSoundUpdate();
   fft = ofSoundGetSpectrum(nBandsToGet);
}
‣
void testApp::draw(){
   float width = float(ofGetWidth()) / float(nBandsToGet) / 2.0f;

    for (int i = 0;i < nBandsToGet; i++){
       int b = float(255) / float(nBandsToGet) * i;
       int g = 31;
       int r = 255 - b;
       ofSetColor(r, g, b);

        ofCircle(ofGetWidth()/2 + width * i,
                 ofGetHeight()/2, fft[i] * 800);

        ofCircle(ofGetWidth()/2 - width * i,
                 ofGetHeight()/2, fft[i] * 800);
    }
}
‣
void testApp::draw(){
   float width = float(ofGetWidth()) / float(nBandsToGet) / 2.0f;

    for (int i = 0;i < nBandsToGet; i++){
       int b = float(255) / float(nBandsToGet) * i;
       int g = 31;
       int r = 255 - b;
       ofSetColor(r, g, b);

        ofCircle(ofGetWidth()/2 + width * i,
                 ofGetHeight()/2, fft[i] * 800);

        ofCircle(ofGetWidth()/2 - width * i,
                 ofGetHeight()/2, fft[i] * 800);
    }
}
‣
void testApp::draw(){
   float width = float(ofGetWidth()) / float(nBandsToGet) / 2.0f;

    for (int i = 0;i < nBandsToGet; i++){
       int b = float(255) / float(nBandsToGet) * i;
       int g = 31;
       int r = 255 - b;
       ofSetColor(r, g, b);

        ofCircle(ofGetWidth()/2 + width * i,
                 ofGetHeight()/2, fft[i] * 800);

        ofCircle(ofGetWidth()/2 - width * i,
                 ofGetHeight()/2, fft[i] * 800);
    }
}
‣
void testApp::draw(){
   float width = float(ofGetWidth()) / float(nBandsToGet) / 2.0f;

    for (int i = 0;i < nBandsToGet; i++){
       int b = float(255) / float(nBandsToGet) * i;
       int g = 31;
       int r = 255 - b;
       ofSetColor(r, g, b);

        ofCircle(ofGetWidth()/2 + width * i,
                 ofGetHeight()/2, fft[i] * 800);

        ofCircle(ofGetWidth()/2 - width * i,
                 ofGetHeight()/2, fft[i] * 800);
    }
}
‣
openFrameworks、サウンド機能・音響合成、ofxMaxim, ofxOsc, ofxPd, ofxSuperCollider
‣



‣
‣


‣
‣

‣
‣
‣
‣


‣
‣


‣
‣
‣
#ifndef _TEST_APP
#define _TEST_APP
#include "ofMain.h"

class testApp : public ofBaseApp{
public:
   void setup();
   void update();
   void draw();




    void audioIn(float * input, int bufferSize, int nChannels);
!
    vector <float> left;
    vector <float> right;
    vector <float> volHistory;
‣
#ifndef _TEST_APP
#define _TEST_APP
#include "ofMain.h"

class testApp : public ofBaseApp{
public:
   void setup();
   void update();
   void draw();




    void audioIn(float * input, int bufferSize, int nChannels);
!
    vector <float> left;
    vector <float> right;
    vector <float> volHistory;
‣
void testApp::audioIn(float * input, int bufferSize, int nChannels)
{!
! float curVol = 0.0;
! int numCounted = 0;!

!   for (int i = 0; i < bufferSize; i++){
!   !     left[i]!!   = input[i*2]*0.5;
!   !     right[i]!   = input[i*2+1]*0.5;
!   !     curVol += left[i] * left[i];
!   !     curVol += right[i] * right[i];
!   !     numCounted+=2;
!   }

!   curVol /= (float)numCounted;
!   curVol = sqrt( curVol );
!
!   smoothedVol *= 0.93;
!   smoothedVol += 0.07 * curVol;
!   bufferCounter++;!
}
‣
void testApp::audioIn(float * input, int bufferSize, int nChannels)
{!
! float curVol = 0.0;
! int numCounted = 0;!

!   for (int i = 0; i < bufferSize; i++){
!   !     left[i]!!   = input[i*2]*0.5;
!   !     right[i]!   = input[i*2+1]*0.5;
!   !     curVol += left[i] * left[i];
!   !     curVol += right[i] * right[i];
!   !     numCounted+=2;
!   }

!   curVol /= (float)numCounted;
!   curVol = sqrt( curVol );
!
!   smoothedVol *= 0.93;
!   smoothedVol += 0.07 * curVol;
!   bufferCounter++;!
}
‣
‣
#ifndef _TEST_APP
#define _TEST_APP
#include "ofMain.h"

class testApp : public ofBaseApp{
public:
   void setup();
   void update();
   void draw();



     void audioOut(float * input, int bufferSize, int nChannels);

     ofSoundStream soundStream;
     float ! pan;
     int! !   sampleRate;
     bool !   bNoise;
     float ! volume;
     vector <float> lAudio;
     vector <float> rAudio;
};

#endif
‣
#ifndef _TEST_APP
#define _TEST_APP
#include "ofMain.h"

class testApp : public ofBaseApp{
public:
   void setup();
   void update();
   void draw();



     void audioOut(float * input, int bufferSize, int nChannels);

     ofSoundStream soundStream;
     float ! pan;
     int! !   sampleRate;
     bool !   bNoise;
     float ! volume;
     vector <float> lAudio;
     vector <float> rAudio;
};

#endif
‣
void testApp::audioOut(float * output, int bufferSize, int nChannels){
   float leftScale = 1 - pan;
   float rightScale = pan;

    while (phase > TWO_PI){
       phase -= TWO_PI;
    }

    if ( bNoise == true){
       for (int i = 0; i < bufferSize; i++){
          lAudio[i] = output[i*nChannels     ]
               = ofRandom(0, 1) * volume * leftScale;
          rAudio[i] = output[i*nChannels + 1]
               = ofRandom(0, 1) * volume * rightScale;
       }
    } else {
       phaseAdder = 0.95f * phaseAdder + 0.05f * phaseAdderTarget;
       for (int i = 0; i < bufferSize; i++){
          phase += phaseAdder;
          float sample = sin(phase);
          lAudio[i] = output[i*nChannels     ] = sample * volume * leftScale;
          rAudio[i] = output[i*nChannels + 1] = sample * volume * rightScale;
       }
    }
}
‣
void testApp::audioOut(float * output, int bufferSize, int nChannels){
   float leftScale = 1 - pan;
   float rightScale = pan;

    while (phase > TWO_PI){
       phase -= TWO_PI;
    }

    if ( bNoise == true){
       for (int i = 0; i < bufferSize; i++){
          lAudio[i] = output[i*nChannels     ]
               = ofRandom(0, 1) * volume * leftScale;
          rAudio[i] = output[i*nChannels + 1]
               = ofRandom(0, 1) * volume * rightScale;
       }
    } else {
       phaseAdder = 0.95f * phaseAdder + 0.05f * phaseAdderTarget;
       for (int i = 0; i < bufferSize; i++){
          phase += phaseAdder;
          float sample = sin(phase);
          lAudio[i] = output[i*nChannels     ] = sample * volume * leftScale;
          rAudio[i] = output[i*nChannels + 1] = sample * volume * rightScale;
       }
    }
}
‣
void testApp::audioOut(float * output, int bufferSize, int nChannels){
   float leftScale = 1 - pan;
   float rightScale = pan;

    while (phase > TWO_PI){
       phase -= TWO_PI;
    }

    if ( bNoise == true){
       for (int i = 0; i < bufferSize; i++){
          lAudio[i] = output[i*nChannels     ]
               = ofRandom(0, 1) * volume * leftScale;
          rAudio[i] = output[i*nChannels + 1]
               = ofRandom(0, 1) * volume * rightScale;
       }
    } else {
       phaseAdder = 0.95f * phaseAdder + 0.05f * phaseAdderTarget;
       for (int i = 0; i < bufferSize; i++){
          phase += phaseAdder;
          float sample = sin(phase);
          lAudio[i] = output[i*nChannels     ] = sample * volume * leftScale;
          rAudio[i] = output[i*nChannels + 1] = sample * volume * rightScale;
       }
    }
}
‣
void testApp::audioOut(float * output, int bufferSize, int nChannels){
   float leftScale = 1 - pan;
   float rightScale = pan;

    while (phase > TWO_PI){
       phase -= TWO_PI;
    }

    if ( bNoise == true){
       for (int i = 0; i < bufferSize; i++){
          lAudio[i] = output[i*nChannels     ]
               = ofRandom(0, 1) * volume * leftScale;
          rAudio[i] = output[i*nChannels + 1]
               = ofRandom(0, 1) * volume * rightScale;
       }
    } else {
       phaseAdder = 0.95f * phaseAdder + 0.05f * phaseAdderTarget;
       for (int i = 0; i < bufferSize; i++){
          phase += phaseAdder;
          float sample = sin(phase);
          lAudio[i] = output[i*nChannels     ] = sample * volume * leftScale;
          rAudio[i] = output[i*nChannels + 1] = sample * volume * rightScale;
       }
    }
}
‣
void testApp::audioOut(float * output, int bufferSize, int nChannels){
   float leftScale = 1 - pan;
   float rightScale = pan;

    while (phase > TWO_PI){
       phase -= TWO_PI;
    }

    if ( bNoise == true){
       for (int i = 0; i < bufferSize; i++){
          lAudio[i] = output[i*nChannels     ]
               = ofRandom(0, 1) * volume * leftScale;
          rAudio[i] = output[i*nChannels + 1]
               = ofRandom(0, 1) * volume * rightScale;
       }
    } else {
       phaseAdder = 0.95f * phaseAdder + 0.05f * phaseAdderTarget;
       for (int i = 0; i < bufferSize; i++){
          phase += phaseAdder;
          float sample = sin(phase);
          lAudio[i] = output[i*nChannels     ] = sample * volume * leftScale;
          rAudio[i] = output[i*nChannels + 1] = sample * volume * rightScale;
       }
    }
}
‣
‣


‣
‣


‣


‣
openFrameworks、サウンド機能・音響合成、ofxMaxim, ofxOsc, ofxPd, ofxSuperCollider
‣


‣   http://maximilian.strangeloop.co.uk/
‣


‣
‣
‣
‣
‣
‣
‣
‣
‣
‣
#pragma once
#include "ofMain.h"
#include "ofxMaxim.h"

class testApp : public ofBaseApp{
public:
   void setup();
   void update();
   void draw();
   void keyPressed(int key);
   void audioOut(float * input, int bufferSize, int nChannels);
   void audioIn(float * input, int bufferSize, int nChannels);

     int initialBufferSize;
     int sampleRate;
     int mode;
     double wave,sample,outputs[2];

     ofxMaxiMix mymix;
     ofxMaxiOsc osc;
     vector <float> lAudio;
     vector <float> rAudio;
};
‣
void testApp::audioOut(float * output, int bufferSize, int nChannels){
   for (int i = 0; i < bufferSize; i++){
      float freq = mouseY;
      float pan = (float)mouseX / (float)ofGetWidth();

     switch (mode) {
        case 0:
           wave = osc.sinewave(freq);
           break;
        case 1:
           wave = osc.saw(freq);
           break;
        case 2:
           wave = osc.pulse(freq, 0.99);
           break;
        case 3:
           wave = osc.phasor(freq);
           break;
        case 4:
           wave = osc.triangle(freq);
           break;
        case 5:
           wave = osc.noise();
           break;
        default:
           wave = osc.sinewave(freq);
           break;
     }
‣

         mymix.stereo(wave, outputs, pan);
         lAudio[i] = output[i*nChannels    ] = outputs[0];
         rAudio[i] = output[i*nChannels + 1] = outputs[1];
    }!
}
‣
‣
‣
‣
#pragma once
#include "ofMain.h"
#include "ofxMaxim.h"


class testApp : public ofBaseApp{
public:
   ~testApp();
   void setup();
   void update();
   void draw();
   void audioOut(float * input, int bufferSize, int nChannels);
   void audioIn(float * input, int bufferSize, int nChannels);
!
   int initialBufferSize;
   int sampleRate;
   double outputs[2];
   double wave;

     ofxMaxiMix mymix;
     ofxMaxiOsc car;
     ofxMaxiOsc mod;

     vector <float> lAudio;
     vector <float> rAudio;
};
‣
#pragma once
#include "ofMain.h"
#include "ofxMaxim.h"


class testApp : public ofBaseApp{
public:
   ~testApp();
   void setup();
   void update();
   void draw();
   void audioOut(float * input, int bufferSize, int nChannels);
   void audioIn(float * input, int bufferSize, int nChannels);
!
   int initialBufferSize;
   int sampleRate;
   double outputs[2];
   double wave;

     ofxMaxiMix mymix;
     ofxMaxiOsc car;
     ofxMaxiOsc mod;

     vector <float> lAudio;
     vector <float> rAudio;
};
‣
#pragma once
#include "ofMain.h"
#include "ofxMaxim.h"


class testApp : public ofBaseApp{
public:
   ~testApp();
   void setup();
   void update();
   void draw();
   void audioOut(float * input, int bufferSize, int nChannels);
   void audioIn(float * input, int bufferSize, int nChannels);
!
   int initialBufferSize;
   int sampleRate;
   double outputs[2];
   double wave;

     ofxMaxiMix mymix;
     ofxMaxiOsc car;
     ofxMaxiOsc mod;

     vector <float> lAudio;
     vector <float> rAudio;
};
‣
void testApp::audioOut(float * output, int bufferSize, int nChannels){
   for (int i = 0; i < bufferSize; i++){

      float index, modFreq;
      ofMap(modFreq, 0, mouseX, 20, 8000);
      ofMap(index, 0, mouseY, 1, 2000);

      wave = car.sinewave(mouseY*mod.sinewave(mouseX/10)+440);
      mymix.stereo(wave, outputs, 0.5);

      lAudio[i] = output[i*nChannels    ] = outputs[0];
      rAudio[i] = output[i*nChannels + 1] = outputs[1];
! }
}
‣
void testApp::audioOut(float * output, int bufferSize, int nChannels){
   for (int i = 0; i < bufferSize; i++){

      float index, modFreq;
      ofMap(modFreq, 0, mouseX, 20, 8000);
      ofMap(index, 0, mouseY, 1, 2000);

      wave = car.sinewave(mouseY*mod.sinewave(mouseX/10)+440);
      mymix.stereo(wave, outputs, 0.5);

      lAudio[i] = output[i*nChannels    ] = outputs[0];
      rAudio[i] = output[i*nChannels + 1] = outputs[1];
! }
}
‣
void testApp::audioOut(float * output, int bufferSize, int nChannels){
   for (int i = 0; i < bufferSize; i++){

      float index, modFreq;
      ofMap(modFreq, 0, mouseX, 20, 8000);
      ofMap(index, 0, mouseY, 1, 2000);

      wave = car.sinewave(mouseY*mod.sinewave(mouseX/10)+440);
      mymix.stereo(wave, outputs, 0.5);

      lAudio[i] = output[i*nChannels    ] = outputs[0];
      rAudio[i] = output[i*nChannels + 1] = outputs[1];
! }
}
‣
void testApp::audioOut(float * output, int bufferSize, int nChannels){
   for (int i = 0; i < bufferSize; i++){

      float index, modFreq;
      ofMap(modFreq, 0, mouseX, 20, 8000);
      ofMap(index, 0, mouseY, 1, 2000);

      wave = car.sinewave(mouseY*mod.sinewave(mouseX/10)+440);
      mymix.stereo(wave, outputs, 0.5);

      lAudio[i] = output[i*nChannels    ] = outputs[0];
      rAudio[i] = output[i*nChannels + 1] = outputs[1];
! }
}
‣
void testApp::audioOut(float * output, int bufferSize, int nChannels){
   for (int i = 0; i < bufferSize; i++){

      float index, modFreq;
      ofMap(modFreq, 0, mouseX, 20, 8000);
      ofMap(index, 0, mouseY, 1, 2000);

      wave = car.sinewave(mouseY*mod.sinewave(mouseX/10)+440);
      mymix.stereo(wave, outputs, 0.5);

      lAudio[i] = output[i*nChannels    ] = outputs[0];
      rAudio[i] = output[i*nChannels + 1] = outputs[1];
! }
}
‣
openFrameworks、サウンド機能・音響合成、ofxMaxim, ofxOsc, ofxPd, ofxSuperCollider
‣


    ‣
‣


    ‣
‣


    ‣
    ‣


    ‣
    ‣
‣


    ‣
        ‣
        ‣
        ‣
        ‣
        ‣
        ‣


    ‣
        ‣
        ‣
        ‣
        ‣
        ‣
‣


    ‣
        ‣
        ‣
‣


    ‣
‣
‣
openFrameworks、サウンド機能・音響合成、ofxMaxim, ofxOsc, ofxPd, ofxSuperCollider
‣
‣
‣
‣
‣
‣
‣
‣
‣
‣



‣
‣



‣
‣


‣
‣
openFrameworks、サウンド機能・音響合成、ofxMaxim, ofxOsc, ofxPd, ofxSuperCollider
‣
‣
‣




‣
openFrameworks、サウンド機能・音響合成、ofxMaxim, ofxOsc, ofxPd, ofxSuperCollider
‣


‣


‣
‣
‣
‣
‣
SynthDef("reverb", {
	    arg wet=1.0;
	    var in, fx;
	    in = In.ar(0, 2);
	    fx = in;
	    fx = GVerb.ar(fx, 80);
	    ReplaceOut.ar(0, fx);
}).store;

SynthDef("baseSound", {
	    arg note=40, amp=0.1, fadein=12.0;
	    var env, out;
	    env = EnvGen.kr(Env.new([0, amp], [fadein]));
	    out = RLPF.ar(LFPulse.ar([note, note+7].midicps, 0.15),
                   SinOsc.kr(0.1, 0, 10, 72).midicps, 0.1, 0.1);
	    Out.ar(0, out*env);
}).store;

SynthDef("newRing", {
	    arg note=40, amp=0.5, pan = 0.0, decay=4.0;
	    var env1, out1, env2, out2, mix;
	    out1 = RLPF.ar(LFPulse.ar([note, note+7].midicps, 0.15),
                     SinOsc.kr(0.1, 0, 10, 72).midicps, 0.1, 0.1);
	    out2 = SinOsc.ar([(note+48).midicps, (note+55).midicps]);
	    env1 = EnvGen.kr(Env.perc(decay/4.0, decay/4.0*3.0, amp, -4), doneAction: 2);
	    env2 = EnvGen.kr(Env.adsr(0.001, 0.4, 0.0, decay, amp*0.1, -4));
	    mix = (out1 * env1) + (out2 * env2);
	    mix = CombN.ar(mix, 0.31, 0.31, 2, 0.5, mix);
	    Out.ar(0, mix);
}).store;
‣


‣
‣
‣
‣


‣http://goo.gl/9rH4K
‣
‣
‣
‣

More Related Content

PDF
openFrameworks – パーティクルを動かす、静的配列と動的配列 - 多摩美メディアアートII
PDF
openFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートII
PDF
Sbaw091020
PDF
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
PDF
OpenGL Starter L02
PDF
Datastructures asignment
PDF
Anomalies in X-Ray Engine
openFrameworks – パーティクルを動かす、静的配列と動的配列 - 多摩美メディアアートII
openFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートII
Sbaw091020
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
OpenGL Starter L02
Datastructures asignment
Anomalies in X-Ray Engine

What's hot (19)

PDF
Os lab 1st mid
DOCX
Travel management
TXT
Programs for Operating System
 
DOCX
Os lab file c programs
DOCX
Wap to implement bitwise operators
DOCX
Lab manual operating system [cs 502 rgpv] (usefulsearch.org) (useful search)
DOC
Tarea De Scilab By Sebastian Vasquez
PDF
Data Structure - 2nd Study
DOCX
Circular queue
PDF
Gpus graal
PDF
KEY
Blocks+gcd入門
PDF
Rcpp11 genentech
DOCX
ADA FILE
PDF
Rxjs kyivjs 2015
PDF
Stabilizer: Statistically Sound Performance Evaluation
DOC
Daa practicals
PPT
Tilting Google Maps and MissileLauncher
PDF
Cn os-lp lab manual k.roshan
Os lab 1st mid
Travel management
Programs for Operating System
 
Os lab file c programs
Wap to implement bitwise operators
Lab manual operating system [cs 502 rgpv] (usefulsearch.org) (useful search)
Tarea De Scilab By Sebastian Vasquez
Data Structure - 2nd Study
Circular queue
Gpus graal
Blocks+gcd入門
Rcpp11 genentech
ADA FILE
Rxjs kyivjs 2015
Stabilizer: Statistically Sound Performance Evaluation
Daa practicals
Tilting Google Maps and MissileLauncher
Cn os-lp lab manual k.roshan
Ad

Similar to openFrameworks、サウンド機能・音響合成、ofxMaxim, ofxOsc, ofxPd, ofxSuperCollider (20)

KEY
Sbaw090623
PPT
Paradigmas de Linguagens de Programacao - Aula #4
KEY
Sbaw090519
PPT
Unit2 C
PPT
Unit2 C
PDF
Apache PIG - User Defined Functions
PDF
Of class3
PPT
12 lec 12 loop
PDF
Go: It's Not Just For Google
DOCX
Bti1022 lab sheet 8
DOCX
Bti1022 lab sheet 8
DOCX
PDF
Part 1 1)#include stdio.hint testWhileLoop() ; int testFo.pdf
PDF
Ssaw08 0624
PPTX
How to add an optimization for C# to RyuJIT
PPTX
Programming ppt files (final)
DOC
Daapracticals 111105084852-phpapp02
DOCX
Stack prgs
DOCX
StewartPlatform_cpp
PDF
20191116 custom operators in swift
Sbaw090623
Paradigmas de Linguagens de Programacao - Aula #4
Sbaw090519
Unit2 C
Unit2 C
Apache PIG - User Defined Functions
Of class3
12 lec 12 loop
Go: It's Not Just For Google
Bti1022 lab sheet 8
Bti1022 lab sheet 8
Part 1 1)#include stdio.hint testWhileLoop() ; int testFo.pdf
Ssaw08 0624
How to add an optimization for C# to RyuJIT
Programming ppt files (final)
Daapracticals 111105084852-phpapp02
Stack prgs
StewartPlatform_cpp
20191116 custom operators in swift
Ad

More from Atsushi Tadokoro (20)

PDF
「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
PDF
プログラム初級講座 - メディア芸術をはじめよう
PDF
Interactive Music II ProcessingとSuperColliderの連携 -2
PDF
coma Creators session vol.2
PDF
Interactive Music II ProcessingとSuperColliderの連携1
PDF
Interactive Music II Processingによるアニメーション
PDF
Interactive Music II Processing基本
PDF
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
PDF
Media Art II openFrameworks アプリ間の通信とタンジブルなインターフェイス
PDF
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
PDF
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
PDF
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
PDF
芸術情報演習デザイン(Web) 第8回: CSSフレームワークを使う
PDF
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
PDF
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
PDF
Tamabi media131118
PDF
Webデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
PDF
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
PDF
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
PDF
Media Art II openFrameworks 複数のシーンの管理・切替え
「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
プログラム初級講座 - メディア芸術をはじめよう
Interactive Music II ProcessingとSuperColliderの連携 -2
coma Creators session vol.2
Interactive Music II ProcessingとSuperColliderの連携1
Interactive Music II Processingによるアニメーション
Interactive Music II Processing基本
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
Media Art II openFrameworks アプリ間の通信とタンジブルなインターフェイス
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
芸術情報演習デザイン(Web) 第8回: CSSフレームワークを使う
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
Tamabi media131118
Webデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
Media Art II openFrameworks 複数のシーンの管理・切替え

Recently uploaded (20)

PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Encapsulation theory and applications.pdf
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Empathic Computing: Creating Shared Understanding
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Machine learning based COVID-19 study performance prediction
PPTX
TLE Review Electricity (Electricity).pptx
PPT
Teaching material agriculture food technology
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
A comparative study of natural language inference in Swahili using monolingua...
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Encapsulation theory and applications.pdf
Univ-Connecticut-ChatGPT-Presentaion.pdf
A Presentation on Artificial Intelligence
Reach Out and Touch Someone: Haptics and Empathic Computing
Network Security Unit 5.pdf for BCA BBA.
Advanced methodologies resolving dimensionality complications for autism neur...
Unlocking AI with Model Context Protocol (MCP)
A comparative analysis of optical character recognition models for extracting...
NewMind AI Weekly Chronicles - August'25-Week II
gpt5_lecture_notes_comprehensive_20250812015547.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Empathic Computing: Creating Shared Understanding
Assigned Numbers - 2025 - Bluetooth® Document
Machine learning based COVID-19 study performance prediction
TLE Review Electricity (Electricity).pptx
Teaching material agriculture food technology
Mobile App Security Testing_ A Comprehensive Guide.pdf
Spectral efficient network and resource selection model in 5G networks
A comparative study of natural language inference in Swahili using monolingua...

openFrameworks、サウンド機能・音響合成、ofxMaxim, ofxOsc, ofxPd, ofxSuperCollider

  • 2. ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣
  • 5. ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣
  • 7. ‣ #pragma once #include "ofMain.h" class testApp : public ofBaseApp{ public: void setup(); void update(); void draw(); ofSoundPlayer mySound; float * fft; int nBandsToGet; };
  • 8. ‣ #pragma once #include "ofMain.h" class testApp : public ofBaseApp{ public: void setup(); void update(); void draw(); ofSoundPlayer mySound; float * fft; int nBandsToGet; };
  • 9. ‣ ‣ #include "testApp.h" void testApp::setup(){! ofSetFrameRate(60); ofSetVerticalSync(true); ofSetCircleResolution(32); ofEnableBlendMode(OF_BLENDMODE_ADD); ofBackground(0, 0, 0); nBandsToGet = 1024; mySound.loadSound("sounds/drumLoop.aif"); mySound.setLoop(true); mySound.play(); } void testApp::update(){ ofSoundUpdate(); fft = ofSoundGetSpectrum(nBandsToGet); }
  • 10. ‣ ‣ #include "testApp.h" void testApp::setup(){! ofSetFrameRate(60); ofSetVerticalSync(true); ofSetCircleResolution(32); ofEnableBlendMode(OF_BLENDMODE_ADD); ofBackground(0, 0, 0); nBandsToGet = 1024; mySound.loadSound("sounds/drumLoop.aif"); mySound.setLoop(true); mySound.play(); } void testApp::update(){ ofSoundUpdate(); fft = ofSoundGetSpectrum(nBandsToGet); }
  • 11. ‣ ‣ #include "testApp.h" void testApp::setup(){! ofSetFrameRate(60); ofSetVerticalSync(true); ofSetCircleResolution(32); ofEnableBlendMode(OF_BLENDMODE_ADD); ofBackground(0, 0, 0); nBandsToGet = 1024; mySound.loadSound("sounds/drumLoop.aif"); mySound.setLoop(true); mySound.play(); } void testApp::update(){ ofSoundUpdate(); fft = ofSoundGetSpectrum(nBandsToGet); }
  • 12. ‣ ‣ #include "testApp.h" void testApp::setup(){! ofSetFrameRate(60); ofSetVerticalSync(true); ofSetCircleResolution(32); ofEnableBlendMode(OF_BLENDMODE_ADD); ofBackground(0, 0, 0); nBandsToGet = 1024; mySound.loadSound("sounds/drumLoop.aif"); mySound.setLoop(true); mySound.play(); } void testApp::update(){ ofSoundUpdate(); fft = ofSoundGetSpectrum(nBandsToGet); }
  • 13. ‣ ‣ #include "testApp.h" void testApp::setup(){! ofSetFrameRate(60); ofSetVerticalSync(true); ofSetCircleResolution(32); ofEnableBlendMode(OF_BLENDMODE_ADD); ofBackground(0, 0, 0); nBandsToGet = 1024; mySound.loadSound("sounds/drumLoop.aif"); mySound.setLoop(true); mySound.play(); } void testApp::update(){ ofSoundUpdate(); fft = ofSoundGetSpectrum(nBandsToGet); }
  • 14. ‣ void testApp::draw(){ float width = float(ofGetWidth()) / float(nBandsToGet) / 2.0f; for (int i = 0;i < nBandsToGet; i++){ int b = float(255) / float(nBandsToGet) * i; int g = 31; int r = 255 - b; ofSetColor(r, g, b); ofCircle(ofGetWidth()/2 + width * i, ofGetHeight()/2, fft[i] * 800); ofCircle(ofGetWidth()/2 - width * i, ofGetHeight()/2, fft[i] * 800); } }
  • 15. ‣ void testApp::draw(){ float width = float(ofGetWidth()) / float(nBandsToGet) / 2.0f; for (int i = 0;i < nBandsToGet; i++){ int b = float(255) / float(nBandsToGet) * i; int g = 31; int r = 255 - b; ofSetColor(r, g, b); ofCircle(ofGetWidth()/2 + width * i, ofGetHeight()/2, fft[i] * 800); ofCircle(ofGetWidth()/2 - width * i, ofGetHeight()/2, fft[i] * 800); } }
  • 16. ‣ void testApp::draw(){ float width = float(ofGetWidth()) / float(nBandsToGet) / 2.0f; for (int i = 0;i < nBandsToGet; i++){ int b = float(255) / float(nBandsToGet) * i; int g = 31; int r = 255 - b; ofSetColor(r, g, b); ofCircle(ofGetWidth()/2 + width * i, ofGetHeight()/2, fft[i] * 800); ofCircle(ofGetWidth()/2 - width * i, ofGetHeight()/2, fft[i] * 800); } }
  • 17. ‣ void testApp::draw(){ float width = float(ofGetWidth()) / float(nBandsToGet) / 2.0f; for (int i = 0;i < nBandsToGet; i++){ int b = float(255) / float(nBandsToGet) * i; int g = 31; int r = 255 - b; ofSetColor(r, g, b); ofCircle(ofGetWidth()/2 + width * i, ofGetHeight()/2, fft[i] * 800); ofCircle(ofGetWidth()/2 - width * i, ofGetHeight()/2, fft[i] * 800); } }
  • 18.
  • 22. ‣ #ifndef _TEST_APP #define _TEST_APP #include "ofMain.h" class testApp : public ofBaseApp{ public: void setup(); void update(); void draw(); void audioIn(float * input, int bufferSize, int nChannels); ! vector <float> left; vector <float> right; vector <float> volHistory;
  • 23. ‣ #ifndef _TEST_APP #define _TEST_APP #include "ofMain.h" class testApp : public ofBaseApp{ public: void setup(); void update(); void draw(); void audioIn(float * input, int bufferSize, int nChannels); ! vector <float> left; vector <float> right; vector <float> volHistory;
  • 24. ‣ void testApp::audioIn(float * input, int bufferSize, int nChannels) {! ! float curVol = 0.0; ! int numCounted = 0;! ! for (int i = 0; i < bufferSize; i++){ ! ! left[i]!! = input[i*2]*0.5; ! ! right[i]! = input[i*2+1]*0.5; ! ! curVol += left[i] * left[i]; ! ! curVol += right[i] * right[i]; ! ! numCounted+=2; ! } ! curVol /= (float)numCounted; ! curVol = sqrt( curVol ); ! ! smoothedVol *= 0.93; ! smoothedVol += 0.07 * curVol; ! bufferCounter++;! }
  • 25. ‣ void testApp::audioIn(float * input, int bufferSize, int nChannels) {! ! float curVol = 0.0; ! int numCounted = 0;! ! for (int i = 0; i < bufferSize; i++){ ! ! left[i]!! = input[i*2]*0.5; ! ! right[i]! = input[i*2+1]*0.5; ! ! curVol += left[i] * left[i]; ! ! curVol += right[i] * right[i]; ! ! numCounted+=2; ! } ! curVol /= (float)numCounted; ! curVol = sqrt( curVol ); ! ! smoothedVol *= 0.93; ! smoothedVol += 0.07 * curVol; ! bufferCounter++;! }
  • 26.
  • 27. ‣ #ifndef _TEST_APP #define _TEST_APP #include "ofMain.h" class testApp : public ofBaseApp{ public: void setup(); void update(); void draw(); void audioOut(float * input, int bufferSize, int nChannels); ofSoundStream soundStream; float ! pan; int! ! sampleRate; bool ! bNoise; float ! volume; vector <float> lAudio; vector <float> rAudio; }; #endif
  • 28. ‣ #ifndef _TEST_APP #define _TEST_APP #include "ofMain.h" class testApp : public ofBaseApp{ public: void setup(); void update(); void draw(); void audioOut(float * input, int bufferSize, int nChannels); ofSoundStream soundStream; float ! pan; int! ! sampleRate; bool ! bNoise; float ! volume; vector <float> lAudio; vector <float> rAudio; }; #endif
  • 29. ‣ void testApp::audioOut(float * output, int bufferSize, int nChannels){ float leftScale = 1 - pan; float rightScale = pan; while (phase > TWO_PI){ phase -= TWO_PI; } if ( bNoise == true){ for (int i = 0; i < bufferSize; i++){ lAudio[i] = output[i*nChannels ] = ofRandom(0, 1) * volume * leftScale; rAudio[i] = output[i*nChannels + 1] = ofRandom(0, 1) * volume * rightScale; } } else { phaseAdder = 0.95f * phaseAdder + 0.05f * phaseAdderTarget; for (int i = 0; i < bufferSize; i++){ phase += phaseAdder; float sample = sin(phase); lAudio[i] = output[i*nChannels ] = sample * volume * leftScale; rAudio[i] = output[i*nChannels + 1] = sample * volume * rightScale; } } }
  • 30. ‣ void testApp::audioOut(float * output, int bufferSize, int nChannels){ float leftScale = 1 - pan; float rightScale = pan; while (phase > TWO_PI){ phase -= TWO_PI; } if ( bNoise == true){ for (int i = 0; i < bufferSize; i++){ lAudio[i] = output[i*nChannels ] = ofRandom(0, 1) * volume * leftScale; rAudio[i] = output[i*nChannels + 1] = ofRandom(0, 1) * volume * rightScale; } } else { phaseAdder = 0.95f * phaseAdder + 0.05f * phaseAdderTarget; for (int i = 0; i < bufferSize; i++){ phase += phaseAdder; float sample = sin(phase); lAudio[i] = output[i*nChannels ] = sample * volume * leftScale; rAudio[i] = output[i*nChannels + 1] = sample * volume * rightScale; } } }
  • 31. ‣ void testApp::audioOut(float * output, int bufferSize, int nChannels){ float leftScale = 1 - pan; float rightScale = pan; while (phase > TWO_PI){ phase -= TWO_PI; } if ( bNoise == true){ for (int i = 0; i < bufferSize; i++){ lAudio[i] = output[i*nChannels ] = ofRandom(0, 1) * volume * leftScale; rAudio[i] = output[i*nChannels + 1] = ofRandom(0, 1) * volume * rightScale; } } else { phaseAdder = 0.95f * phaseAdder + 0.05f * phaseAdderTarget; for (int i = 0; i < bufferSize; i++){ phase += phaseAdder; float sample = sin(phase); lAudio[i] = output[i*nChannels ] = sample * volume * leftScale; rAudio[i] = output[i*nChannels + 1] = sample * volume * rightScale; } } }
  • 32. ‣ void testApp::audioOut(float * output, int bufferSize, int nChannels){ float leftScale = 1 - pan; float rightScale = pan; while (phase > TWO_PI){ phase -= TWO_PI; } if ( bNoise == true){ for (int i = 0; i < bufferSize; i++){ lAudio[i] = output[i*nChannels ] = ofRandom(0, 1) * volume * leftScale; rAudio[i] = output[i*nChannels + 1] = ofRandom(0, 1) * volume * rightScale; } } else { phaseAdder = 0.95f * phaseAdder + 0.05f * phaseAdderTarget; for (int i = 0; i < bufferSize; i++){ phase += phaseAdder; float sample = sin(phase); lAudio[i] = output[i*nChannels ] = sample * volume * leftScale; rAudio[i] = output[i*nChannels + 1] = sample * volume * rightScale; } } }
  • 33. ‣ void testApp::audioOut(float * output, int bufferSize, int nChannels){ float leftScale = 1 - pan; float rightScale = pan; while (phase > TWO_PI){ phase -= TWO_PI; } if ( bNoise == true){ for (int i = 0; i < bufferSize; i++){ lAudio[i] = output[i*nChannels ] = ofRandom(0, 1) * volume * leftScale; rAudio[i] = output[i*nChannels + 1] = ofRandom(0, 1) * volume * rightScale; } } else { phaseAdder = 0.95f * phaseAdder + 0.05f * phaseAdderTarget; for (int i = 0; i < bufferSize; i++){ phase += phaseAdder; float sample = sin(phase); lAudio[i] = output[i*nChannels ] = sample * volume * leftScale; rAudio[i] = output[i*nChannels + 1] = sample * volume * rightScale; } } }
  • 34.
  • 37. ‣ ‣ http://maximilian.strangeloop.co.uk/
  • 41. ‣ #pragma once #include "ofMain.h" #include "ofxMaxim.h" class testApp : public ofBaseApp{ public: void setup(); void update(); void draw(); void keyPressed(int key); void audioOut(float * input, int bufferSize, int nChannels); void audioIn(float * input, int bufferSize, int nChannels); int initialBufferSize; int sampleRate; int mode; double wave,sample,outputs[2]; ofxMaxiMix mymix; ofxMaxiOsc osc; vector <float> lAudio; vector <float> rAudio; };
  • 42. ‣ void testApp::audioOut(float * output, int bufferSize, int nChannels){ for (int i = 0; i < bufferSize; i++){ float freq = mouseY; float pan = (float)mouseX / (float)ofGetWidth(); switch (mode) { case 0: wave = osc.sinewave(freq); break; case 1: wave = osc.saw(freq); break; case 2: wave = osc.pulse(freq, 0.99); break; case 3: wave = osc.phasor(freq); break; case 4: wave = osc.triangle(freq); break; case 5: wave = osc.noise(); break; default: wave = osc.sinewave(freq); break; }
  • 43. mymix.stereo(wave, outputs, pan); lAudio[i] = output[i*nChannels ] = outputs[0]; rAudio[i] = output[i*nChannels + 1] = outputs[1]; }! }
  • 44.
  • 46. ‣ #pragma once #include "ofMain.h" #include "ofxMaxim.h" class testApp : public ofBaseApp{ public: ~testApp(); void setup(); void update(); void draw(); void audioOut(float * input, int bufferSize, int nChannels); void audioIn(float * input, int bufferSize, int nChannels); ! int initialBufferSize; int sampleRate; double outputs[2]; double wave; ofxMaxiMix mymix; ofxMaxiOsc car; ofxMaxiOsc mod; vector <float> lAudio; vector <float> rAudio; };
  • 47. ‣ #pragma once #include "ofMain.h" #include "ofxMaxim.h" class testApp : public ofBaseApp{ public: ~testApp(); void setup(); void update(); void draw(); void audioOut(float * input, int bufferSize, int nChannels); void audioIn(float * input, int bufferSize, int nChannels); ! int initialBufferSize; int sampleRate; double outputs[2]; double wave; ofxMaxiMix mymix; ofxMaxiOsc car; ofxMaxiOsc mod; vector <float> lAudio; vector <float> rAudio; };
  • 48. ‣ #pragma once #include "ofMain.h" #include "ofxMaxim.h" class testApp : public ofBaseApp{ public: ~testApp(); void setup(); void update(); void draw(); void audioOut(float * input, int bufferSize, int nChannels); void audioIn(float * input, int bufferSize, int nChannels); ! int initialBufferSize; int sampleRate; double outputs[2]; double wave; ofxMaxiMix mymix; ofxMaxiOsc car; ofxMaxiOsc mod; vector <float> lAudio; vector <float> rAudio; };
  • 49. ‣ void testApp::audioOut(float * output, int bufferSize, int nChannels){ for (int i = 0; i < bufferSize; i++){ float index, modFreq; ofMap(modFreq, 0, mouseX, 20, 8000); ofMap(index, 0, mouseY, 1, 2000); wave = car.sinewave(mouseY*mod.sinewave(mouseX/10)+440); mymix.stereo(wave, outputs, 0.5); lAudio[i] = output[i*nChannels ] = outputs[0]; rAudio[i] = output[i*nChannels + 1] = outputs[1]; ! } }
  • 50. ‣ void testApp::audioOut(float * output, int bufferSize, int nChannels){ for (int i = 0; i < bufferSize; i++){ float index, modFreq; ofMap(modFreq, 0, mouseX, 20, 8000); ofMap(index, 0, mouseY, 1, 2000); wave = car.sinewave(mouseY*mod.sinewave(mouseX/10)+440); mymix.stereo(wave, outputs, 0.5); lAudio[i] = output[i*nChannels ] = outputs[0]; rAudio[i] = output[i*nChannels + 1] = outputs[1]; ! } }
  • 51. ‣ void testApp::audioOut(float * output, int bufferSize, int nChannels){ for (int i = 0; i < bufferSize; i++){ float index, modFreq; ofMap(modFreq, 0, mouseX, 20, 8000); ofMap(index, 0, mouseY, 1, 2000); wave = car.sinewave(mouseY*mod.sinewave(mouseX/10)+440); mymix.stereo(wave, outputs, 0.5); lAudio[i] = output[i*nChannels ] = outputs[0]; rAudio[i] = output[i*nChannels + 1] = outputs[1]; ! } }
  • 52. ‣ void testApp::audioOut(float * output, int bufferSize, int nChannels){ for (int i = 0; i < bufferSize; i++){ float index, modFreq; ofMap(modFreq, 0, mouseX, 20, 8000); ofMap(index, 0, mouseY, 1, 2000); wave = car.sinewave(mouseY*mod.sinewave(mouseX/10)+440); mymix.stereo(wave, outputs, 0.5); lAudio[i] = output[i*nChannels ] = outputs[0]; rAudio[i] = output[i*nChannels + 1] = outputs[1]; ! } }
  • 53. ‣ void testApp::audioOut(float * output, int bufferSize, int nChannels){ for (int i = 0; i < bufferSize; i++){ float index, modFreq; ofMap(modFreq, 0, mouseX, 20, 8000); ofMap(index, 0, mouseY, 1, 2000); wave = car.sinewave(mouseY*mod.sinewave(mouseX/10)+440); mymix.stereo(wave, outputs, 0.5); lAudio[i] = output[i*nChannels ] = outputs[0]; rAudio[i] = output[i*nChannels + 1] = outputs[1]; ! } }
  • 54.
  • 56.
  • 57.
  • 58. ‣ ‣ ‣ ‣
  • 59. ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣ ‣
  • 60. ‣ ‣ ‣
  • 61.
  • 62.
  • 63.
  • 65.
  • 66.
  • 67.
  • 69.
  • 77. ‣ SynthDef("reverb", { arg wet=1.0; var in, fx; in = In.ar(0, 2); fx = in; fx = GVerb.ar(fx, 80); ReplaceOut.ar(0, fx); }).store; SynthDef("baseSound", { arg note=40, amp=0.1, fadein=12.0; var env, out; env = EnvGen.kr(Env.new([0, amp], [fadein])); out = RLPF.ar(LFPulse.ar([note, note+7].midicps, 0.15), SinOsc.kr(0.1, 0, 10, 72).midicps, 0.1, 0.1); Out.ar(0, out*env); }).store; SynthDef("newRing", { arg note=40, amp=0.5, pan = 0.0, decay=4.0; var env1, out1, env2, out2, mix; out1 = RLPF.ar(LFPulse.ar([note, note+7].midicps, 0.15), SinOsc.kr(0.1, 0, 10, 72).midicps, 0.1, 0.1); out2 = SinOsc.ar([(note+48).midicps, (note+55).midicps]); env1 = EnvGen.kr(Env.perc(decay/4.0, decay/4.0*3.0, amp, -4), doneAction: 2); env2 = EnvGen.kr(Env.adsr(0.001, 0.4, 0.0, decay, amp*0.1, -4)); mix = (out1 * env1) + (out2 * env2); mix = CombN.ar(mix, 0.31, 0.31, 2, 0.5, mix); Out.ar(0, mix); }).store;
  • 79.
  • 81.