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.

Installing

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.

By default, Serenade uses a cloud-based speech-to-code system. To run Serenade entirely on your device, so no data leaves your computer, check out Serenade Pro.

Using Serenade

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.

Serenade 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

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.

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.

Insert

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 worldhello world
insert above oneone two

Add

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 factorialdef factorial() -> int: pass
add class pageclass Page: pass
add return say of string helloreturn say("hello")
add else if x less than threeif x > 3: return elif x < 3: pass
add import numpy as npimport numpy as np
add argument word brackets zerocapitalize(word[0])
add comment fix later# fix later
add decorator app dot route@app.route def index(): pass
add enum colorsclass Colors(enum.Enum): pass
add if not errorif (!error) { }
add callback equals lambda ecallback = lambda e: pass
add str method nameclass Person: def name(self) -> str: pass
add property radius equals three point fiveclass Circle: radius = 3.5
add while i not equal zerowhile 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 textsimple text

Editing Code

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

Deleting

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 fourclass Bird: def fly(self): // TODO return
delete lines three to fourclass Bird: def fly(self): // TODO return
delete to end of wordclass Bird: def fly(self): // TODO return

Changing

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 backgroundset_color("foreground", "blue")set_color("background", "blue")
change height to speeddef fly(height: int): passdef fly(speed: int): pass
rename class to setupclass Install: passclass Setup: pass

You can also copy, cut, and paste code.

CommandCode
copy next two wordsall too well
cut to end of linethis is a long line of text
select previous wordshake it off
paste

Refactoring

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 threeurl = "https://serenade.ai" // pages = 3 // download(url, pages)
indent liney = 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)
duplicate blockvalue++ print(value); value++ print(value);
duplicate functiondef initialize(): buffer.reset() def initialize(): buffer.reset()
shift line downfirst = "a"; second = "b";second = "b"; first = "a";
move argument leftz = f(x, y)z = f(y, x)
join five lineslist = [ 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 the last command
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

Dictation 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, Serenade will open a dedicated Dication Box, where all Serenade commands will work properly.

The Dictation Box will open automatically when Serenade can't read the current field. You can also say dictation box to open the dictation box yourself. Or, say edit to copy the current text field into the dictation box.

When Dictation 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.

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

Symbols & Formatting

Serenade's machine learning handles many symbols and formatting details automatically, but you can also manually specify text styles and symbols.

Formatting Text

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:

FormattingResult
lowercasesing song
camelsingSong
pascalSingSong
all capsSING_SONG
underscoressing_song
snakesing_song
one wordsingsong

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

CommandCode
add argument pascal some classcreate(SomeClass)
insert camel my age equals snake your age plus onemyAge = your_age + 1

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

CommandCode
capitalize foofooFoo
camel case next two wordsone two threeoneTwo three

Symbols

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 keythis.get(key)
insert first equals array brackets zerofirst = array[0]
insert escape plusplus

Tips and Tricks

  • Instead of worrying about spacing while writing code, use style file once your code is in a reasonable state, and Serenade will automatically format the entire file.
  • Long insert or add commands can be less accurate than shorter commands. If you're seeing low accuracy, try breaking up longer commands into smaller, separate commands.
  • The insert and add commands are similar, but have distinct use cases—add works best for writing new lines of code, including larger constructs like functions or classes, while insert works best for inserting or appending text to an existing line.
  • Use copy/cut, paste, and go to liberally in order to more quickly move code around.
  • Make sure your system's microphone volume is set to the right level. We've found that around 80%, to make sure the input isn't too loud or too quiet, works best, but try moving it around if Serenade's results aren't accurate.
  • When using Serenade, try to speak conversationally, as though you were pair programming with someone seated next to you. Over-enunciating words can actually make Serenade less accurate!
  • If Serenade doesn't know a word, like numpy, you can spell it in a command, as with add import n u m p y.

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 listargumentassertassignment
assignment valueassignment variableattributeattribute value
attribute nameattribute textbodybreak
callcasecatchclass
close tagcommentcomment textcondition
constructorcontentcontinuedebugger
declarationdecoratordefaultdictionary
do whileelementelse ifelse
enumexceptexportfor
finallyfunctiongeneratorgetter
ifimportinterfaceinterface list
keyword argumentkeyword parameterkeyentry
lambdalistmethodmixin
modifiermodifier listnamenamed parameter
named parameter listnamespaceobjectopen tag
operatorparameter listparameter valueparameter
parent listparentpasspositional parameter
positional parameter listpropertyprototypereturn
return typereturn valuerulesetset
setterstatementstringstring text
structswitchsymbolsynchronized
tagthrowtop level statementtuple
trytypetype aliasusing
withwith listwith aliaswith item
whilevaluevertical

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:

allblock
characterfile
letterline
numberphrase
termword

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