Skip to main content

audio-to-midi

audio-to-midi takes in a sound file and converts it to a multichannel MIDI file. It accomplishes this by performing FFT's on all channels of the audio data at user specified time steps. It then separates the resulting frequency analysis into equivalence classes which correspond to the twelve tone scale; the volume of each class being the average volume of its constituent frequencies. It then formats this data for MIDI and writes it out to a user specified file. It has the ability to convert whichever audio file formats are supported by the soundfile module. libsndfile must be installed before running audio-to-midi

Installation

> python3 ./setup.py install

Usage

> audio-to-midi --help
usage: audio-to-midi [-h] [--output OUTPUT] [--time-window TIME_WINDOW] [--activation-level ACTIVATION_LEVEL] [--condense] [--condense-max] [--single-note]
                     [--note-count NOTE_COUNT] [--bpm BPM] [--transpose TRANSPOSE] [--key KEY [KEY ...]] [--no-progress]
                     infile

positional arguments:
  infile                The sound file to process.

optional arguments:
  -h, --help            show this help message and exit
  --output OUTPUT, -o OUTPUT
                        The MIDI file to output. Default: <infile>.mid
  --time-window TIME_WINDOW, -t TIME_WINDOW
                        The time span over which to compute the individual FFTs in milliseconds.
  --activation-level ACTIVATION_LEVEL, -a ACTIVATION_LEVEL
                        The amplitude threshold for notes to be added to the MIDI file. Must be between 0 and 1.
  --condense, -c        Combine contiguous notes at their average amplitude.
  --condense-max, -m    Write the maximum velocity for a condensed note segment rather than the rolling average.
  --single-note, -s     Only add the loudest note to the MIDI file for a given time window.
  --note-count NOTE_COUNT, -C NOTE_COUNT
                        Only add the loudest n notes to the MIDI file for a given time window.
  --bpm BPM, -b BPM     Beats per minute. Defaults: 60
  --transpose TRANSPOSE, -T TRANSPOSE
                        Transpose the MIDI pitches by a constant offset.
  --key KEY [KEY ...], -k KEY [KEY ...]
                        Map to a pitch set.
  --no-progress, -n     Don't print the progress bar.

Example

>$ audio-to-midi ./this_is_a_test.wav -b 120 -t 30
./this_is_a_test.wav
samplerate: 44100 Hz
channels: 1
duration: 2.000 s
format: WAV (Microsoft) [WAV]
subtype: Signed 16 bit PCM [PCM_16]
window: 5.0 ms
frequencies: min = 200.0 Hz, max = 20000 Hz
100% (401 of 401) |##############################################################| Elapsed Time: 0:00:00 Time:  0:00:00
> ls ./*.mid
./this_is_a_test.wav.mid

Release files for audio-to-midi 2020.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for audio-to-midi 2020.7
File Size Uploaded
audio_to_midi-2020.7.tar.gz 8.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for audio-to-midi 2020.7
File Interpreter ABI Platform
audio_to_midi-2020.7-py3-none-any.whl Python 3 none any Details

Total release size: 18.9 kB

Release files / audio_to_midi-2020.7.tar.gz

Download URL audio_to_midi-2020.7.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3a8480b56652e4dda7c11fc3b26c82d2a04d42f355809101003cdf3fb25e9a2d
BLAKE2b-256 checksum
How to use checksums
1771d89f14e621812864799f9829861e042b715052bdcc75b2a938bdfcc5c56c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.8.2

Release files / audio_to_midi-2020.7-py3-none-any.whl

Download URL audio_to_midi-2020.7-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c999fe686d7e84ac6954715bec3aab5479fc6b19d7666be69dd0ddb94854f7cb
BLAKE2b-256 checksum
How to use checksums
61b5d3c38271a8ec6564c27246440cee83fdbf3d9893370704e4ff6593ca17de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

2020.7 This release

2 release files

2020.6

2 release files

2020.5

2 release files

2020.4

2 release files

2020.3

2 release files

2020.2

2 release files

2020.1

2 release files

2019.3

2 release files

2019.2

3 release files

2019.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page