aboutsummaryrefslogtreecommitdiff
path: root/portmidi/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'portmidi/README.md')
-rw-r--r--portmidi/README.md128
1 files changed, 128 insertions, 0 deletions
diff --git a/portmidi/README.md b/portmidi/README.md
new file mode 100644
index 0000000..3f0463c
--- /dev/null
+++ b/portmidi/README.md
@@ -0,0 +1,128 @@
1# PortMidi - Cross-Platform MIDI IO
2
3This is the canonical release of PortMidi.
4
5See other repositories within [PortMidi](https://github.com/PortMidi)
6for related code and bindings (although currently, not much is here).
7
8## [Full C API documentation is here.](https://portmidi.github.io/portmidi_docs/)
9
10## Compiling and Using PortMidi
11
12Use CMake (or ccmake) to create a Makefile for Linux/BSD or a
13project file for Xcode or MS Visual Studio. Use make or an IDE to compile:
14```
15sudo apt install libasound2-dev # on Linux, you need ALSA
16cd portmidi # start in the top-level portmidi directory
17ccmake . # set any options interactively, type c to configure
18 # type g to generate a Makefile or IDE project
19 # type q to quit
20 # (alternatively, run the CMake GUI and use
21 # Configure and Generate buttons to build IDE project)
22make # compile sources and build PortMidi library
23 # (alternatively, open project file with your IDE)
24sudo make install # if you want to install to your system
25```
26
27## Installation
28
29My advice is to build PortMidi and statically link it to your
30application. This gives you more control over versions. However,
31installing PortMidi to your system is preferred by some, and the
32following should do it:
33```
34cmake .
35make
36sudo make install
37```
38
39## Language Bindings
40
41Here is a guide to some other projects using PortMidi. There is not
42much coordination, so let us know if there are better or alternative
43bindings for these and other languages:
44
45- Python: Various libraries and packages exist; search and ye shall
46 find. If you wouldn't like to do research, check out [mido](https://mido.readthedocs.io/en/stable/)
47- [SML](https://github.com/jh-midi/portmidi-sml2)
48- [OCaml](https://ocaml.org/p/portmidi/0.1)
49- [Haskell](https://hackage.haskell.org/package/PortMidi)
50- [Erlang](https://hexdocs.pm/portmidi/PortMidi.html)
51- [Julia](https://github.com/SteffenPL/PortMidi.jl)
52- [C#](https://github.com/net-core-audio/portmidi)
53- [Rust](https://musitdev.github.io/portmidi-rs/)
54- [Go](https://github.com/rakyll/portmidi)
55- [Odin](https://pkg.odin-lang.org/vendor/portmidi/)
56- [Serpent](https://sourceforge.net/projects/serpent/) - a real-time
57 Python-like language has PortMidi built-in, a MIDI-timestamp-aware
58 scheduler, and GUI support for device selection.
59- [Pd (Pure Data)](https://puredata.info/) uses PortMidi.
60
61
62## What's New?
63
64(Not so new, but significant:) Support for the **PmDefaults** program,
65which enabled a graphical interface to select default MIDI devices,
66has been removed for lack of interest. This allowed us to also remove
67C code to read and parse Java preference files on various systems,
68simplifying the library. **PmDefaults** allowed simple command-line
69programs to use `Pm_DefaultInputDeviceID()` and
70`Pm_DefaultOutputDeviceID()` rather than creating device selection
71interfaces. Now, you should either pass devices on the command line or
72create your own selection interface when building a GUI
73application. (See pm_tests for examples.) `Pm_DefaultInputDeviceID()`
74and `Pm_DefaultOutputDeviceID()` now return a valid device if
75possible, but they may not actually reflect any user preference.
76
77Haiku support in a minimal implementation. See TODO's in source.
78
79sndio is also minimally supported, allowing basic PortMidi functions
80in OpenBSD, FreeBSD, and NetBSD by setting USE_SNDIO for CMake, but
81not delayed/timestamped output and virtual devices.
82
83# Other Repositories
84
85PortMidi used to be part of the PortMedia suite, but this repo has
86been reduced to mostly just C/C++ code for PortMidi. You will find
87some other repositories in this PortMidi project set up for language
88bindings (volunteers and contributors are invited!). Other code
89removed from previous releases of PortMedia include:
90
91## PortSMF
92
93A Standard MIDI File (SMF) (and more) library is in the [portsmf
94repository](https://github.com/rbdannenberg/portsmf).
95
96PortSMF is a library for reading/writing/editing Standard MIDI
97Files. It is actually much more, with a general representation of
98events and updates with properties consisting of attributes and typed
99values. Familiar properties of pitch, time, duration, and channel are
100built into events and updates to make them faster to access and more
101compact.
102
103To my knowledge, PortSMF has the most complete and useful handling of
104MIDI tempo tracks. E.g., you can edit notes according to either beat
105or time, and you can edit tempo tracks, for example, flattening the
106tempo while preserving the beat alignment, preserving the real time
107while changing the tempo or stretching the tempo over some interval.
108
109In addition to Standard MIDI Files, PortSMF supports an ASCII
110representation called Allegro. PortSMF and Allegro are used for
111Audacity Note Tracks.
112
113## scorealign
114
115Scorealign used to be part of the PortMedia suite. It is now at the
116[scorealign repository](https://github.com/rbdannenberg/scorealign).
117
118Scorealign aligns audio-to-audio, audio-to-MIDI or MIDI-to-MIDI using
119dynamic time warping (DTW) of a computed chromagram
120representation. There are some added smoothing tricks to improve
121performance. This library is written in C and runs substantially
122faster than most other implementations, especially those written in
123MATLAB, due to the core DTW algorithm. Users should be warned that
124while chromagrams are robust features for alignment, they achieve
125robustness by operating at fairly high granularity, e.g., durations of
126around 100ms, which limits time precision. Other more recent
127algorithms can doubtless do better, but be cautious of claims, since
128it all depends on what assumptions you can make about the music.