---
title: Notes
description: Strudel Tutorial - Notes
layout: ../../layouts/MainLayout.astro
---

import { MiniRepl } from '../../docs/MiniRepl';
import { JsDoc } from '../../docs/JsDoc';

# Notes

Pitches are an essential building block for music.
In Strudel, pitches can be expressed as note names, note numbers or frequencies.
Here's the same pattern written in three different ways:

- `note`: letter notation, good for those who are familiar with western music theory:

  <MiniRepl client:idle tune={`note("a3 c#4 e4 a4")`} />

- `note`: number notation, good for those who want to use recognisable pitches, but don't care about music theory:

  <MiniRepl client:idle tune={`note("57 61 64 69")`} />

- `freq`: frequency notation, good for those who want to go beyond standardised tuning systems:

  <MiniRepl client:idle tune={`freq("220 275 330 440")`} />

Let's look at those in more detail...

## `note` names

Notes names can be notated with the note letter, followed by the octave number. You can notate flats with `b` and sharps with `#`.

<MiniRepl client:idle tune={`note("a3 c#4 e4 a4")`} />

By the way, you can edit the contents of the player, and press "update" to hear your change!
You can also press "play" on the next player without needing to stop the last one.

## `note` numbers

If you prefer, you can also use numbers with `note` instead:

<MiniRepl client:idle tune={`note("57 61 64 69")`} />

These numbers are interpreted as so called [MIDI numbers](https://www.inspiredacoustics.com/en/MIDI_note_numbers_and_center_frequencies), where adjacent whole numbers are one 'semitone' apart.

You could also write decimal numbers to get 'microtonal' pitches (in between the black and white piano notes):

<MiniRepl client:idle tune={`note("74.5 75 75.5 76")`} />

## `freq`

To get maximum freedom, you can also use `freq` to directly control the frequency:

<MiniRepl client:idle tune={`freq("220 275 330 440")`} />

## Hearing and frequency

In the above example, we play A3 (220Hz), C#4 natural (275Hz), E4 (330Hz) and A4 (440Hz), mirroring our previous examples.

But can you hear the difference between these individual frequencies?

<MiniRepl client:idle tune={`freq("220 221 223 224")`} />

How about these?

<MiniRepl client:idle tune={`freq("2020 2021 2023 2024")`} />

The higher we go up...

<MiniRepl client:idle tune={`freq("5020 5021 5023 5024")`} />

The less distance we can hear between the frequencies!

<MiniRepl client:idle tune={`freq("10020 10021 10023 10024")`} />

Why is this? [Human hearing operates logarithmically](https://www.audiocheck.net/soundtests_nonlinear.php).

## From notes to sounds

In this page, when we played a pattern of notes like this:

<MiniRepl client:idle tune={`note("a3 c#4 e4 a4")`} />

We heard a simple synthesised sound, in fact we heard a [triangle wave oscillator](https://en.wikipedia.org/wiki/Triangle_wave).

This is the default synthesiser used by Strudel, but how do we then make different sounds in Strudel?

Let's find out in the next page on [Sounds](/learn/sounds).

<br />
