## State Machine Actor

last updated: Ken Chen, Geoffrey Zheng, 27 December 1999

The State Machine actor (smActor) stores a virtual multi-node, multi-link graphic structure, which is generally abstracted from the semantic or musical information of certain sound materials. SmActor has a set of rules which will dynamically control the state of the graph and determine the result of possible transition when received trigger event at certain time point ...... send message to other actors.

To use the State Machine implementation, load sm.so and create an actor of type smActor.

(Note: )

### SmActor messages

In addition to the messages understood by all generator actors, the SeqActor understands the following messages:

setDirectory hActor dirname

Set the directory where the AscII files discribe the graphic structure should be found. The string, dirname must be ended with "/".

setPresetFile hActor filename

Set the filename of the AscII files used to initialize the graphic structure. The format of the file must be accurately followed.

setDoorNum hActor numDoor

Set the number of the doors which is used to observe the bahavior of the graphic structure.

initDoor hActor doorNum nodeNum

Set the initial state of the doors to the node specified by nodeNum. DoorNum ranges from 0 to numDoor - 1; nodeNum ranges from 1 to the Maximum node number specified in the PresetFile.

setTimelimit hActor x

Set the inactive time limit to x second. Default value: 100 s.

setCoupling hActor x

Set if the smActor operates in the coupling mode or not. x can be 0 and any integer greater than 0, which turns the coupling mode off and on respectively. Coupling comes from the idea that the inactive doors can intelligently "listen to" and update their states according to the activities of the most recent active door. This mechanism creats some interesting results that once a silent door is activated, it will respond to the most recent active door.

setMessageGroup hActor msgGroupName

Specify the name of the messageGroup, which will be used as an output of the smActor, and input to other Actor (most likely used to control the sound)
This output msgGroup contains an array of 5 arguments: [DoorNum, NodeNum, soundfileNum, Start time, Duration].

triggerDoor hActor doorNum

Send a trigger message to door with doorNum. SmActor will determine the resultant state of the door based on the current state of the door and the graph structure, and will output result to the messageGroup specified by setMessageGroup.

Format for the graphic structure files:

- Nodes:

| Node Name | Sound File Number | Start Time | End Time
Note: | Must be sequential integer beginning from 1 | Any integer which can be used to identify soundfiles. | Start time of the semantic unit, relative to the beginning of the soundfile. Unit: second | End time of the semantic unit, relative to the beginning of the soundfile. Unit: second
Example: | 1,2,3,4,5,.... | 01,1,32... | 10.773 | 13.573

- Terminals and Edges

| Start Time of the Term. | Node Linked | Time of the linked Node | Trans. Prob.

Note:

The position of the terminals within the semantic unit. Values relative to the beginning of the soundfile. Previous value will be used if the field is skipped.

The name of the node linked from this terminal.

Specify the destination position in the linked Node through this edge. It is a time relative to the beginning of the next soundfile.

Transition probility. Defaulted to be : (1/edgeNum). Default values will be automatically computed if the fields are vacant. Please make sure that the transition probabilities add up to 1.

Example: | 11.627,13.573 | (6, (10, (11 ... | 23.464 | 0.1, 0.2, 0.5 ...

- "End" should be placed at the end of the file.

- Tabs should be used to separate the numbers.

- A Sample File

1 01 10.773 13.573
11.627 (6 23.464
13.573 (6 23.464 0.1
(10 6.602 0.2
(11 26.497 0.3
(9 51.217 0.2
(5 17.165 0.2

2 01 13.573 16.136
16.136 (6 23.464 0.5
(10 4.285 0.5

3 02 16.136 18.509 0.3
18.509 (5 17.165
(10 4.285
(8 24.693
End