生存報告

仕事でバックエンド、趣味でフロントエンド・デザイン

Tidal Cycles環境構築

Getting started

環境構築に若干手こずったのでメモ。 必要なものは以下。

公式サイトには自動インストールのスクリプトがあるけど動かなかった。中で何やってるかよくわからんので手動でやったほうが無難だと思う。

Environmental setup

Haskell

ここスクリプトを実行。

curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh

パスを通す

echo '. $HOME/.ghcup/env' >> "$HOME/.bashrc"
source  ~.bashrc

動作確認

ghci

こんな感じの表示があればOK

GHCi, version 8.10.5: https://www.haskell.org/ghc/  :? for help
Prelude>

Tidal Cycles(Library)

インストールするためのライブラリインストール

brew install cabal-install

Tidal Cyclesをインストール

cabal update
cabal new-install tidal --lib

動作確認

ghci
import Sound.Tidal.Context

こんな感じの表示があればOK

Prelude Sound.Tidal.Context>

以下のエラーが出たときはTidal Cyclesをインストールできていないので再度インストールし直す。

<no location info>: error:
  Could not find module ‘Sound.Tidal.Context’

SuperCollider

ここからzipで落としてきて解凍。 SuperCollider.appを起動。

SuperDirt

SuperCollider.appを起動して、左側のEditor部分に以下を記述。 記述した行にカーソルを合わせてcmd + Enterで実行

Quarks.checkForUpdates({Quarks.install("SuperDirt", "v1.7.2"); thisProcess.recompile()})

※公式ではSuperDirtのバージョンが1.1.3になっている。自分の環境にバージョンを合わせないと動かないので注意。

右下のPost windowに以下のような表示があればOK

-> Quarks
Installing SuperDirt
Installing Vowel
Vowel installed
Installing Dirt-Samples
Dirt-Samples installed
SuperDirt installed
.
.
.
compile done
localhost : setting clientID to 0.
internal : setting clientID to 0.
Class tree inited in 0.01 seconds
server 'localhost' already booting


*** Welcome to SuperCollider 3.11.2. *** For help press Cmd-D.

動作確認のため、SuperColliderを再起動する。

左側のEditor部分に以下を記述してcmd + Enterで実行し、SuperDirtを起動。

SuperDirt.start;

以下のような表示があればOK

SuperDirt: listening to Tidal on port 57120

File > Open startup fileで以下を記述しておけば、SuperColliderを起動したときにSuperDirtが自動で起動する。

/*
This is an example startup file. You can load it from your startup file
(to be found in Platform.userAppSupportDir +/+ "startup.scd")
*/

(
s.reboot { // server options are only updated on reboot
    // configure the sound server: here you could add hardware specific options
    // see http://doc.sccode.org/Classes/ServerOptions.html
    s.options.numBuffers = 1024 * 256; // increase this if you need to load more samples
    s.options.memSize = 8192 * 32; // increase this if you get "alloc failed" messages
    s.options.numWireBufs = 64; // increase this if you get "exceeded number of interconnect buffers" messages 
    s.options.maxNodes = 1024 * 32; // increase this if you are getting drop outs and the message "too many nodes"
    s.options.numOutputBusChannels = 2; // set this to your hardware output channel size, if necessary
    s.options.numInputBusChannels = 2; // set this to your hardware output channel size, if necessary
    // boot the server and start SuperDirt
    s.waitForBoot {
        ~dirt = SuperDirt(2, s); // two output channels, increase if you want to pan across more channels
        ~dirt.loadSoundFiles;   // load samples (path containing a wildcard can be passed in)
        // for example: ~dirt.loadSoundFiles("/Users/myUserName/Dirt/samples/*");
        // s.sync; // optionally: wait for samples to be read
        ~dirt.start(57120, 0 ! 12);   // start listening on port 57120, create two busses each sending audio to channel 0

        // optional, needed for convenient access from sclang:
        (
            ~d1 = ~dirt.orbits[0]; ~d2 = ~dirt.orbits[1]; ~d3 = ~dirt.orbits[2];
            ~d4 = ~dirt.orbits[3]; ~d5 = ~dirt.orbits[4]; ~d6 = ~dirt.orbits[5];
            ~d7 = ~dirt.orbits[6]; ~d8 = ~dirt.orbits[7]; ~d9 = ~dirt.orbits[8];
            ~d10 = ~dirt.orbits[9]; ~d11 = ~dirt.orbits[10]; ~d12 = ~dirt.orbits[11];
        );
    };

    s.latency = 0.3; // increase this if you get "late" messages
};
);

VS Code

VS Code自体のインストールは略。 以下の拡張機能をインストールする。

setting.jsonに以下を追記。

"files.associations": {
    "*.tidal": "haskell"
},

以下の記述があれば音の確認ができて便利(VS Codeの左端にあるツールバーのTidal Cyclesから確認できる)

"tidalcycles.sounds.paths": [
    "/path/to/your/sounds"
]

Sound Test

音を鳴らしてみる。 以下のコードを.tidalとして保存。

d1 $ sound "bd sn"

行にカーソルを合わせてshift + Enter で音がなればOK。

音を止めたい場合は以下を記述してshift + EnterすればOK。

hush

References

MacOS | Tidal Cycles

TidalCycles入門 (2): VS Code 上での実行環境 - DAW悪戦苦闘記