open-audiovisual
搜尋 GitHub

oav-p5 參考 · 鼓機與節奏

OAVp5.drums.copyText#

變數oav-p5
OAVp5.drums.copyText

卡片上「複製」按鈕放進剪貼簿的文字:把現在播的節奏寫成可以直接貼上的 startDrums("…", bpm)。

點格子、打字,找到喜歡的節奏之後,把這一行貼進 setup() 就能留住它。速度是現在的速度,四捨五入到小數點後兩位。

型別
String

例如 startDrums("bd*4, [~ sd]*2, hh*8", 110)。每次讀都是當下的值,鼓機載入之前是 ''。

範例

jsOpenProcessing ↗
function setup() {
  createCanvas(400, 300);
  startDrums('breakbeat', 120);
  textSize(12);
}

function draw() {
  background(20);
  fill(255);
  text(OAVp5.drums.copyText, 20, 20, width - 40, 200);
}
可以貼回 setup() 的那一行,在格子上點一點,它也會跟著變。

相關

  • OAVp5.drums.src 現在播的那一行節奏,例如 'bd*4, [~ sd]*2, hh*8'。鼓機載入之前是空字串。
  • OAVp5.drums.strudelUrl 現在播的節奏做成的連結,打開就會在 strudel.cc 裡開啟同一個節奏,沒有的時候是空字串。
  • startDrums() 啟動鼓機:頁面上出現一個 16 格的鼓機,播放預設節奏、你自己畫的格子或一行字寫的節奏,並替草圖數小節。

p5/oav-p5.js 第 1496 行

↑ 回到頂端 · 所有名稱