Getting Started

Welcome to the Serenade docs! Here, you'll find an overview of everything Serenade can do, along with examples. First, let's get Serenade installed on your device.

Installation

Serenade is freely available for macOS, Windows, and Linux. To download Serenade, head to https://serenade.ai/download.

After installation, Serenade will walk you through installing plugins for supported applications, like VS Code, Chrome, and Hyper. Serenade will then guide you through interactive tutorials to practice voice coding.

Serenade can be configured to use cloud-based speech recognition or local speech recognition. To change this setting, just head to Settings > Server. If you're using Windows, the local server requires WSL with Ubuntu. Regardless of your setting, you can also opt into sharing your data with Serenade in order to help improve Serenade's speech-to-code machine learning models.

Setup

Serenade floats above all your other windows, so you can keep it side-by-side with other applications, like your code editor. You can toggle Serenade by clicking the Listening switch or pressing Alt+Space. Then, as you speak, you'll see a list of transcripts in the Serenade window.

Sometimes, Serenade isn't sure what you said, so you'll see a few different options. The first one will be used automatically, but to use a different option (and undo the first one), just say the number you want to use instead. For instance, to use the second option, just say two. If none of the options are right, you can just say undo.

Basics

As you'll see throughout these docs, most Serenade voice commands have the same form:

<action> <selector>

The action is something you want to do to your code. Common actions include add to add a new line of code, change to edit code, and delete to remove code.

A selector is a block of code to operate on. Some selectors are text-based, like line or word. Even more powerful selectors are code-based, which enable you to reference parts of your code, including function, class, and return value. For a complete list of selectors, see the Reference section.

Serenade commands simply combine an action and a selector: add function hello, change parameter to number, and copy lines five to ten.

You can also chain commands together without pausing. For instance, you can say save focus terminal to save your current file and then focus your terminal, or start of class add method hello to add a new method at the start of a class.

Finally, you can also specify how many times a command should be executed. For instance indent three times will run the indent command three times.

Common Commands

Below is a compact list of commonly-used Serenade commands that you can use as a reference or cheat sheet as you're learning voice coding.

CommandDescriptionExamples
go to <selector>
Move your cursor around a filego to line fiftygo to next function
add <code>
Add a new statement or constructadd return falseadd class exception
insert <code>
Insert text at your cursorinsert foo of bar plus baz
change <old> to <new>
Change existing textchange hello to goodbyechange return value to false
delete <selector>
Delete textdelete foo bardelete next function
copy/paste <selector>
Copy, cut, pastecopy methodcut previous two wordspaste
indent/dedent
Change the indentation level of codeindent blockdedent if
save
Save the current filesave
undo
Undo the last operationundo
open <text>
Open a new fileopen react.js
(next | previous) tab
Switch tabs in your editornext tabprevious tab
focus <text>
Switch appsfocus codefocus chrome

Adding Code

Serenade has two different commands for writing code.

  • insert inserts code right at your cursor, which is helpful for inserting text onto an existing line.
  • add moves your cursor intelligently based on what you say (e.g., "add parameter"), and is used for writing new statements and larger blocks of code, like functions and classes.

As you'll see, Serenade uses machine learning under the hood to handle many formatting details for you, so you don't have to manually dictate symbols and formatting details like underscores vs. camel case formatting. For instance, if you have a variable foo_bar in scope and you say insert foo bar, Serenade will automatically format your code as foo_bar, so you don't have to specify the underscore.

Inserting Code

The insert command will insert code at the current cursor position. insert is useful for appending text to an existing line of code or inserting text into the middle of a line.

insert commands look like:

insert (above | below)? <code>

CommandCode
insert hello world
hello world
insert above one
two
one
two

Adding Code Blocks

add is used for writing new lines or blocks of code. This command will intelligently position your cursor and handle boilerplate for you. For instance, add parameter foo will move your cursor to the nearest parameter list, and then create a new parameter.

Below are just some examples of add commands—you can use any selector. All add commands have the same form:

add <selector> <code>

CommandCode
add function int factorial
def factorial() -> int:
  pass
add class page
class Page:
  pass
add return say of string hello
return say("hello")
add else if x less than three
if x > 3:
  return
elif x < 3:
  pass
add import numpy as np
import numpy as np
add argument word brackets zero
capitalize(word[0])
add comment fix later
# fix later
add decorator app dot route
@app.route
def index():
  pass
add enum colors
class Colors(enum.Enum):
  pass
add if not error
if not error:
  pass
add callback equals lambda e
callback = lambda e: pass
add str method name
class Person:
  def name(self) -> str:
    pass
add property radius equals three point five
class Circle:
  radius = 3.5
add while i not equal zero
while i != 0:
  pass

Raw Text

system inserts text wherever your cursor has focus, even if no Serenade plugin is present. For instance, you can use system to type into VS Code's "Find" dialog box rather than the main text editor. system also doesn't do much formatting for you, which can be useful if you want to drop down to a lower-level and manually specify all formatting, spacing, etc.

CommandCode
system simple text
simple text

The go to command moves your cursor around the file. With this command, you can jump to any text in your file (e.g., go to random), or any selector (e.g., go to class). Since the go to command is so common, if you just say a selector, like next function or second parameter, Serenade will implicitly use the go to command.

Below are just some examples of go to commands—you can use any selector. All go to commands have the same form:

go to <selector>

CommandCode
go to line two
def random(low, high):
  return 4
go to random
def random(low, high):
  return 4
go to second parameter
def random(low, high):
  return 4
go to start of function
def random(low, high):
  return 4

To move your cursor to the literal text matching a selector name, rather than the selector itself, you can say go to phrase. For instance, you might want to move your cursor to the literal word "parameter" rather than a parameter to a function, so you could say go to phrase parameter. This is similar to how escape works in add and insert commands.

Finally, you can move your cursor by speaking a direction: up,down,left, and right.

Editing Code

In this section, we'll take a look at voice commands you can use for editing existing code, like change, and delete, as well as more powerful refactoring commands.

Changing Code

The change command selects the nearest match to the cursor and replaces it with some text.

change <selector> to <code>

CommandCode
change argument to string background
set_color("foreground", "blue")
set_color("background", "blue")
change height to speed
def fly(height: int):
  pass
def fly(speed: int):
  pass
rename class to setup
class Install:
  pass
class Setup:
  pass

You can also copy, cut, and paste code.

CommandCode
copy next two words
all too well
cut to end of line
this is a long line of text
select previous word
shake it off
paste

Deleting Code

You can delete code with the delete command. Below are just some examples of delete commands—you can use any selector. All delete commands have the same form:

delete <selector>

CommandCode
delete line four
class Bird:
  def fly(self):
    // TODO
    return
delete lines three to four
class Bird:
  def fly(self):
    // TODO
    return
delete to end of word
class Bird:
  def fly(self):
    // TODO
    return

Refactoring Code

Serenade supports a variety of commands for refactoring code. All refactoring commands have the same form:

<operation> <selector>
CommandCode
comment function
# def random():
#  return 4
uncomment lines two to three
url = "serenade.ai"
// pages = 3
// download(url, pages)
indent line
y = f(x)
z = g(y)
    y = f(x)
z = g(y)
dedent line
    y = f(x)
z = g(y)
y = f(x)
z = g(y)
surround value with quotes
message = Hello world
message = "Hello world"
duplicate block
value++
print(value);
value++
print(value);
duplicate function
def initialize():
  buffer.reset()
def initialize():
  buffer.reset()
shift line down
first = "a";
second = "b";
second = "b";
first = "a";
move argument left
z = f(x, y)
z = f(y, x)
join five lines
list = [
  1,
  2,
  3
]
list = [1, 2, 3]

System Commands

Serenade doesn't just work for applications that have a native Serenade plugin—you can control any application with voice using Serenade. No matter what application you're using, you can use commands like system to insert text, press to press keys (to trigger shortcuts), and focus to switch apps.

Keyboard & Mouse

CommandDescription
press enterpress control tabpress command kPress a key combination
system gmail dot comType a string using keystrokes
run makerun npm testType a string and press enter
clickleft clickright clickTrigger a mouse click

Application Control

CommandDescription
pausestop listeningPause Serenade
repeatrepeat changeRepeat the last command matching some text
copyCopy to the clipboard
cutCut to the clipboard
pastePaste from the clipboard
new tabcreate tabCreate a new tab
close tabClose the active tab
first tabsecond tabtab onetab twoSwitch tabs
undoTrigger an undo
redoTrigger an redo
focus chromefocus slackBring an app to the foreground
launch atomlaunch discordLaunch an app
close terminalclose zoomClose an app

Editor Integrations

CommandDescription
saveSave the current file
style fileformatFormat the current file
open index dot jsOpen a file
add breakpointCreate a breakpoint
remove breakpointRemove a breakpoint
toggle breakpointToggle a breakpoint
start debuggingStart a debugger session
stop debuggingStop the current debugger session
step intostep outstep overMove the debugger step-by-step
continueContinue the debugger to the next breakpoint

Revision Box

Serenade uses a combination of plugins and OS-level accessibility APIs to manipulate text no matter what application you're using. However, some applications don't properly implement accessibility APIs, and so Serenade can't read their text fields. When you're using one of these applications, you can use Serenade's Revision Box to format your text. Inside of the Revision Box, all of Serenade's commands will work properly, and when you're done, Serenade can copy the text in the Revision Box back into the application you had focused.

The Revision Box will open automatically when Serenade can't read the current field (if enabled in settings). You can also say revision box to open the revision box yourself. Or, say edit to copy the current text field into the revision box.

When Revision Box is open, you can say close to close and and ts contents into the field you were editing. You can also say enter to also press enter after inserting (e.g., for sending a message) or copy to copy the text to the clipboard rather than inserting it.

For more information on customizing the behavior of the revision box, see the API docs

.
CommandDescription
revision boxOpen an empty revision box
editOpen a revision box with the current text field
copyClose the revision box and copy its contents to the clipboard
closeClose the revision box and paste its contents into the current text field
enterSame as close, but also press enter afterward

Command Modes

Serenade has a few different configurable modes to change how your voice commands are interpreted.

Command/Dictate Mode

Serenade's default mode is Command Mode. In this mode, if you say something that isn't a valid Serenade command, Serenade will show an x next to the command and won't do anything. To enable command mode, just say command mode.

Sometimes, like when dictating a longer block of text, you want Serenade to simply type out everything you're saying, rather than listen for other commands. Serenade's Dictate Mode does just that. To enable Dictate Mode, just say dictate mode, and then Serenade will type out everything you say, rather than listening for valid commands. Some commands, like undo, repeat, andstop listening, will also be presented as alternatives so you don't have to leave Dictate Mode to use them. To get back to normal mode, just say command mode.

Language Modes

By default, Serenade will auto-detect which programming language is being used based on your editor's filename or active language setting. Sometimes, you might want to override this behavior and specify which language Serenade should use. To do so, simply say python mode, javascript mode, and so on. To get re-enable auto-detection, say auto mode.

Symbols & Formatting

Serenade's speech-to-code engine handles many symbols and formatting details automatically, and you can also manually specify text styles and symbols.

Symbols List

When speaking any command, you can also include symbols. Here's a list of all of the symbols supported by Serenade:

TranscriptSymbolTranscriptSymbolTranscriptSymbol
plus+dash, minus-star, times*
slash, divided by/less than or equal to<=less than<
greater than or equal to>=greater than>not equal!=
double equal==triple equal===equal=
left shift<<right shift>>and&&
or||comma,colon:
dot, period.underscore_semicolon;
bang, exclam!question mark?tilde~
percent, mod%at@dollar$
right arrow->arrow->space
backslash\hash#caret^
ampersand&backtick`pipe|
left brace{right brace}left bracket[
right bracket]single quote'quote, double quote"

You can also enclose text in symbols like braces, brackets, and parens. Here's a list of all of the enclosure symbols supported by Serenade:

TranscriptSymbolTranscriptSymbol
braces{ }brackets[ ]
comparators, angle brackets< >quotes, string" "
single quotes' 'triple quotes""" """
of, parens( )underscores_ _
double underscores__ __

If you want to use the literal text representation of a symbol (e.g., the word dash rather than the - character, you can escape it by saying escape.

Below are just a few examples of commands using symbols—you can use any of the symbols above.

CommandCode
insert this dot get of key
this.get(key)
insert first equals array brackets zero
first = array[0]
insert escape plus
plus

Text Formatting

To specify camel case, underscores, and so on, you can specify a style in any insert, add, etc. command. Below is a list of text styles:

CommandDescription
lowercasesing song
camelsingSong
underscoressnakesing_song
pascalSingSong
all capsSING_SONG
dashessing-song
one wordsingsong

When writing code with add and insert, you can specify text styles:

CommandCode
add argument pascal some class
create(SomeClass)
insert camel my age equals snake your age plus one
myAge = your_age + 1

You can also style existing text by describing a style, followed by a selector to change:

CommandCode
capitalize foo
foo
Foo
camel case next two words
one two three
oneTwo three

Reference

This section has a few difference references that you can use as cheat sheets while learning Serenade.

Code Selectors

Code selectors can be used to describe a block of code you want to reference, like a function, argument, or class. You can use any of these selectors in commands like go to, delete, change, or any command that contains a selector.

The following selectors work for supported languages:

argument listargumentannotationassert
assignmentassignment valueassignment variableattribute
attribute valueattribute nameattribute textbody
breakcasecatchclass
close tagcommentcomment textcondition
constructorcontentcontinuedeclaration
decoratordictionaryelementelse if
elseentryenumexcept
exportextendsfieldfinally
forfunctiongeneratorif
importincludeinterfaceimplementation
keyword argumentkeyword parameterkeylambda
linelistmembermethod
mixinmodifiernamespaceobject
open tagparameter listparameter valueparameter
parentpropertyprototypereturn
return typereturn valuerulesetset
setterstatementstringstring text
structswitchtagthrow
traittupletrytype
withwith aliaswith itemwhile
valuevariable

Text Selectors

Text selectors can be used to describe a block of text you want to reference, independent of any programming language. You can use any of these selectors in commands like go to, delete, change, or any command that contains a selector.

The following selectors work in any file, regardless of whether or not Serenade supports the language:

allblockcharacter
fileletterline
numberphraseword

Selector Modifiers

Below is a list of common modifiers you can use with any selector above. Modifiers can also be combined (e.g., delete next two words).

CommandDescriptionExamples
next | previous
The next or previous instancenext functionprevious class
first | second | ...
The index in a listsecond parameterfirst word
one | two | ...
The index in a listline fiveargument two
start | end
The start or endstart of lineend of method
<number> <objects>
Multiple objects at oncethree wordsfour functions
X to Y
A range of instanceslines five to tenwords one to three
to start, to end
From the cursor to the start or endto end of next wordto previous line
<object> <name>
The object with the given namego to foo barfunction factorialclass dog
phrase
Escaped, literal textphrase function