You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Julia package for the basics of ("Western") music theory.
6
-
(Currently) everything is based on semitones.
5
+
The goal of this package is to provide a Julian interface for representing
6
+
the objects and structures in ("Western") music theory (based on semitones).
7
7
8
8
## Contents
9
9
- Pitches with scientific notation, e.g. C4 for middle C
10
10
- Intervals
11
11
- Scales
12
-
- Chords
13
12
- Notes and rests with durations
13
+
- Chords
14
14
15
15
## Pitches
16
16
Pitch names are exported in the `MusicTheory.PitchNames` submodule.
17
17
18
18
Specifying just the name of a pitch gives a `PitchClass`, representing all notes of that
19
19
pitch, e.g.
20
-
```
20
+
```jl
21
21
julia> C♯
22
22
C♯
23
23
@@ -26,28 +26,28 @@ PitchClass
26
26
```
27
27
28
28
Indexing gives a pitch with a specific octave, e.g.
29
-
```
29
+
```jl
30
30
julia> C♯[4]
31
31
C♯₄
32
32
```
33
33
34
34
## Intervals
35
35
The `Interval` type computes the interval between two pitches:
36
-
```
36
+
```jl
37
37
julia>Interval(C[4], E[4])
38
38
Major 3rd
39
39
```
40
40
41
41
## Scales
42
42
General scales are supported; they are specified as a sequence of intervals dividing up an
43
43
octave, e.g.
44
-
```
44
+
```jl
45
45
julia>show(major_scale)
46
46
Interval[Major 2nd, Major 2nd, Minor 2nd, Major 2nd, Major 2nd, Major 2nd, Minor 2nd]
47
47
```
48
48
49
49
The `Scale` type is a standard Julia iterator over the scale:
50
-
```
50
+
```jl
51
51
julia> scale =Scale(C[4], major_scale)
52
52
Scale{Pitch}(C₄, Dict{PitchClass, Interval}(C => Major 2nd, E => Minor 2nd, B => Minor 2nd, F => Major 2nd, D => Major 2nd, G => Major 2nd, A => Major 2nd))
0 commit comments