package/python-midiutil: new package

A pure python library for creating multi-track MIDI files.

https://github.com/MarkCWirt/MIDIUtil

Signed-off-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Julien Olivain 2023-01-03 21:00:45 +01:00 committed by Thomas Petazzoni
parent 893d642a77
commit f7f915fc4a
7 changed files with 63 additions and 0 deletions

View File

@ -1725,6 +1725,7 @@ F: package/python-hwdata/
F: package/python-magic-wormhole/
F: package/python-magic-wormhole-mailbox-server/
F: package/python-magic-wormhole-transit-relay/
F: package/python-midiutil/
F: package/python-pyalsa/
F: package/python-spake2/
F: package/rdma-core/
@ -1735,6 +1736,7 @@ F: package/zynaddsubfx/
F: support/testing/tests/package/sample_python_distro.py
F: support/testing/tests/package/sample_python_gnupg.py
F: support/testing/tests/package/sample_python_hwdata.py
F: support/testing/tests/package/sample_python_midiutil.py
F: support/testing/tests/package/sample_python_pyalsa.py
F: support/testing/tests/package/sample_python_spake2.py
F: support/testing/tests/package/test_acpica.py
@ -1776,6 +1778,7 @@ F: support/testing/tests/package/test_python_gnupg.py
F: support/testing/tests/package/test_python_hkdf.py
F: support/testing/tests/package/test_python_hwdata.py
F: support/testing/tests/package/test_python_magic_wormhole.py
F: support/testing/tests/package/test_python_midiutil.py
F: support/testing/tests/package/test_python_pyalsa.py
F: support/testing/tests/package/test_python_spake2.py
F: support/testing/tests/package/test_rdma_core.py

View File

@ -1144,6 +1144,7 @@ menu "External python modules"
source "package/python-matplotlib/Config.in"
source "package/python-mbstrdecoder/Config.in"
source "package/python-memory-profiler/Config.in"
source "package/python-midiutil/Config.in"
source "package/python-mimeparse/Config.in"
source "package/python-minimalmodbus/Config.in"
source "package/python-mistune/Config.in"

View File

@ -0,0 +1,6 @@
config BR2_PACKAGE_PYTHON_MIDIUTIL
bool "python-midiutil"
help
A pure python library for creating multi-track MIDI files.
https://github.com/MarkCWirt/MIDIUtil

View File

@ -0,0 +1,5 @@
# md5, sha256 from https://pypi.org/pypi/midiutil/json
md5 948c16c74e7355268158f227b710edce MIDIUtil-1.2.1.tar.gz
sha256 79fa983bd1efc60785f68a8fe78fa8f45b8d7ec5898bf7cb7f3f7f3336d6a90a MIDIUtil-1.2.1.tar.gz
# Locally computed sha256 checksums
sha256 8d5bdaebe8445a4c2dc812c205eb5455ba123aa1af8503cc88712115ab7c97ef License.txt

View File

@ -0,0 +1,14 @@
################################################################################
#
# python-midiutil
#
################################################################################
PYTHON_MIDIUTIL_VERSION = 1.2.1
PYTHON_MIDIUTIL_SOURCE = MIDIUtil-$(PYTHON_MIDIUTIL_VERSION).tar.gz
PYTHON_MIDIUTIL_SITE = https://files.pythonhosted.org/packages/f5/44/fde6772d8bfaea64fcf5eb948124d0a5fdf5f848b14ac22a23ced53e562d
PYTHON_MIDIUTIL_SETUP_TYPE = setuptools
PYTHON_MIDIUTIL_LICENSE = MIT
PYTHON_MIDIUTIL_LICENSE_FILES = License.txt
$(eval $(python-package))

View File

@ -0,0 +1,23 @@
#! /usr/bin/env python3
# Taken from:
# https://github.com/MarkCWirt/MIDIUtil/blob/1.2.1/examples/c-major-scale.py
from midiutil import MIDIFile
degrees = [60, 62, 64, 65, 67, 69, 71, 72] # MIDI note number
track = 0
channel = 0
time = 0 # In beats
duration = 1 # In beats
tempo = 60 # In BPM
volume = 100 # 0-127, as per the MIDI standard
MyMIDI = MIDIFile(1) # One track
MyMIDI.addTempo(track, time, tempo)
for i, pitch in enumerate(degrees):
MyMIDI.addNote(track, channel, pitch, time + i, duration, volume)
with open("major-scale.mid", "wb") as output_file:
MyMIDI.writeFile(output_file)

View File

@ -0,0 +1,11 @@
from tests.package.test_python import TestPythonPackageBase
class TestPythonPy3MidiUtil(TestPythonPackageBase):
__test__ = True
config = TestPythonPackageBase.config + \
"""
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_MIDIUTIL=y
"""
sample_scripts = ["tests/package/sample_python_midiutil.py"]