mirror of
https://github.com/godotengine/buildroot.git
synced 2026-01-05 14:09:53 +03:00
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:
committed by
Thomas Petazzoni
parent
893d642a77
commit
f7f915fc4a
23
support/testing/tests/package/sample_python_midiutil.py
Normal file
23
support/testing/tests/package/sample_python_midiutil.py
Normal 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)
|
||||
11
support/testing/tests/package/test_python_midiutil.py
Normal file
11
support/testing/tests/package/test_python_midiutil.py
Normal 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"]
|
||||
Reference in New Issue
Block a user