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

mbarbin / fingerboard / 118

23 Dec 2025 10:30PM UTC coverage: 92.134% (-3.0%) from 95.087%
118

Pull #11

github

web-flow
Merge b17e74f06 into ccb9da732
Pull Request #11: Reduce deps

323 of 528 new or added lines in 29 files covered. (61.17%)

1 existing line in 1 file now uncovered.

3830 of 4157 relevant lines covered (92.13%)

20265.99 hits per line

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

52.94
/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

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

37
let check_deviation_exn ~interval ~acoustic_interval =
38
  let tempered_12_equivalent_in_cents =
984✔
39
    Acoustic_interval.equal_tempered_12 interval |> Acoustic_interval.to_cents
984✔
40
  in
41
  let in_cents = Acoustic_interval.to_cents acoustic_interval in
984✔
42
  let deviation = Float.abs (tempered_12_equivalent_in_cents -. in_cents) in
984✔
43
  match Float.compare deviation allowed_deviation_from_equal_tempered_12_in_cents with
984✔
NEW
44
  | Eq | Lt -> ()
×
NEW
45
  | Gt ->
×
46
    Code_error.raise
47
      "Deviation is out of allowed bounds."
48
      [ "interval", interval |> Interval.to_dyn
×
49
      ; "acoustic_interval", acoustic_interval |> Acoustic_interval.to_dyn
×
50
      ; "tempered_12_equivalent_in_cents", tempered_12_equivalent_in_cents |> Dyn.float
×
51
      ; "in_cents", in_cents |> Dyn.float
×
52
      ; "deviation", deviation |> Dyn.float
×
53
      ; ( "allowed_deviation_from_equal_tempered_12_in_cents"
54
        , allowed_deviation_from_equal_tempered_12_in_cents |> Dyn.float )
×
55
      ]
56
;;
57

58
let create_exn ~interval ~acoustic_interval =
59
  check_deviation_exn ~interval ~acoustic_interval;
984✔
60
  { interval; acoustic_interval }
61
;;
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