Skip to content

Commit

Permalink
Fix typos in documentation markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
frostburn committed Jan 22, 2025
1 parent e8fedbc commit 053cd2e
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 29 deletions.
22 changes: 11 additions & 11 deletions documentation/advanced-dsl.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This document describes programming in the SonicWeave domain-specific language.
1. [If clause](#if-clause)
12. [If...else](#ifelse)
13. [Ternary expressions](#ternary-expressions)
1. [Vectorizing where...else](#vectorizing-whereelse)
1. [Vectorized where...else](#vectorizing-whereelse)
14. [Function declaration](#function-declaration)
1. [Calling functions](#calling-functions)
2. [Stdlib conventions](#stdlib-conventions)
Expand Down Expand Up @@ -153,7 +153,7 @@ assert(x == 4.5e);
Defer is useful for pushing implicit tempering and general housekeeping to the top of the source instead of having to dangle everything at the end while editing the scale.

## While
"While" loops repeat a statement until the test becames *falsy* e.g.
"While" loops repeat a statement until the test becomes *falsy* e.g.
```ocaml
let i = 5
while (--i) {
Expand Down Expand Up @@ -245,8 +245,8 @@ if (3/2 > 700.) {
### Ternary expressions
Conditional expressions look similar but work inline e.g. `3 if true else 5` evaluates to `3` while `3 if false else 5` evaluates to `5`.

#### Vectorizing where...else
Ternary expressions short-circuit i.e. only the test expression and the chosen result are ever evaluated. The vectorizing/broadcasting variant evaluates everything but works on arrays: `[1, 2] where [true false] else 10` evaluates to `[1, 10]`.
#### Vectorized where...else
Ternary expressions short-circuit i.e. only the test expression and the chosen result are ever evaluated. The vectorized/broadcasting variant evaluates everything but works on arrays: `[1, 2] where [true false] else 10` evaluates to `[1, 10]`.

## Function declaration
Functions are declared using the `riff` keyword followed by the name of the function followed by the parameters of the function.
Expand All @@ -255,7 +255,7 @@ riff subharmonics(start, end) {
return /end::start
}
```
Above the `return` statement is suprefluous. We could've left it out and let the result unroll out of the block.
Above the `return` statement is superfluous. We could've left it out and let the result unroll out of the block.

Default values for function parameters may be given using `param = value` syntax.

Expand Down Expand Up @@ -288,7 +288,7 @@ Some functions like `sort` and `reverse` have in-place variants (`sortInPlace` a
Functions can be defined inline using the arrow (`=>`). e.g. `const subharmonics = ((start, end) => retrovert(start::end))`.

## Throwing
To interupt execution you can throw a string message.
To interrupt execution you can throw a string message.
```ocaml
throw "Something wrong here!"
```
Expand Down Expand Up @@ -317,7 +317,7 @@ sort()
```
This first results in `$ = [3, 5, 7, 11, 13, 17]` which gets reduced to `$ = [3/2, 5/4, 7/4, 11/8, 13/8, 17/16]`. Adding the octave and sorting gives the final result `$ = [17/16, 5/4, 11/8, 3/2, 13/8, 7/4, 2]`.

Or the same with a oneliner `sort(primes(17) rdc 2)` demonstrating the utility of broadcasting and *ceiling reduction* in a context where the unison is implicit and coincides with repeated octaves.
Or the same with a one-liner `sort(primes(17) rdc 2)` demonstrating the utility of broadcasting and *ceiling reduction* in a context where the unison is implicit and coincides with repeated octaves.

## Stdlib
SonicWeave comes with batteries included.
Expand Down Expand Up @@ -410,7 +410,7 @@ Adding or subtracting a period from an interval doesn't change its quality so we
| Neutral sixth-and-a-halfth | `n6.5`, `P12 / 2` | `sqrt(3)` | `950.978` |
| Perfect seventh-and-a-halfth | `P7.5`, `m14 / 2` | `sqrt(32/9)` | `1098.045` |

Technically the term _semitone_ is a misnomer because the diatonic semitone `m2` doesn't split the tone `M2` in half with mathematical precission (and neither does the chromatic semitone `a1`). The the perfect sesquith `P1½` is the true semiwholetone `M2 / 2`.
Technically the term _semitone_ is a misnomer because the diatonic semitone `m2` doesn't split the tone `M2` in half with mathematical precision (and neither does the chromatic semitone `a1`). The the perfect sesquith `P1½` is the true semiwholetone `M2 / 2`.

The central intervals can be semiaugmented to reach other intervals in the √2.√3 subgroup e.g. `m6 / 2` = `(M6 + d1) / 2` = `n3½ + ½d1` = `m3.5` ~ `sqrt(128/81)`.

Expand Down Expand Up @@ -500,7 +500,7 @@ D♮4 "Octave-reduced doubled 5th"
F♮4 "Perfect 4th"
G♮4 "Perfect 5th"
δd4
εd4 "Otave-complemented split 4th"
εd4 "Octave-complemented split 4th"
B♭4 "Doubled 4th"
C♮5 "Octave"
```
Expand Down Expand Up @@ -561,7 +561,7 @@ Extra commas include extended Helmholtz-Ellis inflections and additional bridges
See [commas.md](https://github.com/xenharmonic-devs/sonic-weave/blob/main/documentation/commas.md).

### Non-standard pitch declaration
Pitch can be declared as a period of oscillation, but it's coearced to Hz to preserve the meaning of relative notation as ratios of frequencies.
Pitch can be declared as a period of oscillation, but it's coerced to Hz to preserve the meaning of relative notation as ratios of frequencies.

E.g. `C4 = 10ms` has the same effect as `C4 = 100 Hz`.

Expand All @@ -586,7 +586,7 @@ The limitation is that non-radical reals like `PI` are not supported in basis pr
## Implicit intrinsic calls
Associating two values like `3/2 "fif"` invokes intrinsic behavior between the interval `3/2` and the string `"fif"` resulting in an interval with the value 3/2 and the label "fif".

Semantics of the expression `left right` follow this matrix depending on the types of the operands. Booleans are converted to `0` or `1` and follow interval semantics. Question marks indicate undefined behavior. Exclamation marks indicate that previous behavior has been depracated.
Semantics of the expression `left right` follow this matrix depending on the types of the operands. Booleans are converted to `0` or `1` and follow interval semantics. Question marks indicate undefined behavior. Exclamation marks indicate that previous behavior has been deprecated.
| left↓ right→ | Niente | String | Color | Interval | Val | Basis | Function |
| ------------ | ------------- | ------------- | ------------- | -------------- | -------------- | ------------- | ------------- |
| **Niente** | ? | ? | ? | bleach | ? | ? | `right(left)` |
Expand Down
2 changes: 1 addition & 1 deletion documentation/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Enneatonic 5L 4s subset of 313edo used in Sevish's track Desert Island Rain
498.402556 Perfect 4th
701.597444 Perfect 5th
747.603834
950.798722 Otave-complemented split 4th
950.798722 Octave-complemented split 4th
996.805112 Doubled 4th
2 Octave
```
Expand Down
6 changes: 3 additions & 3 deletions documentation/dsl.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ A4 = 440 Hz = 9\12

The expression `440 Hz = 9\12` implicitly sets the reference frequency for 1/1 at around `261.626 Hz`. For now the `A4 = 440 Hz` part is just for show.

To get a taste of the powerful tempering features in SonicWeave we'll spell our scale using (absolute) FJS but add `12@` at the end to tell the runtime to interprete everything in 12-TET.
To get a taste of the powerful tempering features in SonicWeave we'll spell our scale using (absolute) FJS but add `12@` at the end to tell the runtime to interpret everything in 12-TET.

```ocaml
A4 = 440 Hz = 9\12
Expand Down Expand Up @@ -196,7 +196,7 @@ Relative FJS intervals can be especially confusing because they represent fracti

For the most part you cannot combine intervals across domains so `9/8 + M2` is not a valid operation. Use tildes (`~`) to always operate as if in the linear domain (meaning that, for example, `+` and `*` will always work as in maths). E.g. `9/8 ~* M2` is a valid expression and evaluates to `81/64` while `9/8 *~ M2` evaluates to `M3`. The direction of the "wing" determines which domain and formatting to prefer.

Conversely the minus operator `-` represent divisions of the underlying values in the logarithmic domain and the usual kind of subraction in the linear domain e.g. `1.2e - 0.1e` equals `1.1e` owing to decimal ratios inhabiting the linear domain.
Conversely the minus operator `-` represent divisions of the underlying values in the logarithmic domain and the usual kind of subtraction in the linear domain e.g. `1.2e - 0.1e` equals `1.1e` owing to decimal ratios inhabiting the linear domain.

### Breaking change compared to Scale Workshop 2

Expand Down Expand Up @@ -226,7 +226,7 @@ Let's spell out all the notes of 12-tone equal temperament with labels and the u
12\12 "C" white
```

Now a tool like Scale Workshop can show you the colors so that you can differentiatiate notes with accidentals from notes without.
Now a tool like Scale Workshop can show you the colors so that you can differentiate notes with accidentals from notes without.

Colors may be specified using
- [Keywords](https://www.w3.org/wiki/CSS/Properties/color/keywords) like `red`, `white` or `black`
Expand Down
8 changes: 4 additions & 4 deletions documentation/intermediate-dsl.md
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ Product between a matrix and a vector can be achieved by broadcasting `vdot` ove
| Vectorized logical OR | `vor` |
| Plain formatting | `al~` |

Binary operation is vectorized elementwise:
Binary operation is vectorized element-wise:

`[0, 1] vand [2, 3]` evaluates to `[0, 3]`.

Expand Down Expand Up @@ -726,7 +726,7 @@ The logarithmic rounding operator (`by`) measures closeness geometrically `dista

The non-ceiling a.k.a floor variants of modulo behave as they commonly do in mathematics where `x mod x` evaluates to `0` while the ceiling variants are more useful in a musical context.

Just as the clockface starts from 12 `12 modc 12` evaluates to `12`. The fact that `P1 modc P8` evaluates to `P8` and that the unison is implicit in SonicWeave environments like Scale Workshop means that the major pentatonic scale becomes a simple oneliner `sort([-1..3] * P5 modc P8)` evaluating to:
Just as the clock face starts from 12 `12 modc 12` evaluates to `12`. The fact that `P1 modc P8` evaluates to `P8` and that the unison is implicit in SonicWeave environments like Scale Workshop means that the major pentatonic scale becomes a simple one-liner `sort([-1..3] * P5 modc P8)` evaluating to:
```ocaml
M2
P4
Expand Down Expand Up @@ -788,7 +788,7 @@ The dot product is meaningful only between a val and an interval and the operand

Beware that the dot product between cologarithmic quantities is unweighted. The value of `5@ ~dot 7@` depends on the default number of components in the runtime. When restricted to a prime limit like 5 here the result is well-defined `[email protected] ~dot [email protected]` is the same as `<5 8 12] ~· <7 11 16]` and evaluates to `5*7 + 8*11 + 12*16` or `315`.

Explicit tempering is basically the dot product multipled with one step of the equal temperament associated with the val if we ignore the [technicalities](https://github.com/xenharmonic-devs/sonic-weave/blob/main/documentation/tempering.md).
Explicit tempering is basically the dot product multiplied with one step of the equal temperament associated with the val if we ignore the [technicalities](https://github.com/xenharmonic-devs/sonic-weave/blob/main/documentation/tempering.md).

The zero val `<0 0 0]`, `0@` or `0[]@` stands in for the trivial rank-0 temperament that maps everything to the unison 1/1.

Expand Down Expand Up @@ -1099,7 +1099,7 @@ J_5 (* 13\13 *)

The accidental `&` (read "am") raises pitch by `L - s` while its opposite `@` (read "at") correspondingly lowers pitch by the same amount.

The accidental `e` (read "semiam") raises pitch by a half *am* while `a` (read "semiat") corresponingly lowest pitch by a half *at*.
The accidental `e` (read "semiam") raises pitch by a half *am* while `a` (read "semiat") correspondingly lowest pitch by a half *at*.

### Auto-MOS
The easiest way to generate Diamond-mos notation for one equave is to call the `automos()` helper.
Expand Down
4 changes: 2 additions & 2 deletions documentation/tag.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ This document describes the `sw` and `swr` tags used for writing SonicWeave insi


# Table of Contents
1. [Basic eample](#basic-example)
1. [Basic example](#basic-example)
2. [Raison d'être](#raison-dêtre)
3. [The sw tag](#the-sw-tag)
4. [The swr tag](#the-swr-tag)
Expand All @@ -21,7 +21,7 @@ console.log(myOctave.totalCents()); // 1200
```

## Raison d'être
Constructing intervals using the [JavaScript API](https://github.com/xenharmonic-devs/sonic-weave/blob/main/documentation/package.md) is somewhat tedious so you can use [SonicWeave DSL](https://github.com/xenharmonic-devs/sonic-weave/blob/main/documentation/dsl.md) instead when writing JS scripts for generating and analysing microtonal scales.
Constructing intervals using the [JavaScript API](https://github.com/xenharmonic-devs/sonic-weave/blob/main/documentation/package.md) is somewhat tedious so you can use [SonicWeave DSL](https://github.com/xenharmonic-devs/sonic-weave/blob/main/documentation/dsl.md) instead when writing JS scripts for generating and analyzing microtonal scales.

## The sw tag
The `sw` tag evaluates escapes such as `\n` for a newline inside the tag:
Expand Down
4 changes: 2 additions & 2 deletions documentation/technical.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ This documentation describes the SonicWeave DSL as it relates to other programmi

# Table of Contents
1. [Purpose](#purpose)
1. [Other pitfals](#other-pitfals)
1. [Other pitfalls](#other-pitfalls)
2. [Type system](#type-system)
3. [Operator precedence](#operator-precedence)
4. [Control flow](#control-flow)
Expand All @@ -27,7 +27,7 @@ This documentation describes the SonicWeave DSL as it relates to other programmi
## Purpose
SonicWeave is designed for notating microtonal scales as an extension of Scala .scl syntax. Programming is secondary so you'll have to dodge around reserved patterns such as `C4` which look like identifiers but correspond to musical literals.

### Other pitfals
### Other pitfalls
Fraction slash `/` binds stronger than exponentiation. Use `÷` or `%` if you need division that follows [PEMDAS](https://en.wikipedia.org/wiki/Order_of_operations).

The exponent is required in decimal literals. `1.23e0` instead of `1.23` which is instead interpreted a musical interval 1.23 cents wide.
Expand Down
10 changes: 5 additions & 5 deletions documentation/tempering.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ An alternative to `i => i str(i)` is `vstr($)` which produces an array of string
Now we can more easily remember that `7\12` corresponds to `3/2` in this temperament when playing the scale in a tool like Scale Workshop.

### Rank-2 temperaments
Rank-2 temperaments have two independent intervals that completely define everything available in a specific tuning that supports the temperament. Xenharmonic Wiki lists many such temperamentes. For example the details for [meantone](https://en.xen.wiki/w/Meantone_family#Meantone) tell us that the intervals for a CTE tuning are ~2 = 1\1, ~3/2 = 697.2143, in other words `2/1` spanning a whole octave `1\1` and `3/2` that's tuned a little flat of pure. We also learn that `81` is a suitable equal temperament from the associated optimal ET sequence.
Rank-2 temperaments have two independent intervals that completely define everything available in a specific tuning that supports the temperament. Xenharmonic Wiki lists many such temperaments. For example the details for [meantone](https://en.xen.wiki/w/Meantone_family#Meantone) tell us that the intervals for a CTE tuning are ~2 = 1\1, ~3/2 = 697.2143, in other words `2/1` spanning a whole octave `1\1` and `3/2` that's tuned a little flat of pure. We also learn that `81` is a suitable equal temperament from the associated optimal ET sequence.

We can generate a preimage using the `rank2` helper function and temper to 81-tone equal.
```ocaml
Expand Down Expand Up @@ -227,7 +227,7 @@ Defines a co-vector `v` such that `v dot (1 Hz)` evaluates to `2`, `v dot 9/7` e

All vals have an implicit `1` as the ``'s component and this cannot be changed.

Basis elements such as `0`, `-1` or `inf` don't map one-to-one so the dot product is undefined and thus these are not legal val basis elements even though with monzos they're prefectly reasonable. `rc` is also an illegal basis element due to real numbers being too dense to separate into unique prime factors.
Basis elements such as `0`, `-1` or `inf` don't map one-to-one so the dot product is undefined and thus these are not legal val basis elements even though with monzos they're perfectly reasonable. `rc` is also an illegal basis element due to real numbers being too dense to separate into unique prime factors.

### Warts shorthand notation
A val like `12@` is written in [Warts shorthand](https://en.xen.wiki/w/Val#Shorthand_notation). It could be written as `12p@` too to underline the fact that it's the patent val i.e. all prime harmonics are mapped to their closest approximations within the equal temperament.
Expand Down Expand Up @@ -447,7 +447,7 @@ defer cents(£, 3)
const sengic = commaList(686/675)
defer sengic
(* Obtain the canonical mapping generators and re-interprete monzos in this basis. *)
(* Obtain the canonical mapping generators and re-interpret monzos in this basis. *)
const M = mappingBasis(sengic)
defer @M
Expand Down Expand Up @@ -582,10 +582,10 @@ By default co-vectors are associated with the octave so the basis of the co-loga
if spelled out in full.

### Val-monzo dot product
The dot product between a val and a monzo is straighforward enough: `<12 19 28] dot [-3 1 1>` evaluates to `12*(-3) + 19*1 + 28*1` or `11` in total.
The dot product between a val and a monzo is straightforward enough: `<12 19 28] dot [-3 1 1>` evaluates to `12*(-3) + 19*1 + 28*1` or `11` in total.

### Tempering operator
The association with an equave is important in tempering to know which equal temperament we're targetting. The `tmpr` operator infers the number of divisions from `val dot basisOf(val)[0]`. It's also more graceful with a higher prime tail and leaves it alone.
The association with an equave is important in tempering to know which equal temperament we're targeting. The `tmpr` operator infers the number of divisions from `val dot basisOf(val)[0]`. It's also more graceful with a higher prime tail and leaves it alone.

The operation `v tmpr m` is equivalent to:
```ocaml
Expand Down
2 changes: 1 addition & 1 deletion examples/barbados9.sw
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ D♮4 "Octave-reduced doubled 5th"
F4 "Perfect 4th"
G4 "Perfect 5th"
δd4
εd4 "Otave-complemented split 4th"
εd4 "Octave-complemented split 4th"
B4 "Doubled 4th"
C5 "Octave"

0 comments on commit 053cd2e

Please sign in to comment.