Skip to content

Commit

Permalink
Add edo-19 system
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbin committed Apr 9, 2024
1 parent b21fb7c commit 980acea
Show file tree
Hide file tree
Showing 16 changed files with 2,709 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/cello.ml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,57 @@ module Fingerboard_position_name = struct
;;
end

module Edo19 = struct
type t =
[ `A1_e19
| `m2_e19
| `M2_e19
| `A2_e19
| `m3_e19
| `M3_e19
| `A3_e19
| `P4_e19
| `A4_e19
| `d5_e19
| `P5_e19
| `A5_e19
| `m6_e19
| `M6_e19
| `d7_e19
| `m7_e19
| `M7_e19
| `d8_e19
]
[@@deriving compare, equal, enumerate, hash, sexp_of]

let sexp_of_t t = Sexp_to_string.position sexp_of_t t

let acoustic_interval_to_the_open_string (t : t) =
let number_of_divisions =
match (t : t) with
| `A1_e19 -> 1
| `m2_e19 -> 2
| `M2_e19 -> 3
| `A2_e19 -> 4
| `m3_e19 -> 5
| `M3_e19 -> 6
| `A3_e19 -> 7
| `P4_e19 -> 8
| `A4_e19 -> 9
| `d5_e19 -> 10
| `P5_e19 -> 11
| `A5_e19 -> 12
| `m6_e19 -> 13
| `M6_e19 -> 14
| `d7_e19 -> 15
| `m7_e19 -> 16
| `M7_e19 -> 17
| `d8_e19 -> 18
in
Acoustic_interval.equal_division_of_the_octave ~divisor:19 ~number_of_divisions
;;
end

module Edo31 = struct
type t =
[ `A1_e31
Expand Down Expand Up @@ -394,6 +445,7 @@ module Fingerboard_position_name = struct
type t =
[ `open_string
| Edo12.t
| Edo19.t
| Edo31.t
| Edo53.t
| Edo55.t
Expand All @@ -405,6 +457,7 @@ module Fingerboard_position_name = struct
let sexp_of_t : t -> Sexp.t = function
| `open_string -> Atom "0"
| #Edo12.t as t -> [%sexp (t : Edo12.t)]
| #Edo19.t as t -> [%sexp (t : Edo19.t)]
| #Edo31.t as t -> [%sexp (t : Edo31.t)]
| #Edo53.t as t -> [%sexp (t : Edo53.t)]
| #Edo55.t as t -> [%sexp (t : Edo55.t)]
Expand All @@ -415,6 +468,7 @@ module Fingerboard_position_name = struct
let acoustic_interval_to_the_open_string : t -> Acoustic_interval.t = function
| `open_string -> Acoustic_interval.unison
| #Edo12.t as t -> t |> Edo12.acoustic_interval_to_the_open_string
| #Edo19.t as t -> t |> Edo19.acoustic_interval_to_the_open_string
| #Edo31.t as t -> t |> Edo31.acoustic_interval_to_the_open_string
| #Edo53.t as t -> t |> Edo53.acoustic_interval_to_the_open_string
| #Edo55.t as t -> t |> Edo55.acoustic_interval_to_the_open_string
Expand Down
26 changes: 26 additions & 0 deletions src/cello.mli
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,31 @@ module Fingerboard_position_name : sig
include S with type t := t
end

module Edo19 : sig
type t =
[ `A1_e19
| `m2_e19
| `M2_e19
| `A2_e19
| `m3_e19
| `M3_e19
| `A3_e19
| `P4_e19
| `A4_e19
| `d5_e19
| `P5_e19
| `A5_e19
| `m6_e19
| `M6_e19
| `d7_e19
| `m7_e19
| `M7_e19
| `d8_e19
]

include S with type t := t
end

module Edo31 : sig
type t =
[ `A1_e31
Expand Down Expand Up @@ -185,6 +210,7 @@ module Fingerboard_position_name : sig
type t =
[ `open_string
| Edo12.t
| Edo19.t
| Edo31.t
| Edo53.t
| Edo55.t
Expand Down
13 changes: 13 additions & 0 deletions src/characterized_scale.ml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@ let major_e12 =
[ ton; ton; semiton; ton; ton; ton; semiton ]
;;

let major_e19 =
let second quality number_of_divisions =
let interval = { Interval.number = Second; quality; additional_octaves = 0 } in
Characterized_interval.create_exn
~interval
~acoustic_interval:
(Acoustic_interval.equal_division_of_the_octave ~divisor:19 ~number_of_divisions)
in
let ton = second Major 3 in
let semiton = second Minor 2 in
[ ton; ton; semiton; ton; ton; ton; semiton ]
;;

let major_e31 =
let second quality number_of_divisions =
let interval = { Interval.number = Second; quality; additional_octaves = 0 } in
Expand Down
1 change: 1 addition & 0 deletions src/characterized_scale.mli
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ val major_pythagorean : t
val major_just_e53 : t
val major_pythagorean_e53 : t
val major_e12 : t
val major_e19 : t
val major_e31 : t
val major_e55 : t
30 changes: 30 additions & 0 deletions systems/cello/e19/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
(library
(name fingerboard_cello_system_e19)
(flags
:standard
-w
+a-4-40-41-42-44-45-48-66
-warn-error
+a
-open
Base
-open
Expect_test_helpers
-open
Fingerboard)
(libraries base expect-test-helpers fingerboard textutils.ascii_table)
(inline_tests)
(instrumentation
(backend bisect_ppx))
(lint
(pps ppx_js_style -check-doc-comments))
(preprocess
(pps
ppx_compare
ppx_enumerate
ppx_expect
ppx_hash
ppx_here
ppx_let
ppx_sexp_conv
ppx_sexp_value)))
Loading

0 comments on commit 980acea

Please sign in to comment.