diff options
| author | Sébastien Dailly <sebastien@chimrod.com> | 2021-08-27 17:20:59 +0200 | 
|---|---|---|
| committer | Sébastien Dailly <sebastien@chimrod.com> | 2021-08-27 17:20:59 +0200 | 
| commit | 26faec7a69051f639b50c8e8741f0823c6be52a2 (patch) | |
| tree | a610d0306bf3e0c84f7993be7c290965fcab1900 /src/lib/sounds | |
| parent | c8b49eed4cf92e7d2dd01dce779ef84ccae733eb (diff) | |
Managed diphtongues
Diffstat (limited to 'src/lib/sounds')
| -rw-r--r-- | src/lib/sounds/sounds.ml | 67 | 
1 files changed, 51 insertions, 16 deletions
| diff --git a/src/lib/sounds/sounds.ml b/src/lib/sounds/sounds.ml index a2035b7..6126dd4 100644 --- a/src/lib/sounds/sounds.ml +++ b/src/lib/sounds/sounds.ml @@ -3,15 +3,18 @@ module type T = sig    type t    val muted : t -> t -  val a : [`Closed | `Opened] -> t +  val a : t    val e : [`Closed | `Opened] -> t    val eu : [`Closed | `Opened] -> t    val o : [`Closed | `Opened] -> t    val schwa : unit -> t -  val i : [`Closed | `Opened] -> t +  val i : t    val u : t +  val u' : t +  (** Create a diphtongue from a semi-voyel and a voyel *) +  val diphtongue: t -> t -> t    val nasal: t -> t @@ -22,6 +25,7 @@ module type T = sig    val t: t    val d: t    val k: t +  val g: t    val f: t    val s: unit -> t    val sz: unit -> t @@ -43,7 +47,10 @@ module type T = sig      | None      | SZ      | Voyel_A +    | Voyel_I      | Voyel_O +    | SemiVoyel_W +    | Diphtonge of code * code    val code : t -> code @@ -58,7 +65,10 @@ module T = struct      | None      | SZ      | Voyel_A +    | Voyel_I      | Voyel_O +    | SemiVoyel_W +    | Diphtonge of code * code    type t =      { code : code @@ -79,7 +89,9 @@ module Repr = struct    and o_nasal = "§"    and i = "i" +  and i_nasal = "5"    and u = "y" +  and u' = "u"    and p = "p"    and b = "b" @@ -112,6 +124,7 @@ module S = struct    let is_voyel t = t.kind = Voyel    let is_nasal t = t.nasal +    let none =      { repr = ""      ; muted = false @@ -122,20 +135,17 @@ module S = struct    let voyel =      { none with kind = Voyel } -  let code t = t.code -  let nasal t = -    match t.code with -    | Voyel_A -> { t with repr = Repr.a_nasal ; nasal = true } -    | Voyel_O -> { t with repr = Repr.o_nasal ; nasal = true } -    | _ -> t +  let diphtongue v1 v2 = +    { voyel with +      repr = (v1.repr) ^ (v2.repr) +    ; code = Diphtonge (v1.code, v2.code) +    } -  let muted f = -    { none with -      repr = "(" ^ f.repr ^ ")" -    ; muted = true } -  let a _ = +  let code t = t.code + +  let a =      { voyel with repr = Repr.a ; code = Voyel_A }    let e = function @@ -153,12 +163,15 @@ module S = struct    let o _ =      { voyel with repr = Repr.o ; code = Voyel_O } -  let i _ = -    { voyel with repr = Repr.i } +  let i = +    { voyel with repr = Repr.i ; code = Voyel_I }    let u =      { voyel with repr = Repr.u } +  let u' = +    { voyel with repr = Repr.u' } +    let p =      { none with repr = Repr.p } @@ -174,6 +187,9 @@ module S = struct    let k =      { none with repr = Repr.k } +  let g = +    { none with repr = Repr.g } +    let f =      { none with repr = Repr.f } @@ -202,7 +218,26 @@ module S = struct      { none with repr = Repr.r }    let semi_voyel_w = -    { none with repr = Repr.w } +    { none with +      repr = Repr.w +    ; code = SemiVoyel_W} + +  let nasal t = +    match t.code with +    | Voyel_A -> { t with repr = Repr.a_nasal ; nasal = true } +    | Voyel_O -> { t with repr = Repr.o_nasal ; nasal = true } +    | Voyel_I -> { t with repr = Repr.i_nasal ; nasal = true } +    | Diphtonge (SemiVoyel_W, Voyel_A) -> +      diphtongue +        semi_voyel_w +        { t with repr = Repr.i_nasal ; nasal = true } +    | _ -> t + +  let muted f = +    { none with +      repr = "(" ^ f.repr ^ ")" +    ; muted = true } +  end  include S | 
