Files for the JavaScript project are in the repository's root. index.js
exports some basic functions for generating MIDI notes, chords, and arpeggios.
This library requires ES2020 or newer. Run npm install whistleaudio/midi-tools
in your JavaScript project, and then consume the exported functions, e.g.:
import { getChord } from 'midi-tools';
const chord = getChord("A", 4, "aeolian", 3);
console.log(chord.join(' '));
See source for further documentation or whistleaudio/midi-app for an example usage of the library.
This repo includes a js/midi-test.js
file you can use to quickly try it out. With Node.js installed, run the following to print a scale and chord:
node midi-test.js
The c++
folder contains the C++ project. miditools.h
implements similar functions for generating MIDI notes, chords, and arpeggios in C++. Note that midi-tools.h
defines a couple type aliases: a Scale
as an array of 7 integers and a Chord
as a vector of integers.
This library requires C++11 or newer. For example, a macOS install may come with C++98, so you can brew install gcc
and add export CXX=/usr/local/bin/g++-10
to .bashrc
to tell make
to use the newer compiler.
Include the midi-tools.h
header file in your implementation file.
#include <iostream>
#include "midi-tools.h"
int main()
{
const Chord chord = getChord("A", 4, "aeolian", 3);
for (const int& value : chord) {
std::cout << value << ' ';
}
}
This repo includes a midi-test.cpp
file you can use to quickly test it out.
cd c++ && make midi-test && ./midi-test
The go
folder contains the Go project. miditools.go
implements similar functions for generating MIDI notes, chords, and arpeggios with Golang. Note that miditools.go
defines a couple types: a Scale
as an array of 7 integers and a Chord
as a slice of integers.
From the same module, miditools.go
can be used by importing "github.com/whistleaudio/miditools" to use functions like miditools.GetChord()
.
package main
import (
"fmt"
"github.com/whistleaudio/miditools"
)
func main() {
fmt.Println(miditools.GetChord("A", 4, "aeolian", 3)) // [69 72 76]
}
This repo includes a main.go
file you can use to quickly test it out.
cd go && go run cmd/main.go