CCSS2014のメモ

CCSS2014 in 札幌

に参加してきたメモ

8/30(金) 第3回 Max/MSPでVJパフォーマンス

聴覚はより感覚的印象を喚起させ
視覚はそれを補完する機能である

拍子

ビートの解析
リズムの微分

ビート(音楽)=スピード(映像)=フレーム(映像)

映像の単位 FPS

VJ的音楽解析の方法1
BPM
1分間における拍数

60bpmでは1拍は1秒
120では0.51拍は0.5秒
60bpmでは1秒間30フレーム
120bpmでは0.5秒 15フレーム

音と映像がシンクロするとは

単に音と映像が同期することではない
(心の片隅に 単に同期してれば面白いわけではない)

音と映像の同期方法
1シグナルデータ(マイクから)からアタックを検出する方法
2MIDI, OSCデータのやり取りによってトリガーを作動させる

MIDIコントローラ USBコントローラ
IQベックス 筋電センサー
空圧センサー

Application/Max6.1/Cycling/74

Mac Rantimeで動く 編集はできない

Macをご使用の方はMaxをインストール後、
下記のbonk~とfiddle~というエクスターナルも合わせてダウンロード
http://vud.org/max/

fiddler~
bonk~
チルダ MSPexternalのフォルダ

Help MSPHelp

command + クリックで ロック アンロック

touch OSC

MSP シグナル 映像などのマトリックス -> 黄色

metro 30 -> 1秒間に30回信号がいく

音をオフにしたい場合はadc~をOFFに
adc~ AudioStatusの設定画面 ON

jit.window パッチの外にでるウィンドウ

jit.pwindow パッチ内にWindow

jit.qt.movie 1920 1080 ハイビジョンに

比率 4:3 昔 ブラウン管のとき
今現在は
16:9

 

...それにしてもクロージングパーティいきたかった。。。

札幌遠い。。。


クリエイティブ・コーディング・スクール in さっぽろ 2014

ofxkinect Exampleメモ(3)

//--------------------------------------------------------------
void testApp::draw() {

  ofSetColor(255, 255, 255);

  if(bDrawPointCloud) {
    easyCam.begin();

    //※
    drawPointCloud();
    easyCam.end();
  } else {
    // draw from the live kinect
    //イブのオンラインショップから描く
    //Kinect深度情報付き映像
    kinect.drawDepth(10, 10, 400, 300);
    kinect.draw(420, 10, 400, 300);

    grayImage.draw(10, 320, 400, 300);
    contourFinder.draw(10, 320, 400, 300);

#ifdef USE_TWO_KINECTS
  kinect2.draw(420, 320, 400, 300);
#endif
  }

  // draw instructions
  ofSetColor(255, 255, 255);
  stringstream reportStream;

  if(kinect.hasAccelControl()) {
    reportStream << "accel is: " << ofToString(kinect.getMksAccel().x, 2) << " / "
<< ofToString(kinect.getMksAccel().y, 2) << " / "
<< ofToString(kinect.getMksAccel().z, 2) << endl;
  } else {
    reportStream << "Note: this is a newer Xbox Kinect or Kinect For Windows device," << endl
<< "motor / led / accel controls are not currently supported" << endl << endl;
  }
//注:これは、Windowsデバイスの新しいのXboxKinectKinectのある、
//モーター/ LED/アクセルコントロールは現在サポートされていません

  reportStream << "press p to switch between images and point cloud, rotate the point cloud with the mouse" << endl
<< "using opencv threshold = " << bThreshWithOpenCV <<" (press spacebar)" << endl
<< "set near threshold " << nearThreshold << " (press: + -)" << endl
<< "set far threshold " << farThreshold << " (press: < >) num blobs found " << contourFinder.nBlobs
<< ", fps: " << ofGetFrameRate() << endl
<< "press c to close the connection and o to open it again, connection is: " << kinect.isConnected() << endl;

  ofDrawBitmapString(reportStream.str(), 20, 652);

  //画像と点群を切り替えるにはpを押し、マウスで点群を回転させる
  //OpenCVしきい値を使用して="<< bThreshWithOpenCV<<"(Spaceキーを押し)
  //近くにしきい値を設定し、「<< nearThreshold<< "(プレス:+ - )
  //num個のBLOBは見つかりました:遠いしきい値"<< farThreshold<<"(<>を押します)を設定
  //もう一度開くには、接続やOを閉鎖するプレスC、接続がされています

}

 

//drawPointCloudメソッド(ポイントクラウド手法) つづく...

参考: http://www.youtube.com/watch?v=vICLgxnZ1Bs

ofxkinect Exampleメモ(2)

//--------------------------------------------------------------
void testApp::update() {

  ofBackground(100, 100, 100);

  //kinectからの画像を更新
  kinect.update();

  // there is a new frame and we are connected
  //そこに新しいフレームがあり、我々が接続されている
  if(kinect.isFrameNew()) {

    // load grayscale depth image from the kinect source
    //Kinectのソースからの階調奥行き画像を読み込む //ofxCvGrayscaleImage
    grayImage.setFromPixels(kinect.getDepthPixels(), kinect.width, kinect.height);


    //閾値の範囲の深度の物体だけを抽出
    // we do two thresholds - one for the far plane and one for the near plane
    //ここまで飛行機用と近い平面について1 - 私たちは二つの閾値を行う
    // we then do a cvAnd to get the pixels which are a union of the two thresholds
    //我々は、2つの閾値の和集合であるピクセルを得るためにcvAndを行う
    if(bThreshWithOpenCV) {
      grayThreshNear = grayImage;
      grayThreshFar = grayImage;
      grayThreshNear.threshold(nearThreshold, true);
      grayThreshFar.threshold(farThreshold);
      cvAnd(grayThreshNear.getCvImage(), grayThreshFar.getCvImage(), grayImage.getCvImage(), NULL);
    } else {

      // or we do it ourselves - show people how they can work with the pixels
      //あるいは我々はそれを自分自身を行う - ショーの人々を、彼らはピクセルを扱うことができる方法
      unsigned char * pix = grayImage.getPixels();//ofxCvGrayscaleImage

      int numPixels = grayImage.getWidth() * grayImage.getHeight();
      for(int i = 0; i < numPixels; i++) {
        if(pix[i] < nearThreshold && pix[i] > farThreshold) {
          pix[i] = 255;
        } else {
         pix[i] = 0;
        }
      }
    }

    // update the cv images
    //CVイメージを更新
    grayImage.flagImageChanged();

    // find contours which are between the size of 20 pixels and 1/3 the w*h pixels.
    //20画素、1/3ワット* H画素の大きさの間にある輪郭を​​見つける。
    // also, find holes is set to true so we will get interior contours as well....
    //また、穴を見つけるには私たちは同様に内部の輪郭を取得するtrueに設定されている....
    contourFinder.findContours(grayImage, 10, (kinect.width*kinect.height)/2, 20, false);
  }

#ifdef USE_TWO_KINECTS
  kinect2.update();
#endif
}

ofxkinect Exampleメモ(1)

void testApp::setup() {
  ofSetLogLevel(OF_LOG_VERBOSE);

  // enable depth->video image calibration
  kinect.setRegistration(true);

  //kinect初期化
  kinect.init();
  //kinect.init(true); // shows infrared instead of RGB video image
  //代わりにRGB映像から赤外線示す
  //kinect.init(false, false); // disable video image (faster fps)
  //ビデオ画像を無効にする(速いFPS

  kinect.open(); // opens first available kinect
  //最初に利用可能なオンラインショップをオープンします

  //kinect.open(1); // open a kinect by id, starting with 0 (sorted by   serial # lexicographically))
  //を皮切りに、idでのKinectを開く0(シリアル#の辞書順の並  び順))
  //kinect.open("A00362A08602047A"); // open a kinect using it's   unique serial #
  //使用してオンラインショップを開くには、固有のシリアルです

  // print the intrinsic IR sensor values
  //真性IRセンサ値を印刷
  if(kinect.isConnected()) {
  ofLogNotice() << "sensor-emitter dist: " <<   kinect.getSensorEmitterDistance() << "cm";
  ofLogNotice() << "sensor-camera dist: " <<   kinect.getSensorCameraDistance() << "cm";
  ofLogNotice() << "zero plane pixel size: " <<   kinect.getZeroPlanePixelSize() << "mm";
  ofLogNotice() << "zero plane dist: " <<   kinect.getZeroPlaneDistance() << "mm";
  }

//キネクト2台使う
#ifdef USE_TWO_KINECTS
  kinect2.init();
  kinect2.open();
#endif

  //メモリ確保
  colorImg.allocate(kinect.width, kinect.height);
  grayImage.allocate(kinect.width, kinect.height);
  grayThreshNear.allocate(kinect.width, kinect.height);//ofxCvGrayscaleImage
  grayThreshFar.allocate(kinect.width, kinect.height);

  //閾値設定
  nearThreshold = 230;
  farThreshold = 70;
  bThreshWithOpenCV = true;

  ofSetFrameRate(60);

  // zero the tilt on startup
  // 起動時に傾きをゼロに
  angle = 0;
  kinect.setCameraTiltAngle(angle);

  // start from the front
  // 正面から開始
  bDrawPointCloud = false;
}

Auto-Renewable Subscriptionsメモ

iOS 自動継続課金について

 

iOS7についてのレシート情報の調べ方はWebにいろいろ載ってたけど

iOS6がいまいち載ってなかったので

iOS6でのレシート情報の調べ方

if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {

        // iOS 6.1 or earlier.

        NSData *testR = [Base64 decode:receiptString];

        NSLog(@"testR --> %@", testR);

        NSInteger status = [self verifyReceipt:testR sharedSecret:SHARED_SECRETNO];

 

        if (status == 0) {

            // 購入処理成功したことを通知する

        }

        else {

            // 購入処理エラーを通知する

        }

    }

    else {

        NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];

        NSLog(@"receiptURL -> %@", receiptURL);

        BOOL result = verifyReceiptAtPath([receiptURL path]);

        if (result == YES) {

            NSDictionary *dict = dictionaryWithAppStoreReceipt([receiptURL path]);

            NSLog(@"%@", dict);

 

            int status = [self savePurchaseInfo:dict];

            

            if (status == 0) {

                // 購入処理成功

            }

            else {

                // 購入処理エラー

            }

        }

    }

}

 

実装以外にもいろいろめんどうなんすよ

(´・ω;;;;;;テストとかテストとかテストとか.....申請とか申請とか....

参考

http://knowledge.kronos-jp.net/payment/yue-e-ke-jinmoderu-auto-renewable-subscriptions

http://umenon.com/2013/12/13/auto-renewable-subscriptions-not-recommended/

 

soundPlayFFTExampleメモ

the fft needs to be smoothed out, so we create an array of floats

FFTは、平滑化される必要があるので、floatの配列を作成します 

 

update()メソッド

update the sound playing system:

サウンドの再生システムを更新します。 

(1) we increase px and py by adding vx and vy

(1)VXとVYを追加することによって、PXとPYを高める

(2) check for collision, and trigger sounds:

(2)衝突をチェックし、トリガが鳴ります。

 horizontal collisions:

水平衝突: 

vertical collisions:

垂直衝突: 

(3) slow down velocity:

(3)速度を遅くする。 

(4) we use velocity for volume of the samples:

(4)我々は、サンプルのボリュームの速度を使用します。

(5) grab the fft, and put in into a "smoothed" array,

(5)、FFTをつかむと、「平滑化」配列に入れる

 

by taking maximums, as peaks and then smoothing downward

ピークとして、最大値を取った後、下方向に平滑化

request 128 values for fft

FFTのための128の値を要求する

let the smoothed calue sink to zero:

ゼロに平滑calueシンクをしてみましょう。

take the max, either the smoothed or the incoming:

最大値をとり、 

平滑化または着信のどちらか:

 

draw() メソッド

draw the fft resutls:

FFTのresutlsを描く。

(we use negative height here, because we want to flip them

because the top corner is 0,0)

我々はこれらを反転したいので、(私たちは、ここに負の高さを使用する 

 隅は0,0)であるため、

finally draw the playing circle:

最終的に演奏円を描く。

 

multiTextureShaderExampleメモ

シェーダにテクスチャを渡す

// There are 3 of ways of loading a shader:
//
//  1 - Using just the name of the shader and ledding ofShader look for .frag and .vert:
1 - ちょうどシェーダの名前とフラグメントおよびVERT探しofShader leddingを使用する。:
//      Ex.: shader.load( "myShader");
//
//  2 - Giving the right file names for each one:
//      Ex.: shader.load( "myShader.vert","myShader.frag");
2 - 各1のための右のファイル名を与える。
//
//  3 - And the third one is passing the shader programa on a single string;
3 - 3つめは、単一の文字列にシェーダPROGRAMAを渡している。
 //      In this particular example we are using STRINGIFY which is a handy macro
 この特定の例では、便利なマクロである文字列化を使用している

#define STRINGIFY(A) #A

マクロの定義

string shaderProgram =  STRING(

    uniform ....(略)

    viod main(void) {

       vec2 pos = gl_TexCoord[0].st;

       ....(略)

    }

);

shader.setupShaderFromSource(GL_FRAGMENT_SHADER, shaderProgram);

shader.linkProgram();

 

Let's clear the FBOs
otherwise it will bring some junk with it from the memory
それではFBOsをクリアしましょう
それ以外の場合は、メモリからそれでいくつかのジャンクを持って来る

MULTITEXTURE MIXING FBO
マルチテクスチャはFBOを混合
Pass the video texture
ビデオテクスチャを渡す

We are using this image just as a frame where the pixels can be arrange
this could be a mesh also.
私達はちょうどピクセルが手配することができますフレームとしてこの画像を使用している
これはまた、メッシュである可能性があります。

Comment "shader.setUniformTexture("maskTex", maskFbo.getTextureReference() , 4 );" to se how there is two ways
of passing a texture to the shader
2通りの方法がありますかSEに
"shader.setUniformTexture("maskTex", maskFbo.getTextureReference() , 4 );"をコメント