【问题标题】:Processing Beat Detecting处理节拍检测
【发布时间】:2017-02-07 23:44:24
【问题描述】:

我正在使用处理和 minim 库并尝试为实时音频输入创建 3D 实时可视化。

我绘制了方框,并且正在响应音频输入的 kick、snare 和 hi hat。我想让这些盒子旋转也响应踢等。我怎样才能让这些盒子旋转?

if ( beat.isKick() ) kickSize = 200;
if ( beat.isSnare() ) snareSize = 250;
if ( beat.isHat() ) hatSize = 200;
translate ( width/4, height/4);
box(kickSize);
translate( - width/4, - height/4);

translate ( width/2, height/3);
sphere(snareSize);
translate( - width/2, - height/3);

translate ( 3*width/4, height/4);
box(hatSize);
translate( - 3*width/4, - height/4);


kickSize = constrain(kickSize * 0.95, 1, 32);
snareSize = constrain(snareSize * 0.95, 1, 32);
hatSize = constrain(hatSize * 0.95, 1, 32);

【问题讨论】:

  • 你到底在问什么?您可以使用rotate() 函数来旋转形状。你试过什么?你到底卡在哪里了?
  • 每次检测到“踢”时让形状旋转
  • 翻译(宽度/4,高度/4);框(kickSize);旋转(kickSize);翻译(-宽度/4,-高度/4);这似乎旋转了一切。我想分别旋转每个盒子

标签: audio processing


【解决方案1】:

使用pushMatrix();popMatrix(); 调用来隔离每个对象的坐标系:

pushMatrix();
translate ( width/4, height/4);
box(kickSize);
popMatrix();

pushMatrix();
translate ( width/2, height/3);
sphere(snareSize);
popMatrix();

pushMatrix();
translate ( 3*width/4, height/4);
box(hatSize);
popMatrix();

查看2D transformations Processing tutorial 了解更多详情。 同样的原理也适用于 3D

【讨论】:

    猜你喜欢
    • 2012-01-29
    • 1970-01-01
    • 1970-01-01
    • 2011-09-27
    • 2015-08-08
    • 1970-01-01
    • 2015-02-15
    • 2011-09-27
    • 1970-01-01
    相关资源
    最近更新 更多