-
Notifications
You must be signed in to change notification settings - Fork 0
/
note.clj
68 lines (52 loc) · 1.21 KB
/
note.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
(ns tonal.note
"https://github.com/tonaljs/tonal/tree/master/packages/note"
(:require [tonal.interop :as interop]))
(def ^:private members
[:midi
:freq
:accidentals
:transpose
:pitchClass
:octave
:chroma
:fromMidi
:fromMidiSharps
:transposeFrom
:transposeFifths
:names
:sortedNames
:simplify
:enharmonic])
(def ^:private api
(delay
(interop/import (interop/Tonal) :Note members)))
(defn- execute [path & args]
(apply interop/execute @api path args))
(defn midi
[note]
(execute [:midi] note))
(defn freq
[note]
(execute [:freq] note))
(defn accidentials [note]
(execute [:accidentals] note))
(defn transpose [note]
(execute [:transpose] note))
(defn pitch-class [note]
(execute [:pitch-class] note))
(defn from-midi [note]
(execute [:fromMidi] note))
(defn from-midi-sharps [note]
(execute [:fromMidiSharps] note))
(defn transpose-from [note]
(execute [:transposeFrom] note))
(defn transpose-fifths [note]
(execute [:transposeFifths] note))
(defn names [xs]
(execute [:names] xs))
(defn sorted-names [xs]
(execute [:sortedNames] xs))
(defn simplify [note]
(execute [:simplify] note))
(defn enharmonic [note]
(execute [:enharmonic] note))