0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

SuperCollider を scnvim から操作する

0
Last updated at Posted at 2026-07-25

はじめに

pi-Stomp という MOD audio のソフトウェアで構成されたマルチエフェクターのキットを購入しました。
ベースはラズパイ5なので、一緒に音楽作成環境も構築しようと考えています。

『マルチエフェクターを自作する (pi-Stomp をつくろう)』

SuperCollider も使えるようにしようと考えたのですが、scide(SuperColliderの統合開発環境)が重くて、ラズパイ5では落ちてしまい使いものになりません。

そこで、SuperCollider をクライアント/サーバーモデルで利用しようというのが今回の記事です。

SuperCollider とは

SuperCollider は次の3つのコンポーネントから構成されます。

  • scsynth
  • sclang
  • scide

sysynth はリアルタイムオーディオエンジンであり、サーバーとして動作します。

sclang はインタープリタ言語であり、scsynth のクライアントとして動作します。

scide は sclang の統合エディターです。SuperCollider といえばこのエディターのことを想起する人も多いと思います。

scnvim とは

scnvim は SuperCollider の neovim フロントエンドで、一つのプラグインです。

neovim のプラグインマネージャーを使って簡単にインストールできます。

わたしは vim-plug を利用してインストールしましたので、その手順に従って説明していきます。

他のプラグインマネージャーを利用されている方は適宜読み替えてください。

vim-plug

まず、vim-plug をダウンロードして、~/.local/share/nvim/site/autoloadを作成し、plug.vim をダウンロードします。

sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
       https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'

次に scnvim をインストールするため、~/.config/nvim/init.luaを編集します。

~/.config/vim/init.lua
vim.cmd [[
call plug#begin()

Plug 'davidgranstrom/scnvim'

call plug#end()
]]

編集が終了したらコマンドラインモードで:PlugInstallと入力しエンターを押します。

これで scnvim がインストールされたはずです。

scnvim のビルド

rust のインストール

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

$PATH を通します。

. "$HOME/.cargo/env"

stylua をインストールします。

cargo install stylua

lua-check のインストール

sudo apt install lua-check

ビルド

~/.local/share/nvim/plugged/scnvimへ移動し、make を実行します。

cd ~/.local/share/nvim/plugged/scnvim
make

ビルドした scnvim を SuperCollider に組み込みます。
(一度、SuperCollider(scide)を起動しておく必要があります。)

ln -s ~/.local/share/nvim/plugged/scnvim/scide_scnvim \
      ~/.local/share/SuperCollider/Extensions/scide_scnvim

scnvim の確認

neovim を起動して、コマンドラインモードで:checkhealth scnvimを入力しエンターを押します。

下記のように『OK』が表示されれば正常にインストールされています。

scnvim: require("scnvim.health").check()

scnvim ~
- OK nvim version 0.10.4
- OK sclang executable: /usr/bin/sclang
- OK scnvim classes are installed: /home/aki/.local/share/SuperCollider/Extensions/scide_scnvim
- no keymaps defined

scnvim documentation ~
- using HelpBrowser for documentation

scnvim extensions ~

scnvim の設定

~/.config/nvim/init.luaで設定をおこないます。

~/.config/nvim/init.lua
vim.cmd [[
call plug#begin()

Plug 'davidgranstrom/scnvim'

call plug#end()
]]

-- General Neovim options
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.softtabstop = 4
vim.opt.expandtab = false

local scnvim = require("scnvim")
local map = scnvim.map
local map_expr = scnvim.map_expr

scnvim.setup({
  keymaps = {
    ['<M-e>'] = map('editor.send_line', {'i', 'n'}),
    ['<C-e>'] = {
      map('editor.send_block', {'i', 'n'}),
      map('editor.send_selection', 'x'),
    },
    ['<CR>'] = map('postwin.toggle'),
    ['<M-CR>'] = map('postwin.toggle', 'i'),
    ['<M-L>'] = map('postwin.clear', {'n', 'i'}),
    ['<C-k>'] = map('signature.show', {'n', 'i'}),
    ['<F12>'] = map('sclang.hard_stop', {'n', 'x', 'i'}),
    ['<leader>st'] = map('sclang.start'),
    ['<leader>sk'] = map('sclang.recompile'),
    ['<F1>'] = map_expr('s.boot'),
    ['<F2>'] = map_expr('s.meter'),
  },
  editor = {
    highlight = {
      color = 'IncSearch',
    },
  },
  postwin = {
    float = {
      enabled = true,
    },
  },
})

scnvim の使い方

ホスト(scsynth)

まずホスト側でターミナルを開き、scsynth を下記のように起動します。

scsynth -u 57110 -B 0.0.0.0 -l 2

クライアント(scnvim)

neovim をnvim test.scdで起動し、コマンドラインモードで:SCVinStartを実行します。

起動すると postウィンドウが開きますが、エンターで閉じることができます。
もう一度、エンターを押すと postウィンドウがふたたび開きます。

Screenshot From 2026-07-25 15-53-41.png

あとは下記のコマンドを上から順に Alt + eCtrl + e で実行していって、最後に音が鳴れば成功です。(JACK や Pipewire 環境で利用している場合は、事前に出力をスピーカー等に設定しておいてください。)

o = ServerOptions.new;
s = Server.remote(\raspi, NetAddr("192.168.0.22", 57110), o);
s.initTree;
{SinOsc.ar(440, 0, 0.2)!2}.play(s);
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?