---
title: Tonal Functions
layout: ../../layouts/MainLayout.astro
---
import { MiniRepl } from '../../docs/MiniRepl';
import { JsDoc } from '../../docs/JsDoc';
# Tonal Functions
These functions use [tonaljs](https://github.com/tonaljs/tonal) to provide helpers for musical operations.
### voicing()
### scale(name)
### transpose(semitones)
Transposes all notes to the given number of semitones:
".slow(2)).note()`} />
This method gets really exciting when we use it with a pattern as above.
Instead of numbers, scientific interval notation can be used as well:
".slow(2)).note()`} />
### scaleTranspose(steps)
Transposes notes inside the scale by the number of steps:
")
.note()`}
/>
### voicings(range?)
Turns chord symbols into voicings, using the smoothest voice leading possible:
".voicings('lefthand'), "").note()`} />
### rootNotes(octave = 2)
Turns chord symbols into root notes of chords in given octave.
".rootNotes(3).note()`} />
Together with layer, struct and voicings, this can be used to create a basic backing track:
".layer(
x => x.voicings('lefthand').struct("~ x").note(),
x => x.rootNotes(2).note().s('sawtooth').cutoff(800)
)`}
/>
So far, we've stayed within the browser. [MIDI and OSC](/learn/input-output) are ways to break out of it.