Skip to content

Commit

Permalink
Remove duplicated tables
Browse files Browse the repository at this point in the history
- They have been moved and regrouped to [edos.ml].
  • Loading branch information
mbarbin committed Apr 9, 2024
1 parent 980acea commit da62a1e
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 563 deletions.
138 changes: 0 additions & 138 deletions systems/cello/e19/e19.ml
Original file line number Diff line number Diff line change
Expand Up @@ -113,141 +113,3 @@ let%expect_test "tables" =
│ d8-e19-2353756-19edo │
└──────────┴───────┴───────────┘ |}]
;;

let%expect_test "approximating just intervals" =
let module Kind = struct
type t =
| Exact
| E19
| E53
| Equal_temperament
[@@deriving enumerate, sexp_of]
end
in
let module Row = struct
type t =
| Octave
| Just_major_sixth
| Just_minor_sixth
| Fifth
| Fourth
| Just_major_third
| Just_minor_third
| Pythagorean_major_second
| Pythagorean_diatonic_semiton
| Pythagorean_chromatic_semiton
| Just_diatonic_semiton
[@@deriving enumerate, sexp_of]
end
in
let acoustic_interval (interval : Row.t) (kind : Kind.t) =
match (kind : Kind.t) with
| Exact ->
(match interval with
| Octave -> Acoustic_interval.octave
| Just_major_sixth -> Acoustic_interval.just_major_sixth
| Just_minor_sixth -> Acoustic_interval.just_minor_sixth
| Fifth ->
Acoustic_interval.pythagorean
{ number = Fifth; quality = Perfect; additional_octaves = 0 }
| Fourth ->
Acoustic_interval.pythagorean
{ number = Fourth; quality = Perfect; additional_octaves = 0 }
| Just_major_third -> Acoustic_interval.just_major_third
| Just_minor_third -> Acoustic_interval.just_minor_third
| Pythagorean_major_second ->
Acoustic_interval.pythagorean
{ number = Second; quality = Major; additional_octaves = 0 }
| Pythagorean_diatonic_semiton -> Acoustic_interval.pythagorean_diatonic_semiton
| Pythagorean_chromatic_semiton -> Acoustic_interval.pythagorean_chromatic_semiton
| Just_diatonic_semiton -> Acoustic_interval.just_diatonic_semiton)
| Equal_temperament ->
let number_of_divisions =
match interval with
| Octave -> 12
| Just_major_sixth -> 9
| Just_minor_sixth -> 8
| Fifth -> 7
| Fourth -> 5
| Just_major_third -> 4
| Just_minor_third -> 3
| Pythagorean_major_second -> 2
| Pythagorean_diatonic_semiton
| Pythagorean_chromatic_semiton
| Just_diatonic_semiton -> 1
in
Acoustic_interval.equal_division_of_the_octave ~divisor:12 ~number_of_divisions
| E19 ->
let number_of_divisions =
match interval with
| Octave -> 19
| Just_major_sixth -> 41
| Just_minor_sixth -> 37
| Fifth -> 32
| Fourth -> 23
| Just_major_third -> 18
| Just_minor_third -> 14
| Pythagorean_major_second -> 9
| Pythagorean_diatonic_semiton -> 4
| Pythagorean_chromatic_semiton -> 5
| Just_diatonic_semiton -> 5
in
Acoustic_interval.equal_division_of_the_octave ~divisor:19 ~number_of_divisions
| E53 ->
let number_of_divisions =
match interval with
| Octave -> 53
| Just_major_sixth -> 39
| Just_minor_sixth -> 36
| Fifth -> 19
| Fourth -> 22
| Just_major_third -> 17
| Just_minor_third -> 14
| Pythagorean_major_second -> 9
| Pythagorean_diatonic_semiton -> 4
| Pythagorean_chromatic_semiton -> 5
| Just_diatonic_semiton -> 5
in
Acoustic_interval.equal_division_of_the_octave ~divisor:53 ~number_of_divisions
in
let columns =
let cents_column kind =
Ascii_table.Column.create_attr
~align:Right
(Sexp.to_string [%sexp (kind : Kind.t)])
(fun (t : Row.t) ->
acoustic_interval t kind
|> Acoustic_interval.to_cents
|> Float.iround_exn ~dir:`Nearest
|> Int.to_string
|> fun i -> [], i)
in
Ascii_table.Column.(
[ [ create_attr "Interval" (fun (t : Row.t) ->
( []
, Sexp.to_string_hum [%sexp (t : Row.t)]
|> String.substr_replace_all ~pattern:"_" ~with_:" " ))
]
; List.map Kind.all ~f:cents_column
]
|> List.concat)
in
Ascii_table.to_string columns Row.all |> print_endline;
[%expect
{|
┌───────────────────────────────┬───────┬──────┬──────┬───────────────────┐
IntervalExactE19E53Equal_temperament
├───────────────────────────────┼───────┼──────┼──────┼───────────────────┤
Octave1200120012001200
Just major sixth │ 8842589883900
Just minor sixth │ 8142337815800
Fifth7022021430700
Fourth4981453498500
Just major third │ 3861137385400
Just minor third │ 316884317300
Pythagorean major second │ 204568204200
Pythagorean diatonic semiton │ 9025391100
Pythagorean chromatic semiton │ 114316113100
Just diatonic semiton │ 112316113100
└───────────────────────────────┴───────┴──────┴──────┴───────────────────┘ |}]
;;
138 changes: 0 additions & 138 deletions systems/cello/e31/e31.ml
Original file line number Diff line number Diff line change
Expand Up @@ -119,141 +119,3 @@ let%expect_test "tables" =
│ d8-e31-2352391-31edo │
└──────────┴───────┴───────────┘ |}]
;;

let%expect_test "approximating just intervals" =
let module Kind = struct
type t =
| Exact
| E31
| E53
| Equal_temperament
[@@deriving enumerate, sexp_of]
end
in
let module Row = struct
type t =
| Octave
| Just_major_sixth
| Just_minor_sixth
| Fifth
| Fourth
| Just_major_third
| Just_minor_third
| Pythagorean_major_second
| Pythagorean_diatonic_semiton
| Pythagorean_chromatic_semiton
| Just_diatonic_semiton
[@@deriving enumerate, sexp_of]
end
in
let acoustic_interval (interval : Row.t) (kind : Kind.t) =
match (kind : Kind.t) with
| Exact ->
(match interval with
| Octave -> Acoustic_interval.octave
| Just_major_sixth -> Acoustic_interval.just_major_sixth
| Just_minor_sixth -> Acoustic_interval.just_minor_sixth
| Fifth ->
Acoustic_interval.pythagorean
{ number = Fifth; quality = Perfect; additional_octaves = 0 }
| Fourth ->
Acoustic_interval.pythagorean
{ number = Fourth; quality = Perfect; additional_octaves = 0 }
| Just_major_third -> Acoustic_interval.just_major_third
| Just_minor_third -> Acoustic_interval.just_minor_third
| Pythagorean_major_second ->
Acoustic_interval.pythagorean
{ number = Second; quality = Major; additional_octaves = 0 }
| Pythagorean_diatonic_semiton -> Acoustic_interval.pythagorean_diatonic_semiton
| Pythagorean_chromatic_semiton -> Acoustic_interval.pythagorean_chromatic_semiton
| Just_diatonic_semiton -> Acoustic_interval.just_diatonic_semiton)
| Equal_temperament ->
let number_of_divisions =
match interval with
| Octave -> 12
| Just_major_sixth -> 9
| Just_minor_sixth -> 8
| Fifth -> 7
| Fourth -> 5
| Just_major_third -> 4
| Just_minor_third -> 3
| Pythagorean_major_second -> 2
| Pythagorean_diatonic_semiton
| Pythagorean_chromatic_semiton
| Just_diatonic_semiton -> 1
in
Acoustic_interval.equal_division_of_the_octave ~divisor:12 ~number_of_divisions
| E31 ->
let number_of_divisions =
match interval with
| Octave -> 31
| Just_major_sixth -> 41
| Just_minor_sixth -> 37
| Fifth -> 32
| Fourth -> 23
| Just_major_third -> 18
| Just_minor_third -> 14
| Pythagorean_major_second -> 9
| Pythagorean_diatonic_semiton -> 4
| Pythagorean_chromatic_semiton -> 5
| Just_diatonic_semiton -> 5
in
Acoustic_interval.equal_division_of_the_octave ~divisor:31 ~number_of_divisions
| E53 ->
let number_of_divisions =
match interval with
| Octave -> 53
| Just_major_sixth -> 39
| Just_minor_sixth -> 36
| Fifth -> 31
| Fourth -> 22
| Just_major_third -> 17
| Just_minor_third -> 14
| Pythagorean_major_second -> 9
| Pythagorean_diatonic_semiton -> 4
| Pythagorean_chromatic_semiton -> 5
| Just_diatonic_semiton -> 5
in
Acoustic_interval.equal_division_of_the_octave ~divisor:53 ~number_of_divisions
in
let columns =
let cents_column kind =
Ascii_table.Column.create_attr
~align:Right
(Sexp.to_string [%sexp (kind : Kind.t)])
(fun (t : Row.t) ->
acoustic_interval t kind
|> Acoustic_interval.to_cents
|> Float.iround_exn ~dir:`Nearest
|> Int.to_string
|> fun i -> [], i)
in
Ascii_table.Column.(
[ [ create_attr "Interval" (fun (t : Row.t) ->
( []
, Sexp.to_string_hum [%sexp (t : Row.t)]
|> String.substr_replace_all ~pattern:"_" ~with_:" " ))
]
; List.map Kind.all ~f:cents_column
]
|> List.concat)
in
Ascii_table.to_string columns Row.all |> print_endline;
[%expect
{|
┌───────────────────────────────┬───────┬──────┬──────┬───────────────────┐
IntervalExactE31E53Equal_temperament
├───────────────────────────────┼───────┼──────┼──────┼───────────────────┤
Octave1200120012001200
Just major sixth │ 8841587883900
Just minor sixth │ 8141432815800
Fifth7021239702700
Fourth498890498500
Just major third │ 386697385400
Just minor third │ 316542317300
Pythagorean major second │ 204348204200
Pythagorean diatonic semiton │ 9015591100
Pythagorean chromatic semiton │ 114194113100
Just diatonic semiton │ 112194113100
└───────────────────────────────┴───────┴──────┴──────┴───────────────────┘ |}]
;;
Loading

0 comments on commit da62a1e

Please sign in to comment.