Tracks

 

sxGetTrackInfo() sxSetMIDIThruState() sxSetMIDIThru()
sxSetTrackTranspose() sxGetTrackTranspose() sxSetTrackMute()
sxGetTrackMute() sxSetTrackName() sxGetTrackName()
sxClearTrack() sxDeleteTrackEvents() sxSetTrackChannel()
sxGetTrackChannel() sxSetTrackInstrument() sxGetTrackInstrument()
sxSetTrackVolume() sxGetTrackVolume() sxSetTrackPan()
sxGetTrackPan() sxSetTrackReverb() sxGetTrackReverb()
sxSetTrackChorus() sxGetTrackChorus() sxCreateTrack()
sxBuildTrack() sxGetTrack() sxBuildSong()
sxMergeTracks() sxAddToTrack() sxGetTrackCount()
sxGetPartCount() sxGetMarkerList() sxGetKeySignList()
sxChannelSort() sxSetTrackQuantize() sxUnquantizeTrack()


The Track handling functions are an extensive list of functions used to manipulate music and control how the music is played back. Commands like sxBuildTrack() and sxAddToTrack() change the actual data, while Commands like sxSetTrackVilume() or sxSetTrackMute() change the way the music is played back.

sxGetTrackInfo(mySong, trackNum)
sxGetTrackInfo returns a propertylist containing info on the referred Track.
The list contains the following properties:
#trackName, #trackTranspose, #trackChannel, #trackInstrument, #trackVolume,
#trackPan, #trackReverb, #trackChorus, #trackMute and #partIDs.
#partIDs is a linear list of parts on the referred Track.

Result code:
List: Track info list
Negative integer: Standard error code.

Example:
on mouseUp
 global mySong
 put sxGetTrackInfo(mySong, 1)
end mouseUp

Could result:
- [#trackName: "Piano", #trackTranspose: 0, #trackChannel: 1, #trackInstrument:71, #trackVolume: 127, #trackPan: 40, #trackReverb: -1, #trackChorus: -1, #trackMute: 0, #partIDs: [3, 5]]


 

sxSetMIDIThruState(state)
sxSetMIDIThruState controls if incoming MIDI-data should be echoed
back to MIDI-out or not. State must be 1 or 0 (or TRUE/FALSE).
A value of 1 will set sequenceXtra to echo all incoming MIDI to
the MIDI out port. sequenceXtra defaults to 1.

Result code: Standard error code.

Example:
on mouseUp
 sxSetMIDIThruState(0) --will turn off MIDI-thru
end mouseUp

 

sxSetMIDIThru(mySong, trackNumber)
sxSetMIDIThru sets the Track that will be used for MIDI thru.
All incoming MIDI will pass thru this Track and all events will get
the settings of this track (MIDI channel, Transpose etc.) before
they are sent out to the synthesizer. If sxSetMIDIThruState() is
set to 0 this command will have no effect.

Result code: Standard error code.

Example:
on mouseUp
 global mySong
 sxSetMIDIThru(mySong, 5)
end mouseUp

 

sxSetTrackTranspose(mySong, trackNum, transpose)
sxSetTrackTranspose sets the transpose value of the referred Track.
The transpose value is set in semi tone steps, Positive values indicate
higher pitch and vice versa. Possible values range from -128 to 128.

Result code: Standard error code.

Example:
on mouseUp
 global mySong
 sxSetTrackTranspose(mySong, 6, 12) 
 -- Transpose Track 6 one octave up
end mouseUp

 

sxGetTrackTranspose(mySong, trackNum)
sxGetTrackTranspose returns an integer that indicates
the transpose value of the referred Track. The result is offset
by 128 to make it possible to return negative transpose vaues.
Negative integers are reseved for error codes.

Result code-128:
Positive integer: Transpose value.
Negative integer: Standard error code.

Example:          
on mouseUp 
 global mySong 
 put sxGetTrackTranspose(mySong, 1)into field "transposeDisplay" 
end mouseUp


 

sxSetTrackMute(mySong, trackNum, muteState)
sxSetTrackMute sets the playback state of the referred Track.
If muteState is 0 the Track will play. If muteState is 1 the Track is muted.

Result code:
1/0: Previous muteState.
Negative integer: Standard error code.

Example:
on mouseUp
 global mySong
 sxSetTrackMute(mySong, 1, 1)
end mouseUp

 

sxGetTrackMute(mySong, trackNum)
sxGetTrackMute returns the current playback state of the referred Track.

Result code:
TRUE = Muted
FALSE = Playing.
Negative integer: Standard error code

Example:
on mouseUp
 global mySong
 set currentMuteState = sxGetTrackMute(mySong, 1)
end mouseUp

 

sxSetTrackName(mySong, trackNum, name)
sxSetTrackName sets the name of the referred Track to the string name.

Result code: Standard error code

Example:
on mouseUp
 global mySong
 set trackname = "Clarinet"
 sxSetTrackName(mySong, 3, trackname)
end mouseUp


 

sxGetTrackName(mySong, trackNum)
sxGetTrackName returns the name of the referred Track.

Result code:
String: Track name.
Negative integer: Standard error code.

Example:
on mouseUp
 global mySong
 set trackName = sxGetTrackName(mySong, 1)
 if stringP(trackName) then put trackName
 else put "Track 1 has no name"
end mouseUp         

 

sxClearTrack(song, trackNum)
sxClearTrack erases all data from the referred Track.
All Parts on the Track are deleted and can not be used.
The track remains in memory and can be used for recording and creating Parts

Result code: Standard error code.

Example:
on mouseUp
 global mySong
 sxClearTrack(mySong, 1) -- Delete all data on Track 1
end mouseUp

 

sxDeleteTrackEvents(song, trackNum, from, to)
sxDeleteTrackEvents deletes all MIDI events on the referred Track, between the positions indicated by from and to.

Result code: Standard error code.

Example:
on mouseUp
 global mySong 
 sxDeleteTrackEvents(mySong , 1, 3, 5) 
-- Deletes MIDI-events on Track 1 between bar 3 and 5. end mouseUp

sxDeleteTrack(song, trackNum)
sxDeleteTrack deletes the referred Track and all containing data from the song. If there are Tracks in the Song with number above the deleted Track these Tracks will be renumbered starting from the number of the deleted Track. All settings of the remaining Tracks will be untouched.

Result code: Standard error code.

Example:
on mouseUp
 global mySong 
 sxDeleteTrackEvents(mySong , 1, 3, 5) 
-- Deletes MIDI-events on Track 1 between bar 3 and 5. end mouseUp

 

Track Parameters
Each Track in a sequenceXtra Song has a number of parameters that can be tested and set. These include the Tracks Channel, Instrument number, Volume etc. Below follows the commands to get and set these parameters

sxSetTrackChannel(mySong, trackNum, channel)
sxSetTrackChannel sets the MIDI channel on the referred Track.
If channel is set to 17, the track will have no channel setting and
all events will play back on their respective MIDI channel (no rechannelizing).

Result code: Standard error code.

Example:
on mouseUp
 global mySong 
 sxSetTrackChannel(mySong , 1, 16) 
 -- Track 1 plays back on MIDI channel 16
end mouseUp

 

sxGetTrackChannel(mySong, trackNum)
sxGetTrackChannel returns the current MIDI channel setting for the referred Track.

Result code: Standard error code.

Example:
on mouseUp
 global mySong 
 set channel = sxGetTrackChannel(mySong , 5)
end mouseUp

 

sxSetTrackInstrument(mySong, trackNum, programNumber)
sxSetTrackInstrument sets the Program Change number for the referred Track.

Result code: Standard error code.

Example:
on mouseUp
 global mySong 
 sxSetTrackInstrument(mySong , 1, 71) 
 -- Track 1 uses Instrument 71
end mouseUp


 

sxGetTrackInstrument(mySong, trackNum)
sxGetTrackInstrument returns the current Program Change
number for the referred Track.

Result code:
Positive integer: Program Change number.
Negative integer: Standard error code.

Example:
on mouseUp
 global mySong 
 set soundNum =sxGetTrackInstrument(mySong , 8)
end mouseUp

 

sxSetTrackVolume(mySong, trackNum, volume)
sxSetTrackVolume sets the MIDI volume of the referred track.


Result code: Standard error code.

Example:
on mouseUp
 global mySong 
 sxSetTrackVolume(mySong , 1, 80) 
 -- Track 1 gets the volume value 80
end mouseUp


 

sxGetTrackVolume(song, trackNum)
sxGetTrackVolume returns the current MIDI volume of the referred Track

Result code:
Positive integer: Track volume.
Negative integer: Standard error code.

Example:
on mouseUp
 global mySong 
 set volume = sxGetTrackVolume(mySong , 8)
end mouseUp

 

sxSetTrackPan(mySong, trackNum, pan)
sxSetTrackPan sets the MIDI pan value Track trackNum.
0 indicates max left, 64 indicates center and 127 indicates max Right.


Result code: Standard error code.

Example:
on mouseUp
 global mySong 
 sxSetTrackPan(mySong , 1, 30) 
end mouseUp


 

sxGetTrackPan(mySong, trackNum)
sxGetTrackPan returns the current Pan setting of Track trackNum.

Result code:
Positive integer: Track pan value.
Negative integer: Standard error code.

Example:
on mouseUp
 global mySong 
 set pan = sxGetTrackPan(mySong , curTrack)
end mouseUp


 

sxSetTrackReverb(mySong, trackNum, reverb)
sxSetTrackReverb sets the reverb value (MIDI-controller 91) of Track trackNum
Possible values range from 0 to 127.


Result code: Standard error code.

Example:
on mouseUp
 global mySong 
 sxSetTrackReverb(mySong , 1, 64) 
 -- Reverb level 64 on Track 1
end mouseUp

 

sxGetTrackReverb(mySong, trackNum)
sxGetTrackReverb returns the current reverb value for Track trackNum


Result code:
Positive integer: Current reverb level.
Negative integer: Standard error code.

Example:
on mouseUp
 global mySong 
 set currentReverb = sxGetTrackReverb(mySong , 1)
end mouseUp

 

sxSetTrackChorus(mySong, trackNum, chorus)
sxSetTrackChorus sets the chorus value (MIDI-controller 93) for the referred Track
Possible values range from 0 to 127


Result code: Standard error code.

Example:
on mouseUp
 global mySong 
 sxSetTrackChorus(mySong , 1, 64)
end mouseUp


 

sxGetTrackChorus(mySong, trackNum)
sxGetTrackChorus returns the current chorus setting of the referred Track

Result code:
Positive integer: Current chorus setting
Negative integer: Standard error code.

Example:
on mouseUp
 global mySong 
 theChorusValue = sxGetTrackChorus(mySong , 1)
end mouseUp

 

sxCreateTrack(mySong)
sxCreateTrack creates a new empty track in the referred song.
The track gets the same MIDI channel as its track number.
If the track number is larger than 16 the channel numbering starts over from 1.

Result code:
Positive integer: Track number
Negative integer: Standard error code.

Example:
on mouseUp
 global mySong  
 sxCreateTrack(mySong)
 newTrackNum = the result
end mouseUp


 

sxBuildTrack(mySong, trackNum, partList)
sxBuildTrack creates one or more Parts on track trackNum.
partList should be a linear list of parts, in the form showed in the example below.

Result code: Standard error code

Example:
on mouseUp
 global mySong
 set eventList1 = [[0,144,60,80,400], [480,144,62,80,400]]
 set eventList2 = [[0,144,64,80,400], [480,144,66,80,400]]
 set partList = [[[1,1,1,1],eventList1], [[2,1,1,1],eventList2]]
 sxBuildTrack(mySong , 3, partList)
end mouseUp


 

sxGetTrack(mySong, trackNum{, filterList})
sxGetTrack returns a Linear list of all the parts on the referred Track. filterList is an optional argument used to filter out certain event types. If filterlist is used, only the specified event types will be returned by the function.

Possible values in the filterlist are:
#keyon, #polypress, #ctrlchange, #prgchange, #chanpress and #pitchbend.

ResultCode
A List: The tracks partList
Negative integer: starnard error code

Example:
on mouseUp
 global mySong 
 put sxGetTrack(mySong , 1)
end mouseUp

Could result:
[[1,1,1,1], [[0,144,60,80,400], [480,144,62,80,400], [960,144,64,80,400]], [2,1,1,1],[[0,144,64,80,400], [480,144,66,80,400], [960,144,68,80,400]]]


 

sxBuildSong(mySong, trackList)
sxBuildSong builds a whole song from a list of tracks. The function replaces the whole Song and all previous data is lost.

Result code: Standard error code

Example:
on mouseUp
 global mySong
 set eventList1 = [[0,144,60,80,400], [480,144,62,80,400]]
 set eventList2 = [[0,144,64,80,400], [480,144,66,80,400]]
 set eventList3 = [[0,144,60,80,400], [480,144,55,80,400]]
 set eventList4 = [[0,144,48,80,400], [480,144,52,80,400]]
 set partList1 = [[[1,1,1,1],eventList1], [[2,1,1,1],eventList2]]
 set partList2 = [[[1,111],eventList3], [[2,1,1,1],eventList4]]
 set trackList1 = [partList1, partList2]
 sxBuildSong(mySong, trackList1)
end mouseUp


 

sxMergeTracks(mySong, fromTrack, toTrack)
sxMergeTracks makes a copy of the content in fromTrack and places it in toTrack. fromTrack remains intact after this operation. Hence, the contents in fromTrack will be duplicated by this.


Result code: Standard error code

Example:
on mouseUp 
 global mySong
 sxMergeTracks(mySong, 2, 1) 
end mouseUp

 

sxAddToTrack(mySong, trackNum, partList)
sxAddToTrack adds the contents of partList to the referred Track. Previous data on the Track is kept intact.

Can be used during playback
Result code: Standard error code

Example:
on mouseUp
 global mySong
  partList = [[1,1,1,1],[[0,144,60,80,400],[480,144,62,80,400]]]]          
 sxAddToTrack(mySong, 5, partList)
end mouseUp

 

sxAddToSong(mySong, trackList)
sxAddToSong adds the content of trackList to the referred song. Previous data in the song os kept intact.The example below also shows how to build a trackList

Example:
on mouseUp
 global mySong
 set eventList1 = [[0,144,60,80,400], [480,144,62,80,400]]
 set eventList2 = [[0,144,64,80,400], [480,144,66,80,400]]
 set eventList3 = [[0,144,60,80,400], [480,144,55,80,400]]
 set eventList4 = [[0,144,48,80,400], [480,144,52,80,400]]
 set partList1 = [[[1,1,1,1],eventList1], [[2,1,1,1],eventList2]]
 set partList2 = [[[1,1,1,1],eventList3], [[2,1,1,1],eventList4]]
 set trackList1 = [partList1, partList2]
 sxAddToSong(mySong, trackList1)
end mouseUp

 

sxGetTrackCount(mySong)
sxGetTrackCount returns the number of tracks in the referred song.

Result code:
Positive integer: number of Tracks.
Negative integer: Standard error code.

Example:
on mouseUp
 global mySong
 set trackCnt = sxGetTrackCount(mySong)
end mouseUp

 

sxGetPartCount(mySong, trackNum)
sxGetPartCount returns the number of Parts on track trackNum.


Result code:
Positive integer: Number of Parts on the Track.
Negative integer: Standard error code.

Example:
on mouseUp 
 global mySong
 set partCount = sxGetPartCount(mySong, 1)
end mouseUp

 

sxGetMarkerList(mySong)
sxGetMarkerList returns a linear list of all Markers in mySong.
Each entry in the list is a linear list with two values [time position, marker text]

Result code: Marker list
Negative integer: Standard error code.

Example:
on mouseUp
 global mySong
 put sxGetMarkerList(mySong)
end mouseUp

Could return:
- [[1920, "Intro"], [3840, "Verse"], [7680, "Refrain"]]


 

sxGetKeySignList(mySong)
sxGetKeySignList returns a linear list of all the key sign entries in the referred Song. Every entry in the list is a linear list with three values:

Result code: Key sign list.
Negative integer: Standard error code.

Example:
on mouseUp
 global mySong
 put sxGetKeySignList(mySong)
end mouseUp

Could result:
- [[0, 0, 0], [1920, 1, 0], [3840, -1, 1]]


 

sxChannelSort(mySong)
sxChannelSort sorts the MIDI events in the referred song so all MIDI events with the same MIDI channel value goes on the same Track.
MIDI events with MIDI channel 1 moves to Track 1
MIDI events with MIDI channel 2 moves to Track 2
etc.

Note that the whole structure of the song is lost by this operation.

Result code: Standard error code.

Example:
on mouseUp
 global mySong
 sxChannelSort(mySong)
end mouseUp

 

sxSetTrackQuantize(mySong, trackNum, quantizeValue)
sxSetTrackQuantize quantizes the referred Track with the value indicated by quantizeValue

Note, the quantization is non destructive and can be reversed with the command sxUnQuantizeTrack.

quantizeValue refers to note values in the following manner:

1
Whole note
12
Eigth note triplet
2
Half note
16
Sixteenth
4
Quarter note
20
Sixteenth quintuplet
6
Quarter note triplet
24
Sixteenth triplet
8
Eigth note
32
32 tuplet
10
Eigth note quintuplet
48
32 triplet

Result code: Standard error code.

Example:
on mouseUp
 global mySong
 sxSetTrackQuantize(mySong, 1, 16) 
 -- Quantize track 1 by 1/16 note
 end mouseUp


 

sxUnQuantizeTrack(mySong, trackNum)
sxUnQuantizeTrack removes all quantization from the referred Track.

Result code: Standard error code.

Exempel:
on mouseUp
 global mySong
 sxUnQuantizeTrack(mySong, 1)
end mouseUp