Concepts

At this point, you’ve already seen all of the core concepts of using Serenade. In this section, we’ll cover a few of the most important concepts in more detail.

Edit Commands

edit commands are used to change existing text. These commands all take the same form:

<verb> <selector>

The selector describes what part of the code you’d like to edit, and the verb describes what you’d like to do.

A few verbs supported by Serenade include:

copy
cut
delete
go to

The most frequently-used selectors in Serenade include:

character
line
word

Common programming constructs are also selectors, like:

assert
class
if
else
for
function
method
parameter
phrase <text>
return value
third argument
while

As you can see, for selectors where it makes sense, like third argument, you can add an ordinal to distinguish among several instances of the same selector. You’ll see more detail in Lists, Indexes, and Ranges.

By combining verbs and selectors, you can create commands like:

copy word
cut phrase print
delete function
go to first paramer
go to line fifty

edit commands are often short, so they’ll be automatically executed when you pause speaking if Serenade was confident in what you said. If not, then you’ll see a list of alternatives to choose from, and you can either say use one to use the first alternative in the list (and so on), or you can say clear to start over.

Add Commands

Add commands are used to create free-form text. When dictating add commands, you can speak at whatever pace you’d like. Unlike edit commands, when you pause, you’ll always see transcripts appear on your screen; add commands are never auto-executed, even if Serenade knows exactly what you said, since you might want to add more text after pausing (e.g., if you wanted to stop and think). You’ll similarly need to say either a use command to select an option or clear to start over. Until you do, anything you say will be a part of the free-form text created for the current command.

In the last section, you saw a few examples of add commands. Similar to the edit commands above, all add commands take the same form:

add <selector> <text>

For instance, you can use add to create a function with:

add function factorial

Or, you can use the type command to just insert raw text:

type if n space equals equals space zero colon