MIDI files generator library written in Go programming language for any kind of musician. Chords and notes for your type of DAW, game or other project with permissive MIT license from Szymon & πΆ
WARNING! This library does not create sound itself, the goal of this library is to provide you with programmatical representation of musical tones that can be used extensively in music production using software digital audio workstations like Waveform Tracktion MuseScore.org//MuseScore's github or equipment capable of dealing with MIDI file input. For example, you could send files generated by Nutek to your synthesizer giving you free hands to do more music
After setting your environment for go development...
- Using command line terminal of your choice (Windows, Linux, macOS) create main project file (on macOS & Linux ->
mkdir Nutek && cd Nutek && \
go mod init midi.example.net && \
touch main.go
)
- While in your project folder install module with go get command
go get github.com/buahaha/Nutek
- and fill
main.go
file with example code:
package main
import (
"log"
"github.com/buahaha/Nutek"
)
func main() {
middleC, err := Nutek.StringToNote("middle c") // full set of available notes below
if err != nil {
log.Fatalf("can't convert string to note")
}
Nutek.OneNote(middleC, ".") // "." - use current folder, or specify your's
}
- Create your first MIDI file with single note spanning one whole bar
go run main.go
- This creates MIDI file, no sound, only raw data to be used in Digital Audio Workstation
Currently supported chord file generators (you can use any note you want to start with):
- Major
Nutek.MajorTriad(middleC, ".")
- Minor
Nutek.MinorTriad(middleC, ".")
- Diminished
Nutek.Diminished(middleC, ".")
- Augmented
Nutek.Augmented(middleC, ".")
- Suspended 2
Nutek.Sus2(middleC, ".")
- Suspended 4
Nutek.Sus4(middleC, ".")
- Major 7th
Nutek.Major7th(middleC, ".")
- Minor 7th
Nutek.Minor7th(middleC, ".")
- 6th
Nutek.Chord6th(middleC, ".")
- 7th
Nutek.Chord7th(middleC, ".")
- 7 Suspended 2
Nutek.Chord7Sus2(middleC, ".")
- 7 Suspended 4
Nutek.Chord7Sus4(middleC, ".")
- Minor 6th
Nutek.Minor6th(middleC, ".")
- Diminished 7
Nutek.Diminished7(middleC, ".")
- Augmented 7
Nutek.Augmented7(middleC, ".")
- Diminished 6
Nutek.Diminished7(middleC, ".")
The following table summarizes the MIDI note numbers as defined in the MIDI standard and matched to the Middle C (note number 60) as C4.
The formula connecting the MIDI note number and the base frequency - assuming equal tuning based on A4=a'=440 Hz - is:
f=440*math.Pow(2, (n-69)/12)
MIDI note number | Key number (Organ) | Key number (Piano) | Note names (English) | Note names (German) | Frequency (Equal tuning at 440 Hz) |
---|---|---|---|---|---|
top of MIDI tuning range | G#9/Ab9 | gisββββββ/gesββββββ | 13289.75 | ||
127 | G9 | gββββββ | 12543.85 | ||
126 | F#9/Gb9 | fisββββββ/gesββββββ | 11839.82 | ||
125 | F9 | fββββββ | 11175.30 | ||
124 | E9 | eββββββ | 10548.08 | ||
123 | D#9/Eb9 | disββββββ/esββββββ | 9956.06 | ||
122 | D9 | dββββββ | 9397.27 | ||
121 | C#9/Db9 | cisββββββ/desββββββ | 8869.84 | ||
120 | C9 | cββββββ | 8372.02 | ||
119 | B8 | hβββββ | 7902.13 | ||
118 | A#8/Bb8 | aisβββββ/bβββββ | 7458.62 | ||
117 | A8 | aβββββ | 7040.00 | ||
116 | G#8/Ab8 | gisβββββ/gesβββββ | 6644.88 | ||
115 | G8 | gβββββ | 6271.93 | ||
114 | F#8/Gb8 | fisβββββ/gesβββββ | 5919.91 | ||
113 | F8 | fβββββ | 5587.65 | ||
112 | E8 | eβββββ | 5274.04 | ||
111 | D#8/Eb8 | disβββββ/esβββββ | 4978.03 | ||
110 | D8 | dβββββ | 4698.64 | ||
109 | C#8/Db8 | cisβββββ/desβββββ | 4434.92 | ||
108 | 88 | C8 | cβββββ | 4186.01 | |
107 | 87 | B7 | hββββ | 3951.07 | |
106 | 86 | A#7/Bb7 | aisββββ/bββββ | 3729.31 | |
105 | 85 | A7 | aββββ | 3520.00 | |
104 | 84 | G#7/Ab7 | gisββββ/gesββββ | 3322.44 | |
103 | 83 | G7 | gββββ | 3135.96 | |
102 | 82 | F#7/Gb7 | fisββββ/gesββββ | 2959.96 | |
101 | 81 | F7 | fββββ | 2793.83 | |
100 | 80 | E7 | eββββ | 2637.02 | |
99 | 79 | D#7/Eb7 | disββββ/esββββ | 2489.02 | |
98 | 78 | D7 | dββββ | 2349.32 | |
97 | 77 | C#7/Db7 | cisββββ/desββββ | 2217.46 | |
96 | 61 | 76 | C7 | cββββ | 2093.00 |
95 | 60 | 75 | B6 | hβββ | |
94 | 59 | 74 | A#6/Bb6 | aisβββ/bβββ | 1864.66 |
93 | 58 | 73 | A6 | aβββ | 1760.00 |
92 | 57 | 72 | G#6/Ab6 | gisβββ/asβββ | 1661.22 |
91 | 56 | 71 | G6 | gβββ | 1567.98 |
90 | 55 | 70 | F#6/Gb6 | fisβββ/gesβββ | 1479.98 |
89 | 54 | 69 | F6 | fβββ | 1396.91 |
88 | 53 | 68 | E6 | eβββ | 1318.51 |
87 | 52 | 67 | D#6/Eb6 | disβββ/esβββ | 1244.51 |
86 | 51 | 66 | D6 | dβββ | 1174.66 |
85 | 50 | 65 | C#6/Db6 | cisβββ/desβββ | 1108.73 |
84 | 49 | 64 | C6 | cβββ | 1046.50 |
83 | 48 | 63 | B5 | hββ | 987.77 |
82 | 47 | 62 | A#5/Bb5 | aisββ/bββ | 932.33 |
81 | 46 | 61 | A5 | aββ | 880.00 |
80 | 45 | 60 | G#5/Ab5 | gisββ/asββ | 830.61 |
79 | 44 | 59 | G5 | gββ | 783.99 |
78 | 43 | 58 | F#5/Gb5 | fisββ/gesββ | 739.99 |
77 | 42 | 57 | F5 | fββ | 698.46 |
76 | 41 | 56 | E5 | eββ | 659.26 |
75 | 40 | 55 | D#5/Eb5 | disββ/esββ | 622.25 |
74 | 39 | 54 | D5 | dββ | 587.33 |
73 | 38 | 53 | C#5/Db5 | cisββ/desββ | 554.37 |
72 | 37 | 52 | C5 | cββ | 523.25 |
71 | 36 | 51 | B4 | hβ | 493.88 |
70 | 35 | 50 | A#4/Bb4 | aisβ/bβ | 466.16 |
69 | 34 | 49 | A4 concert pitch | aβ Kammerton | 440.00 |
68 | 33 | 48 | G#4/Ab4 | gisβ/asβ | 415.30 |
67 | 32 | 47 | G4 | gβ | 392.00 |
66 | 31 | 46 | F#4/Gb4 | fisβ/gesβ | 369.99 |
65 | 30 | 45 | F4 | fβ | 349.23 |
64 | 29 | 44 | E4 | eβ | 329.63 |
63 | 28 | 43 | D#4/Eb4 | disβ/esβ | 311.13 |
62 | 27 | 42 | D4 | dβ | 293.66 |
61 | 26 | 41 | C#4/Db4 | cisβ/desβ | 277.18 |
60 | 25 | 40 | C4 (middle C) | cβ (Schloss-C) | 261.63 |
59 | 24 | 39 | B3 | h | 246.94 |
58 | 23 | 38 | A#3/Bb3 | ais/b | 233.08 |
57 | 22 | 37 | A3 | a | 220.00 |
56 | 21 | 36 | G#3/Ab3 | gis/as | 207.65 |
55 | 20 | 35 | G3 | g | 196.00 |
54 | 19 | 34 | F#3/Gb3 | fis/ges | 185.00 |
53 | 18 | 33 | F3 | f | 174.61 |
52 | 17 | 32 | E3 | e | 164.81 |
51 | 16 | 31 | D#3/Eb3 | dis/es | 155.56 |
50 | 15 | 30 | D3 | d | 146.83 |
49 | 14 | 29 | C#3/Db3 | cis/des | 138.59 |
48 | 13 | 28 | C3 | c | 130.81 |
47 | 12 | 27 | B2 | H | 123.47 |
46 | 11 | 26 | A#2/Bb2 | Ais/B | 116.54 |
45 | 10 | 25 | A2 | A | 110.00 |
44 | 9 | 24 | G#2/Ab2 | Gis/As | 103.83 |
43 | 8 | 23 | G2 | G | 98.00 |
42 | 7 | 22 | F#2/Gb2 | Fis/Ges | 92.50 |
41 | 6 | 21 | F2 | F | 87.31 |
40 | 5 | 20 | E2 | E | 82.41 |
39 | 4 | 19 | D#2/Eb2 | Dis/Es | 77.78 |
38 | 3 | 18 | D2 | D | 73.42 |
37 | 2 | 17 | C#2/Db2 | Cis/Des | 69.30 |
36 | 1 | 16 | C2 | C | 65.41 |
35 | 15 | B1 | H1 | 61.74 | |
34 | 14 | A#1/Bb1 | Ais1/b1 | 58.27 | |
33 | 13 | A1 | A1 | 55.00 | |
32 | 12 | G#1/Ab1 | Gis1/As1 | 51.91 | |
31 | 11 | G1 | G1 | 49.00 | |
30 | 10 | F#1/Gb1 | Fis1/Ges1 | 46.25 | |
29 | 9 | F1 | F1 | 43.65 | |
28 | 8 | E1 | E1 | 41.20 | |
27 | 7 | D#1/Eb1 | Dis1/Es1 | 38.89 | |
26 | 6 | D1 | D1 | 36.71 | |
25 | 5 | C#1/Db1 | Cis1/Des1 | 34.65 | |
24 | 4 | C1 | C1 | ||
23 | 3 | B0 | H2 | 30.87 | |
22 | 2 | A#0/Bb0 | Ais2/B2 | 29.14 | |
21 | 1 | A0 | A2 | ||
20 | 25.96 | ||||
19 | 24.50 | ||||
18 | 23.12 | ||||
17 | 21.83 | ||||
16 | 20.60 | ||||
15 | 19.45 | ||||
14 | 18.35 | ||||
13 | 17.32 | ||||
12 | 16.35 | ||||
11 | 15.43 | ||||
10 | 14.57 | ||||
9 | 13.75 | ||||
8 | 12.98 | ||||
7 | 12.25 | ||||
6 | 11.56 | ||||
5 | 10.91 | ||||
4 | 10.30 | ||||
3 | 9.72 | ||||
2 | 9.18 | ||||
1 | 8.66 | ||||
0 | 8.18 |