p5 with Strudelp5 跟 Strudel 一起
Strudel plays in another tab and this sketch draws: every note Strudel sends to OAV Virtual MIDI calls notePressed(), and its clock turns drumPhase.Strudel 在另一個分頁演奏,這份草圖畫畫面:Strudel 送到 OAV Virtual MIDI 的每個音都呼叫 notePressed(),它的時鐘推著 drumPhase 轉。
Try these three things試試這三件事
- Open strudel.cc in another tab, paste lines 5 to 7 of sketch.js (the comment at the top, without the //) and press Ctrl+Enter: Strudel's notes rise here as circles.
- Add ?room=your-name to this page's address and use the same name in Strudel: then only your two tabs share notes.
- No Strudel open? Click the 🎹 and play: the same notePressed() draws them.
- 在另一個分頁打開 strudel.cc,貼上 sketch.js 開頭註解的第 5 到 7 行(拿掉 //),按 Ctrl+Enter:Strudel 的音符會在這裡變成往上飄的圓。
- 在這一頁的網址後面加上 ?room=你的名字,Strudel 那邊也用同一個名字,就只有你的兩個分頁互通。
- 沒有開 Strudel?點 🎹 彈幾個音:同一個 notePressed() 也會畫出來。
Needs: Strudel in another tab.需要:另一個分頁的 Strudel。
No hardware? Use On-screen controller.沒有硬體?用螢幕上的控制器。
Read these lines讀這幾行
sketch.js:9–10 The room first, then the one line: pages in the same room hear each other's programs.先寫房間名,再寫那一行:同一個房間的頁面,聽得到彼此的程式。sketch.js:21–23 Strudel's notes arrive as notePressed(), at the moment Strudel stamped them.Strudel 的音符照它標的時間呼叫 notePressed()。sketch.js:34 drumPhase follows Strudel's clock: once round a bar.drumPhase 跟著 Strudel 的時鐘走:一小節轉一圈。
In the docs文件裡: Recipe 2: Strudel plays, a p5 sketch draws配方二:Strudel 演奏,p5 草圖畫畫面 · With Strudel和 Strudel 一起用
Next: 24 p5 note names →下一個:24 p5 音名 →
All examples所有範例