language : Japanese | English

SAL (Sekaiju Application Language)

Home Examples Reference Download Buy FAQ Forum Author


Examples

Here is some examples of SAL script file (*.sal). Please feel free for copying and using these examples. Following examples are included in the zip file. To execute SAL, plsease select "Edit(E)" - "SAL (Sekaiju Application Language...)" and Select SAL script file (*.sal) in the File Dialog box.

Hello World!

Here is simple script for SAL. This shows message box "Hello world!".

(do
 (pause "Hello World!")
)

Modify specified event's value

Following script increase selected note event's velocity 10. forEachEvent is used for applying each selected event. In SAL, unless against MIDI's specification, you can modify all kind's event' all values.

(do
 (forEachEvent
  (if (== Event.Kind NOTE)
   (do
    (+= Note.Vel 10)
   )
  )
 )
)

Modify specified event's track

It is easy to move selected event to the other track in SAL though it is difficult in CAL. Following script moves selected pitch bend event to the next track by using Event.Track.

(do
 (forEachEvent
  (if (== Event.Kind WHEEL)
   (+= Event.Track 1)
  )
 )
)

Insert modulation or expression event for each note event all at once.

Following script inserts CC#1-modulation=32 with 29 ticks delay from each note on events. And insert modulation (CC#1=0) for each note on time for reset. This makes a big presense to simple flute, oboe or trombone's sound. An insert command is used for to insert new event. In SAL, unless against MIDI's spacification, all kind's event can be inserted.

(do
 (forEachEvent
  (if (== Event.Kind NOTE)
   (do
    (int nTime Event.Time)
    (int nCh Event.Chan)
    (int nDur Note.Dur)
    (insert (+ nTime -1) nCh CONTROL 1 0)
    (if (>= nDur 29)
     (insert (+ nTime 29) nCh CONTROL 1 32)
    )
   )
  )
 )
)

Modify volume event (CC#7) to master volume event.

Though it is difficult to insert system exclusive message in CAL, it is easy in SAL. Following script converts selected CC#7-volume event to master volume event (system exclusive).

(do
 (forEachEvent
  (if (== Event.Kind CONTROL)
   (if (== Control.Num 7)
    (do
     (int nTime Event.Time)
     (int nVal Control.Val)
     (insert nTime -1 SYSXDATA 240 127 127 4 1 0 nVal 247)
     (delete)
    )
   )
  )
 )
)

User defined arpeggio

SAL enables you to make user-defined arpeggiater. Next script turns each notes into major-based semiquarver arpeggio notes all at once, which is, single C turns into CEGCEGCE........ and single D turns into DF#ADF#ADF#........

(do
 (int nTime 0)
 (int nCh 0)
 (int nInterval (/ TIMEBASE 4))
 (int nPos 0)
 (int nKey 0)
 (int nVel 0)
 (int nDur 0)
 (forEachEvent
  (if (== Event.Kind NOTE)
   (do
    (= nCh Event.Chan)
    (= nTime Event.Time)
    (= nDur Note.Dur)
    (= nKey Note.Key)
    (= nVel Note.Vel)
    (= nPos nTime)
    (while (< nPos (+ nTime nDur))
     (do
      (if (< nPos (+ nTime nDur))
       (insert nPos nCh NOTE (+ nKey 0) nVel nInterval)
      )
      (+= nPos nInterval)
      (if (< nPos (+ nTime nDur))
       (insert nPos nCh NOTE (+ nKey 4) nVel nInterval)
      )
      (+= nPos nInterval)
      (if (< nPos (+ nTime nDur))
       (insert nPos nCh NOTE (+ nKey 7) nVel nInterval)
      )
      (+= nPos nInterval)
      (if (< nPos (+ nTime nDur))
       (insert nPos nCh NOTE (+ nKey 12) nVel nInterval)
      )
      (+= nPos nInterval)
      (if (< nPos (+ nTime nDur))
       (insert nPos nCh NOTE (+ nKey 16) nVel nInterval)
      )
      (+= nPos nInterval)
      (if (< nPos (+ nTime nDur))
       (insert nPos nCh NOTE (+ nKey 7) nVel nInterval)
      )
      (+= nPos nInterval)
      (if (< nPos (+ nTime nDur))
       (insert nPos nCh NOTE (+ nKey 12) nVel nInterval)
      )
      (+= nPos nInterval)
      (if (< nPos (+ nTime nDur))
       (insert nPos nCh NOTE (+ nKey 16) nVel nInterval)
      )
      (+= nPos nInterval)
     )
    )
    (delete)
   )
  )
 )
)

Trims overlapped notes all at once

Mr/Ms/Mx.Bavi_H (Robert Hart) writes SAL script which trims overlapped notes all at once. For detail, please see this web-site. Thanks very much.


(C)2017-2021 kuzu all rights reserved. e-mail : ee65051#yahoo$co$jp (Modify # to @, and $ to . )