フォーラム: OpenMIDIProject forum (スレッド #39056)

Editing pitch bend information (2017-12-22 04:51 by vince94 #80508)

I was looking at this midi file: http://www.vgmusic.com/music/console/nintendo/snes/FF3_Jidoor.mid

There are very precise pitch bends that seamlessly transition between semitones. Is there a simpler way to do this with Sekaiju?
I know it's possible to manually insert codes via the Event list, but I don't know how to understand/keep track of timecodes (Measure:Beat:Tick), what all the values are for precise semitone changes, or if it's possible to specify pitch bends up to an octave.
Coming from a tracker/module/MML background, using the pencil tool and even the line tool seems very fiddly - it detunes the entire channel unless you're pixel-perfect.

メッセージ #80508 への返信×

Wiki文法は使えません
ログインしていません。投稿を区別するために投稿者のニックネームをつけてください(ニックネームの一意性は保証されません。全く別の人も同じ名前を利用することが可能ですので本人であることの特定には利用できません。本人であることを保証したい場合にはログインして投稿を行なってください)。 ログインする

Re: Editing pitch bend information (2017-12-22 21:01 by kuzu #80510)

Thank you for using Sekaiju.

I've looked at the MIDI data, but basically, each pitchbend events seem to be inserted manually by hand, in piano roll window or event list window, which I've ever do it 20 years ago, too. Once make one measure's pattern, you can use copy by dragging with ctrl key. But certainly this way is so bothersome and inefficient if we make a lot of note's effect, and a lot of MIDI data.

So, expert or professional musicians uses SAL (Sekaiju Application Language) or CAL (Cakewalk Application Language) to insert a lot of event such as modulation, expression or pitchbend quickly all at once. The following SAL script inserts pitchbend=8191 10 ticks later and pitchbend=0 20 ticks later to all selected note events all at once.

(do
(forEachEvent
(if (== Event.Kind NOTE)
(do
(int nTime Event.Time)
(insert (+ nTime 10) Event.Chan WHEEL 8191)
(insert (+ nTime 20) Event.Chan WHEEL 0)
)
)
)
)

Sekaiju started supporting SAL from Sekaiju5.1. SAL is external extension program of Sekaiju. SAL enables you to make user-defined editing command and execute it. SAL can insert, modify or delete all kind of event. This is very efficient to make complex and precise MIDI data. If you are interested in SAL, please see SAL's web-site. Please note that now Cakewalk (and Sonar) finished development.
#80508 への返信

メッセージ #80510 への返信×

Wiki文法は使えません
ログインしていません。投稿を区別するために投稿者のニックネームをつけてください(ニックネームの一意性は保証されません。全く別の人も同じ名前を利用することが可能ですので本人であることの特定には利用できません。本人であることを保証したい場合にはログインして投稿を行なってください)。 ログインする

Re: Editing pitch bend information (2017-12-30 06:29 by vince94 #80532)

Thank you for letting me know about this extension! I'm a bit of a sound programmer myself (I've made music that runs on the SFC's SPC700 sound chip), so I bet this will be familiar to me once I get used to using it. I'll reply on here again if I have any trouble!
#80510 への返信

メッセージ #80532 への返信×

Wiki文法は使えません
ログインしていません。投稿を区別するために投稿者のニックネームをつけてください(ニックネームの一意性は保証されません。全く別の人も同じ名前を利用することが可能ですので本人であることの特定には利用できません。本人であることを保証したい場合にはログインして投稿を行なってください)。 ログインする

Re: Editing pitch bend information (2018-01-03 03:30 by vince94 #80537)

I wrote this, but it doesn't seem to work. Could you look it over?

(do
(int bend)
(int length)
(int channel)
(int timecode)
(int waitTime)

(getInt channel "What MIDI channel is this?\r\n(It's the blue number next to the tools at the top of the Piano Roll window)" 1 17)
(getTime timecode "Input a timecode (Measure:Beat:Tick)\r\n(Examine a note's Properties page to find out what to type here)")
(getInt bend "Input the Pitch Bend value to start from:" -8192 8191)
(getInt length "Input the intended duration:" 1 9999) ;I don't know if this is an appropriate maximum number of ticks
(getInt waitTime "Input an amount of time to wait before bending:" 1 9999)

(int factor (/ bend length)) ;the amount to subtract after each iteration of the loop. Not sure if this would work as intended

;Here are some helpful values for the default pitch bend range - Source: https://forum.noteworthycomposer.com/?topic=753.0
;To do: Figure out how to change pitch bend range to a whole octave, and in turn, what the values would then correspond to
; 8191 = 2 semitones
; 4097 = 1 semitone
;-4096 = -1 semitone
;-8192 = -2 semitones

(if (> bend 0)
(while (> bend 0)
(insert timecode channel WHEEL bend) ;Insert a given number of pitch bend events
(-= bend factor) ;subtract this value from the bend variable, making the events evenly-set, like a straight line. This doesn't seem to work...
(if (> waitTime 0)
(+= timecode waitTime) ;Make it so the next event is inserted however many ticks later the user specified
(= waitTime 0) ;reset the variable so this if statement only runs once
)
(++ timecode) ;increment the time by one tick. This doesn't seem to work...
)
)


(if (< bend 0) ;I'd put this in <falseop> for the original if statement, but I haven't figured out how that aspect of the syntax works yet
(while (< bend 0)
(insert timecode channel WHEEL bend)
(-= bend factor)
(if (> waitTime 0)
(+= timecode waittime)
(= waitTime 0)
)
(++ timecode)
)
)

(insert timecode channel WHEEL 0) ;make sure the channel doesn't end up detuned
)
#80532 への返信

メッセージ #80537 への返信×

Wiki文法は使えません
ログインしていません。投稿を区別するために投稿者のニックネームをつけてください(ニックネームの一意性は保証されません。全く別の人も同じ名前を利用することが可能ですので本人であることの特定には利用できません。本人であることを保証したい場合にはログインして投稿を行なってください)。 ログインする

Re: Editing pitch bend information (2018-01-03 11:28 by kuzu #80538)

I don't know what you want to do exactly, but please be careful following.
1. (while's <op> must be a single function. If you want to write multiple function, please enclose them with (do.
2. (if's <trueop> and <falseop> must be single function. If you want to write multiple function, please enclose them with (do.

Next fixed script tentatively barely works. (insert inserts an event to active track if used out of (forEachEvent, so you need to set focus to the second or following track before executing SAL.

(do
(int bend)
(int length)
(int channel)
(int timecode)
(int waitTime)

(getInt channel "What MIDI channel is this?\r\n(It's the blue number next to the tools at the top of the Piano Roll window)" 1 17)
(getTime timecode "Input a timecode (Measure:Beat:Tick)\r\n(Examine a note's Properties page to find out what to type here)")
(getInt bend "Input the Pitch Bend value to start from:" -8192 8191)
(getInt length "Input the intended duration:" 1 9999) ;I don't know if this is an appropriate maximum number of ticks
(getInt waitTime "Input an amount of time to wait before bending:" 1 9999)

(int factor (/ bend length))

(if (> bend 0)

;trueop
(while (> bend 0)
(do
(insert timecode channel WHEEL bend)
(-= bend factor)
(if (> waitTime 0)
(do
(+= timecode waitTime)
(= waitTime 0) ;reset the variable so this if statement only runs once
)
)
(++ timecode) ;increment the time by one tick. This doesn't seem to work...
)
)

;falseop
(while (< bend 0)
(do
(insert timecode channel WHEEL bend)
(-= bend factor)
(if (> waitTime 0)
(do
(+= timecode waittime)
(= waitTime 0)
)
)
(++ timecode)
)
)
)

(insert timecode channel WHEEL 0)

#80537 への返信

メッセージ #80538 への返信×

Wiki文法は使えません
ログインしていません。投稿を区別するために投稿者のニックネームをつけてください(ニックネームの一意性は保証されません。全く別の人も同じ名前を利用することが可能ですので本人であることの特定には利用できません。本人であることを保証したい場合にはログインして投稿を行なってください)。 ログインする

Re: Editing pitch bend information (2018-01-04 04:09 by vince94 #80543)

Thanks, I think I understand a little better how to structure (do) statements. The code seems to work with positive numbers, here is what I was trying to do - https://i.imgur.com/TlTng0k.png - inserting pitch bends at precise timecodes, and making them evenly fade back to zero.
However, negative numbers seem to be inserted as zeros: https://i.imgur.com/Og0KRKa.png

Also, after it finishes running, it displays a blank text box with an exclamation mark. Does this indicate an error?

Since posting on the forum truncates indentation, here's a pastebin with the current version of the script: https://pastebin.com/raw/tvNXRhPL
I added a debug flag to try using if statements
#80538 への返信

メッセージ #80543 への返信×

Wiki文法は使えません
ログインしていません。投稿を区別するために投稿者のニックネームをつけてください(ニックネームの一意性は保証されません。全く別の人も同じ名前を利用することが可能ですので本人であることの特定には利用できません。本人であることを保証したい場合にはログインして投稿を行なってください)。 ログインする

Re: Editing pitch bend information (2018-01-06 22:46 by kuzu #80555)

>Also, after it finishes running, it displays a blank text box with an exclamation mark. Does this indicate an error?

I forgot to copy the last line, which is, closing the last bracket;

...
(insert timecode channel WHEEL 0)
) ; I forgot

blank text with an exclamation mark is SAL1.03's bug.
The message is "Unexpected EOF is detected.".
Now I've released SAL1.04.
#80543 への返信

メッセージ #80555 への返信×

Wiki文法は使えません
ログインしていません。投稿を区別するために投稿者のニックネームをつけてください(ニックネームの一意性は保証されません。全く別の人も同じ名前を利用することが可能ですので本人であることの特定には利用できません。本人であることを保証したい場合にはログインして投稿を行なってください)。 ログインする