mirror of
https://github.com/sshlien/abcmidi.git
synced 2025-12-06 06:55:06 +00:00
2024.03.19
This commit is contained in:
@@ -182,7 +182,26 @@ multiple number of options.
|
|||||||
If you run midistats with the -CSV option, it will return the
|
If you run midistats with the -CSV option, it will return the
|
||||||
results in a form of comma separated values that can be loaded
|
results in a form of comma separated values that can be loaded
|
||||||
into a Python panda dataframe. Each line refers to one of the
|
into a Python panda dataframe. Each line refers to one of the
|
||||||
16 midi channels.
|
16 midi channels. The following Python 3 code illustrates
|
||||||
|
how you would load the midistats output into a dataframe.
|
||||||
|
|
||||||
|
.br
|
||||||
|
import pandas as pd
|
||||||
|
.br
|
||||||
|
import io
|
||||||
|
.br
|
||||||
|
import subprocess
|
||||||
|
.br
|
||||||
|
cmd = ("midistats", "-CSV" , inputmidifilepath)
|
||||||
|
.br
|
||||||
|
process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||||
|
.br
|
||||||
|
csv = io.StringIO(process.stdout.read().decode())
|
||||||
|
.br
|
||||||
|
df = pd.read_csv(csv)
|
||||||
|
|
||||||
|
where inputmidifilepath is the path to the midi file that
|
||||||
|
you are using. (eg. 'clean_midi/Zero/Chi sei.mid')
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
The MIDI file devotes channel 9 to the percussion instruments
|
The MIDI file devotes channel 9 to the percussion instruments
|
||||||
|
|||||||
Reference in New Issue
Block a user