• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mbarbin / fingerboard / 113

23 Dec 2025 04:24PM UTC coverage: 95.592% (-0.7%) from 96.328%
113

Pull #9

github

web-flow
Merge f4a989aa2 into 8bac1be2d
Pull Request #9: Prepare printer refactor

677 of 709 new or added lines in 47 files covered. (95.49%)

18 existing lines in 3 files now uncovered.

3708 of 3879 relevant lines covered (95.59%)

18858.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.82
/src/characterized_interval.ml
1
(**********************************************************************************)
2
(*  Fingerboard - a microtonal geography of the cello fingerboard                 *)
3
(*  Copyright (C) 2022-2024 Mathieu Barbin <mathieu.barbin@gmail.com>             *)
4
(*                                                                                *)
5
(*  This file is part of Fingerboard.                                             *)
6
(*                                                                                *)
7
(*  Fingerboard is free software: you can redistribute it and/or modify it under  *)
8
(*  the terms of the GNU Affero General Public License as published by the Free   *)
9
(*  Software Foundation, either version 3 of the License, or any later version.   *)
10
(*                                                                                *)
11
(*  Fingerboard is distributed in the hope that it will be useful, but WITHOUT    *)
12
(*  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or         *)
13
(*  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License   *)
14
(*  for more details.                                                             *)
15
(*                                                                                *)
16
(*  You should have received a copy of the GNU Affero General Public License      *)
17
(*  along with Fingerboard. If not, see <https://www.gnu.org/licenses/>.          *)
18
(**********************************************************************************)
19

20
type t =
21
  { interval : Interval.t
22
  ; acoustic_interval : Acoustic_interval.t
23
  }
24

25
let to_dyn { interval; acoustic_interval } =
26
  Dyn.record
46✔
27
    [ "interval", interval |> Interval.to_dyn
46✔
28
    ; "acoustic_interval", acoustic_interval |> Acoustic_interval.to_dyn
46✔
29
    ]
30
;;
31

NEW
32
let sexp_of_t t = Dyn.to_sexp (to_dyn t)
×
33

34
let allowed_deviation_from_equal_tempered_12_in_cents =
35
  (* This is just a place holder for now, to be refined as needed. *)
36
  30.
37
;;
38

39
let check_deviation_exn ~interval ~acoustic_interval =
40
  let tempered_12_equivalent_in_cents =
984✔
41
    Acoustic_interval.equal_tempered_12 interval |> Acoustic_interval.to_cents
984✔
42
  in
43
  let in_cents = Acoustic_interval.to_cents acoustic_interval in
984✔
44
  let deviation = Float.abs (tempered_12_equivalent_in_cents -. in_cents) in
984✔
45
  if Float.compare deviation allowed_deviation_from_equal_tempered_12_in_cents > 0
984✔
46
  then
47
    raise_s
×
48
      [%sexp
49
        "Deviation is out of allowed bounds"
50
      , [%here]
51
      , { interval : Interval.t
52
        ; acoustic_interval : Acoustic_interval.t
53
        ; tempered_12_equivalent_in_cents : Float.t
54
        ; in_cents : Float.t
55
        ; deviation : Float.t
56
        ; allowed_deviation_from_equal_tempered_12_in_cents : Float.t
57
        }]
58
;;
59

60
let create_exn ~interval ~acoustic_interval =
61
  check_deviation_exn ~interval ~acoustic_interval;
984✔
62
  { interval; acoustic_interval }
63
;;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc