Parts
SequenceXtra organizes
the events on each Track in Parts. A Part is a container of music, and has a
time position. You can create, edit, move and delete Parts from any Track ina
Song. Parts also have playback parameters that lets You transpose och mute a
Part. This makes it possible to change the character of segments of music on
a single track. Each Part has a PartID, which is an Integer created by sequenceXtra
when a Part is created. All actions on a Part uses this ID as identifier. Since
Standard MIDI Files (SMF) does not support the concept of Parts, a newly opened
SMF will have only one Part on each Track (created by sequenceXtra when the
file is opened). When You save a sequenceXtra file as an SMF the Song willl
lose its Part structure and all Parts on each Track will be merged to one stream
of MIDI data.
sxGetPartInfo(mySong,
partID)
sxGetPartInfo returns a property list containing info about the referred part.
The list will include the following properties:
#partID, #partStart, #partLength, #partUpbeat, #partName, #partTranspose, #partChannel,
#partInstrument, #partVolume, #partPan, #partReverb, #partChorus and #partMute.
If a property is not set, its value will be -1
Result code:
List: The part Info list.
Negative integer: Standard error code.
Example: on mouseUp global mySong put sxGetPartInfo(mySong, 3) end mouseUp
Could result
in the following list refering to part 3:
- [#partID: 3, #partStart: [1, 1, 1, 1], #partLength: [2,0,0,0], #partUpbeat:
[0,1,0,0], #partName: " intro ", #partTranspose: 0, #partChannel:
1, #partInstrument: 71, #partVolume: 127, #partPan: 40, #partReverb: -1,
#partChorus: -1, #partMute: 0]
sxSetPartUpbeat(mySong,
partID, upbeatLength)
sxSetPartUpbeat sets the length of the upbeat of the indicated Part. The
upbeat indicates how long before the part startposition playback of the
Parts content will start.
Result code: Standard error code.
Example: on mouseUp global mySong sxSetPartUpbeat(mySong, partID, [0,1,0,0]) -- One beat upbeat. end mouseUp
sxGetPartUpbeat(mySong,
partID)
sxGetPartUpbeat returns the length of the upbeat of the indicated Part.
Result code:
List: The Parts upbeat value as a linear list.
Negative integer: Standard error code.
Example: on mouseUp put sxGetPartUpbeat(mySong, partID) end mouseUp
Could result in [0,1,2,0] (if the upbeat is a dotted quarter note in 4/4)
sxSetPartTranspose(mySong,
partID, transpose)
sxSetPartTranspose sets the transpose value for the referred part. 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 sxSetTranspose(mySong, 3, 12) -- Transpose the Part with partID 3 one octave up end mouseUp
sxGetPartTranspose(mySong,
partID)
sxGetPartTranspose returns the transpose value of the referred part. The
value is offset by +128. This is because negative result codes are used
to indicate errors. The real result value is found by subtracting 128
from the result.
If the result is a positive Integer the function was executed OK.
Result code:
Positive Integer: referred Parts transpose value + 128.
Negative integer: Standard error code.
Example: on mouseUp global mySong transpose = sxGetPartTranspose(mySong, 4) if transpose > -1 then transpose = (transpose - 128) else put "There was an error of type" && transpose end if end mouseUp
sxSetPartMute(mySong,
partID, muteState)
sxSetPartMute sets the playback state of the referred Part. If muteState
= 0 the Part will be played. If muteState is 1 the Part will not play.
Result code:
Positive integer: The previous mute state.
Negative integer: Standard error code.
Example: on mouseUp global mySong sxSetPartMute(mySong, 1, 1) -- mute the Part with partID 1 end mouseUp
sxGetPartMute(mySong,
partID)
sxGetPartMute returns current playback state of the referred Part.
1 = Muted
0 = Playing
Result code:
TRUE or FALSE: Current playback state
Negative integer: Standard error code.
Example: on mouseUp global mySong set muteState = sxGetPartMute(mySong, 1) end mouseUp
sxSetPartName(mySong,
partID, partName)
sxSetPartName sets the name of the referred Part. partName must be a string
Result code: Standard error code.
Example: on mouseUp global mySong sxSetPartName(mySong, 4, "Intro") end mouseUp
sxGetPartName(mySong,
partID)
sxGetPartName returns a string with the name of the referred Part.
Result
code:
String: Part name
Negative integer: Standard error code.
Example: on mouseUp global mySong set partName = sxGetPartName(mySong, 6) end mouseUp
sxGetPartID(mySong,
partName)
sxGetPartID returns the partID of the indicated part
Result code:
Positive integer: PartID
Negative integer: Standard error code.
Example: on mouseUp global mySong set partID = sxGetPartID(mySong, "intro") end mouseUp
sxCreatePart(song,
trackNum, startPosition {, eventList})
sxCreatePart creates a new part on track trackNum at the position indicated
by startPosition. An optional eventlist can be used to fill the Part with
MIDI events at the same time. The length of the Part is controlled by
the content of the eventlist. If no eventList is used, the Part contains
no MIDI events and gets a lenght of 0 Ticks. Every Part gets a unique
ID number which is used as an argument to reference the Part, when adressed
from Lingo.
Result code:
Positive integer: The created Parts unique ID.
Negative integer: Standard error code.
Example: on mouseUp global part1, mySong part1 = sxCreatePart(mySong, 1, 13) -- New empty part on Track 1 in bar 13 end mouseUp
sxBuildPart(song,
partID, eventList)
sxBuildPart assigns eventList to the part indicated by partID. Previous
data in the Part is erased.For a description of eventLists, see the chapter
"Events Parts,Tracks & Songs".
Can be used
during playback
Result code: Standard error code.
Example: on mouseUp eventList = [[0,144,60,80,400], [480,144,62,80,400]] set part1 = sxCreatePart(mySong, 1, 1) -- New Part in bar 1 sxBuildPart(mySong, part1, eventList) end mouseUp
sxAddToPart(song,
partID, eventList)
sxAddToPart adds the MIDI events in eventList to the refered Part. Previous
data in the part are kept intact. For a description of eventLists, see
the chapter "Events Parts,Tracks & Songs".
Can be used
during playback
Result code: Standard error code.
Example: on mouseUp eventList = [[0,144,60,80,400], [480,144,62,80,400]] sxAddToPart(mySong, 10, eventList) -- adds the eventList to part 10 end mouseUp
sxClearPart(song,
partID)
sxClearPart deletes all MIDI events in the refered Part. The part remains
on the Track and can be filled with new data with sxBuildPart() or sxAddToPart().
Can be used during playback
Result code: Standard error code.
Example: on mouseUp global mySong sxClearPart(mySong, 1) -- Erase the content of the Part with ID #1 end mouseUp
sxGetPart(song,
partID {, filterList})
sxGetPart(song, partID [, filterList]) returns the eventlist contained
in the refered Part. With the optional argument filterList, specified
event types can be retrieved. filterList contains symbols, indicating
which event types to retreive. Possible symbol values in the list are:
#keyon, #polypress, #ctrlchange, #prgchange, #chanpress and #pitchbend.
Note! If the filterList is used, only the event types specified in the list are retrieved.
Result code.
List: The Parts eventList
Negative integer: Standard error code.
Example: on mouseUp sxGetPart(mySong, 2, [#ctrlchange,# prgchange]) end mouseUp
sxSetPartStart(song,
partID, startPos)
sxSetPartStart sets the starting position of the refered Part.
Result code. Standard error code.
Example: on mouseUp sxSetPartStart(mySong, part1, [3,1,1]) end mouseUp
sxGetPartStart(song,
partID {,format})
sxGetPartStart returns the starting position of the refrered Part. The
optional argument format indicates the format of the retreived data. Possible
values of format are: #bar, #beat, #sixteenth, #tick.
Result code:
List or Positive integer: Part start
Negative integer: Standard error code
Example: on mouseUp global mySong set partStart = sxGetPartStart(mySong, 1,#bar) end mouseUp
Could return: 3
sxSetPartLength(song,
partID, partLength)
sxSetPartLength sets the length of the refered Part.
Result code. Standard error code.
Example: on mouseUp sxSetPartLength(mySong, part1, 8) -- 8 bars long Part. end mouseUp
sxGetPartLength(song,
partID)
sxGetPartLength(song, partID) Returns a list containing the refered parts
length.
Result code:
List: Part lenght
Negative integer: Standard error code.
Example: on mouseUp set partLength = sxGetPartLength(mySong, part1) end mouseUp
sxJoinParts(song,
fromPartID, toPartID)
sxJoinParts joins the two Parts with partIDs fromPartID and toPartID.
The data is placed in the part with ID toPartID. If necessary the length
of the part is extended to the end position of the new data.
NOTE! the part with ID fromPartID is deleted by this function.
Result code: Standard error code.
Example: on mouseUp sxJoinParts(mySong1, part1, part2) -- Joins part 1 & 2 end mouseUp
sxSplitPart(mySong,
partID, splitPosition)
sxSplitPart splits the refered Part into two Parts, increasing the number
of parts by one.
Result code:
Positive integer: The new Parts unique ID
Negative integer: Standard error code.
Example: on mouseUp myNewPart = sxSplitPart(mySong,12,[8,1,1,1]) -- will split part 12 at bar 8 end mouseUp
sxDeletePart(song,
partID)
sxDeletePart deletes the refered Part and all of its content.
Result code: Standard error code
Example: on mouseUp global mySong sxDeletePart(mySong,24) -- will delete part 24 and all its content end mouseUp