
REAPERでMPEを使ってノート別でピッチベンドをかける方法
今回はReaperというDawでSurge XTというシンセサイザー音源を使って同じトラック内のMIDIノートそれぞれに別のピッチベンドをかける
方法を解説したいと思います。
はじめに
まずMPEの解説から
MPEとはMIDI Polyphonic Expressionの略で、それぞれのノートのChannelを分けることでノート別にCC(コントロールチェンジ)をかけることができるものです。
使用するもの
Reaper v7.74 Mac arm64 (MPE対応のDaw)
Surge XT VSTi(MPE対応ソフトシンセサイザー)
Surge XTを立ち上げ、MPEをONにする
まずダブルクリックなどでトラックを追加した後、FXボタンを押しSurge XTを選択して立ち上げます。



MidiEditorを開きoptionから設定を変える。

Selecting a single note sets the channel for new events
この設定はCCを書く時に最後に選択したノートのChannelに自動で書き込んでくれるものです。MPEのMidi打ち込みをするなら必須の設定です。
Only show CCs on channels of selected notes (MPE mode)
この設定はオンにすることで今クリックしているノートのChannelのCCだけを表示することができる設定です。これは必須ではないですが、オンにしない場合全てのピッチベンドが重なって表示されます。
MidiEditorでMidiを打ち込む
MidiEditorを開いたらColorをChannelにしましょう。

MidiChannelをノートごとに分ける。
手動でやることもできる(アクションリストのMidiEditorでEdit: Set events to channel 01~16をすればできる)のですが面倒なのでスクリプトを作るります。
まずAction listを開いて

SectionをMIDI EditorにしてNew actionからNew ReaScriptを選択してファイルを保存し、テキストエディターが開いたら以下のコードを貼り付けて保存をしてください。
local editor = reaper.MIDIEditor_GetActive()
if not editor then return end
local take = reaper.MIDIEditor_GetTake(editor)
if not take then return end
reaper.MIDI_Sort(take)
local _, note_count = reaper.MIDI_CountEvts(take)
if note_count == 0 then return end
local notes = {}
for i = 0, note_count - 1 do
local _, sel, muted, start_pos, end_pos, chan, pitch, vel = reaper.MIDI_GetNote(take, i)
if sel then
table.insert(notes, {
index = i,
start_pos = start_pos,
end_pos = end_pos,
pitch = pitch,
vel = vel,
muted = muted
})
end
end
if #notes == 0 then return end
table.sort(notes, function(a, b)
if a.start_pos == b.start_pos then
return a.pitch < b.pitch
end
return a.start_pos < b.start_pos
end)
reaper.Undo_BeginBlock2(0)
local channel_end_positions = {}
for ch = 1, 15 do
channel_end_positions[ch] = -1
end
for i = 1, #notes do
local note = notes[i]
local assigned_ch = 1
local found_free_ch = false
for ch = 1, 15 do
if note.start_pos >= channel_end_positions[ch] then
assigned_ch = ch
found_free_ch = true
break
end
end
if not found_free_ch then
local min_end_pos = 1000000000000
for ch = 1, 15 do
if channel_end_positions[ch] < min_end_pos then
min_end_pos = channel_end_positions[ch]
assigned_ch = ch
end
end
end
channel_end_positions[assigned_ch] = note.end_pos
reaper.MIDI_SetNote(take, note.index, true, note.muted, note.start_pos, note.end_pos, assigned_ch, note.pitch, note.vel, true)
end
reaper.MIDI_Sort(take)
reaper.Undo_EndBlock2(0, "MPE Channel Splitter 16CH (No CH1)", -1)
reaper.UpdateArrange()これは実行した時に選択されているmidiノートをそれぞれ別Channelに振り分けてくれるものです。


CCレーンでPitchを書き込む
ピッチベンドをかけたいノートを選択した状態でCCレーンにポイントを追加していきます。CCレーンをPitchにした後にSnapを48semitonesでつけると半音で吸着してくれるので便利ですよ。ピッチを滑らかに移動させたい場合、まず始点と終点を作って、option(alt)キーを押しながらポイントとポイントの間の線をカーソルが横向きになった状態でドラッグするとカーブを作ることができます、ダブルクリックすると元に戻りますよ。


最後に
これからもちょくちょくReaperについての記事を書いていきたいのでgoogleフォームでReaperについてわからないことなどを回答していただけると嬉しいです!
https://forms.gle/wcRJApu4PkjvFBc29