Next Chapter
Previous Chapter
Table of Contents

New, Go and Set

This chapter demonstrates how to create material afresh, change the editor's focus, and edit musical data.

New

Start out by creating a new thread:

Stella [Top-Level]: new thread
Name for new Thread: (<cr>=Thread-243) test
New object position: (<cr>=Top-Level)<cr>
Stella [Top-Level]: list
Top-Level:
      1.    #<THREAD: Pulse>
      2.    #<ALGORITHM: Sinus>
      3.    #<THREAD: Pulse2>
      4.    #<THREAD: Test>
Stella [Top-Level]:
The new thread Test was created and placed at the end of the Top-Level container. (If the new thread had been placed somewhere else, for example inside Pulse2, it would still be automatically added to Top-Level as well.)

Now create some midi notes for the new thread:

Stella [Top-Level]: new midi-note
Number of midi-notes to create: (<cr>=*) 12
Slots and values: amplitude .2 rhythm .5
New object position: (<cr>=Pasteboard) test
Stella [Top-Level]:
Note that new behaves differently for midi-note than for thread. When musical event data is created, new prompts for the number of objects to create and for initial slot values. In addtion, since Top-Level only holds named objects, when musical data is created in Top-Level the Pasteboard becomes the default container to receive the material. Placing the new material in the Pasteboard allows it to be easily replicated to other containers using paste.

Go

Twelve midi-note objects were created in the last example, each with an amplitude of .2 and a rhythm of .5. Now move Stella's focus to Test so that the new data can be edited easily. Go moves Stella's focus to a new object:

Stella [Top-Level]: go test

Focus:    Test
Type:     Thread
Status:   Normal
Elements: 12
Start:    unset

Stella [Test]:
Go automatically displays information about the new focus. The prompt also changes to show the new focus. At this point the editor is "inside" Test, so positional references are resolved inside Test.

There are several commands related to go. Next moves the focus to the next object at the same level as the current focus. Previous moves to the previous object at the same level. Up moves to the parent container (if there is only one), or to Top-Level if there is no parent.

Now that the focus has moved to Test, list the data:

Stella [Test]: list
Test:
      1.    #<MIDI-NOTE |---| 0.500| 0.500| 0.200| 0|>
      2.    #<MIDI-NOTE |---| 0.500| 0.500| 0.200| 0|>

[listing elided]

     11.    #<MIDI-NOTE |---| 0.500| 0.500| 0.200| 0|>
     12.    #<MIDI-NOTE |---| 0.500| 0.500| 0.200| 0|>
Stella [Test]: 
Notice that values for the note slot is printed ---. This is because note is a required value for midi notes, but no values were specified when the midi data were created. On the other hand, the duration slot is an optional value, since duration values were not specified they defaulted to the duration of rhythm. Since values for note are missing an error would occur if we tried to listen to this material, so we next supply the missing values.

Set

Set is the most basic command for assigning slot data:

Stella [Test]: set * duration rhythm
Stella [Test]: 
In this example, set sets the duration slot of each object in Test to the value of its rhythm slot. Editing commands like set normally operate on pairs of arguments:

    {slot expr}*
where slot is the name of a slot and expr is an expression to evaluate in the context of the currently mapped object. The expression can be any Lisp statement, for example:
Stella [Test]: set * duration (+ rhythm (random .25))
Stella [Test]:
would set each duration to the value of rhythm plus a some random amount not to exceed .25.

See Command Expressions for a complete discussion of what sorts of expressions are allowed in commands like set.

Next, set all the empty note slots:

Stella [Test]: set * note (notes c2 cs d in heap)
Stella [Test]: 
There are five other commands closely related to set. transpose and invert have already been discussed in an earlier chapter. increment adds a specified amount to the current value of a slot. The scale command multiplies the current slot value by some amount. (Note that Increment and scale only work with slots that contain numeric data, and invert and transpose only work with slots containing frequency data.) Finally, map implements a general mapping language in which all the data editing commands are available as mapping operators. Map is more complicated and will be discussed in a later chapter.

Next Chapter
Previous Chapter
Table of Contents

Last Modified: 6-Mar-1998