audio2midi 0.7.0__tar.gz → 0.9.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {audio2midi-0.7.0 → audio2midi-0.9.0}/PKG-INFO +8 -4
- {audio2midi-0.7.0 → audio2midi-0.9.0}/README.md +7 -3
- {audio2midi-0.7.0 → audio2midi-0.9.0}/pyproject.toml +1 -1
- {audio2midi-0.7.0 → audio2midi-0.9.0}/src/audio2midi/basic_pitch_pitch_detector.py +2 -1
- {audio2midi-0.7.0 → audio2midi-0.9.0}/src/audio2midi/magenta_music_transcription.py +1 -1
- {audio2midi-0.7.0 → audio2midi-0.9.0}/.gitignore +0 -0
- {audio2midi-0.7.0 → audio2midi-0.9.0}/.python-version +0 -0
- {audio2midi-0.7.0 → audio2midi-0.9.0}/src/audio2midi/__init__.py +0 -0
- {audio2midi-0.7.0 → audio2midi-0.9.0}/src/audio2midi/crepe_pitch_detector.py +0 -0
- {audio2midi-0.7.0 → audio2midi-0.9.0}/src/audio2midi/crepe_pitch_detector_tf.py +0 -0
- {audio2midi-0.7.0 → audio2midi-0.9.0}/src/audio2midi/librosa_pitch_detector.py +0 -0
- {audio2midi-0.7.0 → audio2midi-0.9.0}/src/audio2midi/melodia_pitch_detector.py +0 -0
- {audio2midi-0.7.0 → audio2midi-0.9.0}/src/audio2midi/mt3_music_transcription.py +0 -0
- {audio2midi-0.7.0 → audio2midi-0.9.0}/src/audio2midi/pop2piano.py +0 -0
- {audio2midi-0.7.0 → audio2midi-0.9.0}/src/audio2midi/py.typed +0 -0
- {audio2midi-0.7.0 → audio2midi-0.9.0}/src/audio2midi/violin_pitch_detector.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: audio2midi
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.9.0
|
4
4
|
Summary: Audio To Midi
|
5
5
|
Author-email: dummyjenil <dummyjenil@gmail.com>
|
6
6
|
Provides-Extra: all
|
@@ -97,7 +97,7 @@ Description-Content-Type: text/markdown
|
|
97
97
|
---
|
98
98
|
|
99
99
|
```bash
|
100
|
-
pip install audio2midi[all] audio2midi[pop2piano] audio2midi[violin_pitch_detector] audio2midi[crepe_pitch_detector] audio2midi[crepe_pitch_detector_tf] audio2midi[melodia_pitch_detector] audio2midi[basic_pitch_pitch_detector] audio2midi[librosa_pitch_detector]
|
100
|
+
pip install audio2midi[all] audio2midi[pop2piano] audio2midi[violin_pitch_detector] audio2midi[crepe_pitch_detector] audio2midi[crepe_pitch_detector_tf] audio2midi[melodia_pitch_detector] audio2midi[basic_pitch_pitch_detector] audio2midi[librosa_pitch_detector] audio2midi[magenta_music_transcription]
|
101
101
|
```
|
102
102
|
---
|
103
103
|
|
@@ -146,6 +146,7 @@ from audio2midi.basic_pitch_pitch_detector import BasicPitch
|
|
146
146
|
from audio2midi.crepe_pitch_detector import Crepe
|
147
147
|
from audio2midi.violin_pitch_detector import Violin_Pitch_Det
|
148
148
|
from audio2midi.pop2piano import Pop2Piano
|
149
|
+
from audio2midi.magenta_music_transcription import Magenta
|
149
150
|
from torch import device as Device
|
150
151
|
from torch.cuda import is_available as cuda_is_available
|
151
152
|
device = Device("cuda" if cuda_is_available() else "cpu")
|
@@ -153,6 +154,7 @@ Crepe().predict(audio_path)
|
|
153
154
|
Pop2Piano(device=device).predict(audio_path)
|
154
155
|
Violin_Pitch_Det(device=device).predict(audio_path)
|
155
156
|
BasicPitch(device=device).predict(audio_path)
|
157
|
+
Magenta().predict(audio_path)
|
156
158
|
```
|
157
159
|
|
158
160
|
---
|
@@ -166,6 +168,7 @@ from audio2midi.melodia_pitch_detector import Melodia
|
|
166
168
|
from audio2midi.pop2piano import Pop2Piano
|
167
169
|
from audio2midi.violin_pitch_detector import Violin_Pitch_Det
|
168
170
|
from audio2midi.mt3_music_transcription import MT3
|
171
|
+
from audio2midi.magenta_music_transcription import Magenta
|
169
172
|
from os import environ
|
170
173
|
from huggingface_hub import hf_hub_download
|
171
174
|
from shutil import unpack_archive
|
@@ -219,12 +222,13 @@ gr.TabbedInterface([
|
|
219
222
|
gr.Interface(Normal_Pitch_Det().predict,[gr.Audio(type="filepath",label="Input Audio"),gr.Number(120,label="BPM"),gr.Number(512,label="HOP Len"),gr.Number(2,label="minimum note length"),gr.Number(0.1,label="threshold")],gr.File(label="Midi File")),
|
220
223
|
gr.Interface(Guitar_Pitch_Det().predict,[gr.Audio(type="filepath",label="Input Audio"),gr.Number(4,label="mag_exp"),gr.Number(-61,label="Threshold"),gr.Number(6,label="Pre_post_max"),gr.Checkbox(False,label="backtrack"),gr.Checkbox(False,label="round_to_sixteenth"),gr.Number(1024,label="hop_length"),gr.Number(72,label="n_bins"),gr.Number(12,label="bins_per_octave")],gr.File(label="Midi File")),
|
221
224
|
gr.Interface(Melodia().predict,[gr.Audio(type="filepath",label="Input Audio"),gr.Number(120,label="BPM",step=30),gr.Number(0.25,label="smoothness",step=0.05,info="Smooth the pitch sequence with a median filter of the provided duration (in seconds)."),gr.Number(0.1,label="minimum duration",step=0.1,info="Minimum allowed duration for note (in seconds). Shorter notes will be removed."),gr.Number(128,label="HOP")],gr.File(label="Midi File")),
|
222
|
-
gr.Interface(BasicPitch(device=device).predict,[gr.Audio(type="filepath", label="Upload Audio"),gr.Number(0.5,label="onset_thresh",info="Minimum amplitude of an onset activation to be considered an onset."),gr.Number(0.3,label="frame_thresh",info="Minimum energy requirement for a frame to be considered present."),gr.Number(
|
225
|
+
gr.Interface(BasicPitch(device=device).predict,[gr.Audio(type="filepath", label="Upload Audio"),gr.Number(0.5,label="onset_thresh",info="Minimum amplitude of an onset activation to be considered an onset."),gr.Number(0.3,label="frame_thresh",info="Minimum energy requirement for a frame to be considered present."),gr.Number(11,label="min_note_len",info="The minimum allowed note length in milliseconds."),gr.Number(120,label="midi_tempo"),gr.Checkbox(True,label="infer_onsets",info="add additional onsets when there are large differences in frame amplitudes."),gr.Checkbox(True,label="include_pitch_bends",info="include pitch bends."),gr.Checkbox(False,label="multiple_pitch_bends",info="allow overlapping notes in midi file to have pitch bends."),gr.Checkbox(True,label="melodia_trick",info="Use the melodia post-processing step.")],gr.File(label="Download Midi File")),
|
226
|
+
gr.Interface(Magenta().predict,[gr.Audio(type="filepath", label="Upload Audio"),gr.Number(0.5,label="onset_thresh",info="Minimum amplitude of an onset activation to be considered an onset."),gr.Number(3,label="min_note_len",info="The minimum allowed note length"),gr.Number(3,label="gap_tolerance_frames"),gr.Number(4,label="pitch_bend_steps"),gr.Number(1500,label="pitch_bend_depth"),gr.Checkbox(True,label="include_pitch_bends",info="include pitch bends.")],gr.File(label="Download Midi File")),
|
223
227
|
gr.Interface(Violin_Pitch_Det(device=device,model_capacity=getenv("violin_model_capacity","full")).predict, [gr.Audio(label="Upload your Audio file",type="filepath"),gr.Number(32,label="Batch size"),gr.Radio(["spotify","tiktok"],value="spotify",label="Post Processing"),gr.Checkbox(True,label="include_pitch_bends")],gr.File(label="Download MIDI file")),
|
224
228
|
gr.Interface(Crepe(getenv("crepe_model_capacity","full")).predict,[gr.Audio(type="filepath",label="Input Audio"),gr.Checkbox(False,label="viterbi",info="Apply viterbi smoothing to the estimated pitch curve"),gr.Checkbox(True,label="center"),gr.Number(10,label="step size",info="The step size in milliseconds for running pitch estimation."),gr.Number(0.8,label="minimum confidence"),gr.Number(32,label="batch size")],gr.File(label="Midi File")),
|
225
229
|
gr.Interface(CrepeTF(getenv("crepe_model_capacity","full")).predict,[gr.Audio(type="filepath",label="Input Audio"),gr.Checkbox(False,label="viterbi",info="Apply viterbi smoothing to the estimated pitch curve"),gr.Checkbox(True,label="center"),gr.Number(10,label="step size",info="The step size in milliseconds for running pitch estimation."),gr.Number(0.8,label="minimum confidence"),gr.Number(32,label="batch size")],gr.File(label="Midi File")),
|
226
230
|
gr.Interface(Pop2Piano(device).predict,[gr.Audio(label="Input Audio",type="filepath"),gr.Number(1, minimum=1, maximum=21, label="Composer"),gr.Number(2,label="Details in Piano"),gr.Number(1,label="Efficiency of Piano"),gr.Radio([1,2,4],label="steps per beat",value=2)],gr.File(label="MIDI File")),
|
227
231
|
gr.Interface(MT3(str(Path("mt3_model").absolute())).predict,[gr.Audio(label="Input Audio",type="filepath"),gr.Number(0,label="seed")],gr.File(label="MIDI File")),
|
228
232
|
midi_viz_ui
|
229
|
-
],["Normal Pitch Detection","Guitar Based Pitch Detection","Melodia","Spotify Pitch Detection","Violin Based Pitch Detection","Crepe Pitch Detection","Crepe Pitch Detection TF","Pop2Piano","MT3","Midi Vizulizer"]).launch()
|
233
|
+
],["Normal Pitch Detection","Guitar Based Pitch Detection","Melodia","Spotify Pitch Detection","Magenta Pitch Detection","Violin Based Pitch Detection","Crepe Pitch Detection","Crepe Pitch Detection TF","Pop2Piano","MT3","Midi Vizulizer"]).launch()
|
230
234
|
```
|
@@ -5,7 +5,7 @@
|
|
5
5
|
---
|
6
6
|
|
7
7
|
```bash
|
8
|
-
pip install audio2midi[all] audio2midi[pop2piano] audio2midi[violin_pitch_detector] audio2midi[crepe_pitch_detector] audio2midi[crepe_pitch_detector_tf] audio2midi[melodia_pitch_detector] audio2midi[basic_pitch_pitch_detector] audio2midi[librosa_pitch_detector]
|
8
|
+
pip install audio2midi[all] audio2midi[pop2piano] audio2midi[violin_pitch_detector] audio2midi[crepe_pitch_detector] audio2midi[crepe_pitch_detector_tf] audio2midi[melodia_pitch_detector] audio2midi[basic_pitch_pitch_detector] audio2midi[librosa_pitch_detector] audio2midi[magenta_music_transcription]
|
9
9
|
```
|
10
10
|
---
|
11
11
|
|
@@ -54,6 +54,7 @@ from audio2midi.basic_pitch_pitch_detector import BasicPitch
|
|
54
54
|
from audio2midi.crepe_pitch_detector import Crepe
|
55
55
|
from audio2midi.violin_pitch_detector import Violin_Pitch_Det
|
56
56
|
from audio2midi.pop2piano import Pop2Piano
|
57
|
+
from audio2midi.magenta_music_transcription import Magenta
|
57
58
|
from torch import device as Device
|
58
59
|
from torch.cuda import is_available as cuda_is_available
|
59
60
|
device = Device("cuda" if cuda_is_available() else "cpu")
|
@@ -61,6 +62,7 @@ Crepe().predict(audio_path)
|
|
61
62
|
Pop2Piano(device=device).predict(audio_path)
|
62
63
|
Violin_Pitch_Det(device=device).predict(audio_path)
|
63
64
|
BasicPitch(device=device).predict(audio_path)
|
65
|
+
Magenta().predict(audio_path)
|
64
66
|
```
|
65
67
|
|
66
68
|
---
|
@@ -74,6 +76,7 @@ from audio2midi.melodia_pitch_detector import Melodia
|
|
74
76
|
from audio2midi.pop2piano import Pop2Piano
|
75
77
|
from audio2midi.violin_pitch_detector import Violin_Pitch_Det
|
76
78
|
from audio2midi.mt3_music_transcription import MT3
|
79
|
+
from audio2midi.magenta_music_transcription import Magenta
|
77
80
|
from os import environ
|
78
81
|
from huggingface_hub import hf_hub_download
|
79
82
|
from shutil import unpack_archive
|
@@ -127,12 +130,13 @@ gr.TabbedInterface([
|
|
127
130
|
gr.Interface(Normal_Pitch_Det().predict,[gr.Audio(type="filepath",label="Input Audio"),gr.Number(120,label="BPM"),gr.Number(512,label="HOP Len"),gr.Number(2,label="minimum note length"),gr.Number(0.1,label="threshold")],gr.File(label="Midi File")),
|
128
131
|
gr.Interface(Guitar_Pitch_Det().predict,[gr.Audio(type="filepath",label="Input Audio"),gr.Number(4,label="mag_exp"),gr.Number(-61,label="Threshold"),gr.Number(6,label="Pre_post_max"),gr.Checkbox(False,label="backtrack"),gr.Checkbox(False,label="round_to_sixteenth"),gr.Number(1024,label="hop_length"),gr.Number(72,label="n_bins"),gr.Number(12,label="bins_per_octave")],gr.File(label="Midi File")),
|
129
132
|
gr.Interface(Melodia().predict,[gr.Audio(type="filepath",label="Input Audio"),gr.Number(120,label="BPM",step=30),gr.Number(0.25,label="smoothness",step=0.05,info="Smooth the pitch sequence with a median filter of the provided duration (in seconds)."),gr.Number(0.1,label="minimum duration",step=0.1,info="Minimum allowed duration for note (in seconds). Shorter notes will be removed."),gr.Number(128,label="HOP")],gr.File(label="Midi File")),
|
130
|
-
gr.Interface(BasicPitch(device=device).predict,[gr.Audio(type="filepath", label="Upload Audio"),gr.Number(0.5,label="onset_thresh",info="Minimum amplitude of an onset activation to be considered an onset."),gr.Number(0.3,label="frame_thresh",info="Minimum energy requirement for a frame to be considered present."),gr.Number(
|
133
|
+
gr.Interface(BasicPitch(device=device).predict,[gr.Audio(type="filepath", label="Upload Audio"),gr.Number(0.5,label="onset_thresh",info="Minimum amplitude of an onset activation to be considered an onset."),gr.Number(0.3,label="frame_thresh",info="Minimum energy requirement for a frame to be considered present."),gr.Number(11,label="min_note_len",info="The minimum allowed note length in milliseconds."),gr.Number(120,label="midi_tempo"),gr.Checkbox(True,label="infer_onsets",info="add additional onsets when there are large differences in frame amplitudes."),gr.Checkbox(True,label="include_pitch_bends",info="include pitch bends."),gr.Checkbox(False,label="multiple_pitch_bends",info="allow overlapping notes in midi file to have pitch bends."),gr.Checkbox(True,label="melodia_trick",info="Use the melodia post-processing step.")],gr.File(label="Download Midi File")),
|
134
|
+
gr.Interface(Magenta().predict,[gr.Audio(type="filepath", label="Upload Audio"),gr.Number(0.5,label="onset_thresh",info="Minimum amplitude of an onset activation to be considered an onset."),gr.Number(3,label="min_note_len",info="The minimum allowed note length"),gr.Number(3,label="gap_tolerance_frames"),gr.Number(4,label="pitch_bend_steps"),gr.Number(1500,label="pitch_bend_depth"),gr.Checkbox(True,label="include_pitch_bends",info="include pitch bends.")],gr.File(label="Download Midi File")),
|
131
135
|
gr.Interface(Violin_Pitch_Det(device=device,model_capacity=getenv("violin_model_capacity","full")).predict, [gr.Audio(label="Upload your Audio file",type="filepath"),gr.Number(32,label="Batch size"),gr.Radio(["spotify","tiktok"],value="spotify",label="Post Processing"),gr.Checkbox(True,label="include_pitch_bends")],gr.File(label="Download MIDI file")),
|
132
136
|
gr.Interface(Crepe(getenv("crepe_model_capacity","full")).predict,[gr.Audio(type="filepath",label="Input Audio"),gr.Checkbox(False,label="viterbi",info="Apply viterbi smoothing to the estimated pitch curve"),gr.Checkbox(True,label="center"),gr.Number(10,label="step size",info="The step size in milliseconds for running pitch estimation."),gr.Number(0.8,label="minimum confidence"),gr.Number(32,label="batch size")],gr.File(label="Midi File")),
|
133
137
|
gr.Interface(CrepeTF(getenv("crepe_model_capacity","full")).predict,[gr.Audio(type="filepath",label="Input Audio"),gr.Checkbox(False,label="viterbi",info="Apply viterbi smoothing to the estimated pitch curve"),gr.Checkbox(True,label="center"),gr.Number(10,label="step size",info="The step size in milliseconds for running pitch estimation."),gr.Number(0.8,label="minimum confidence"),gr.Number(32,label="batch size")],gr.File(label="Midi File")),
|
134
138
|
gr.Interface(Pop2Piano(device).predict,[gr.Audio(label="Input Audio",type="filepath"),gr.Number(1, minimum=1, maximum=21, label="Composer"),gr.Number(2,label="Details in Piano"),gr.Number(1,label="Efficiency of Piano"),gr.Radio([1,2,4],label="steps per beat",value=2)],gr.File(label="MIDI File")),
|
135
139
|
gr.Interface(MT3(str(Path("mt3_model").absolute())).predict,[gr.Audio(label="Input Audio",type="filepath"),gr.Number(0,label="seed")],gr.File(label="MIDI File")),
|
136
140
|
midi_viz_ui
|
137
|
-
],["Normal Pitch Detection","Guitar Based Pitch Detection","Melodia","Spotify Pitch Detection","Violin Based Pitch Detection","Crepe Pitch Detection","Crepe Pitch Detection TF","Pop2Piano","MT3","Midi Vizulizer"]).launch()
|
141
|
+
],["Normal Pitch Detection","Guitar Based Pitch Detection","Melodia","Spotify Pitch Detection","Magenta Pitch Detection","Violin Based Pitch Detection","Crepe Pitch Detection","Crepe Pitch Detection TF","Pop2Piano","MT3","Midi Vizulizer"]).launch()
|
138
142
|
```
|
@@ -778,6 +778,7 @@ class BasicPitch():
|
|
778
778
|
}
|
779
779
|
return unwrapped_output
|
780
780
|
|
781
|
-
def predict(self,audio,onset_thresh=0.5,frame_thresh=0.3,min_note_len=
|
781
|
+
def predict(self,audio,onset_thresh=0.5,frame_thresh=0.3,min_note_len=11,midi_tempo=120,infer_onsets=True,include_pitch_bends=True,multiple_pitch_bends=True,melodia_trick=True,progress_callback: Callable[[int, int], None] = None,min_freqat=None,max_freqat=None,output_file="output.mid"):
|
782
|
+
int(np.round(min_note_len / 1000 * (AUDIO_SAMPLE_RATE / FFT_HOP)))
|
782
783
|
model_output_to_notes(self.run_inference(audio,progress_callback),onset_thresh = onset_thresh,frame_thresh = frame_thresh,infer_onsets = infer_onsets,min_note_len = min_note_len,min_freq = min_freqat,max_freq = max_freqat,include_pitch_bends = include_pitch_bends,multiple_pitch_bends = multiple_pitch_bends,melodia_trick = melodia_trick,midi_tempo = midi_tempo).write(output_file)
|
783
784
|
return output_file
|
@@ -71,6 +71,6 @@ class Magenta:
|
|
71
71
|
return actProb , onProb , offProb , volProb , tempo
|
72
72
|
|
73
73
|
|
74
|
-
def predict(self,audio,onset_thresh=0,min_note_len=3,
|
74
|
+
def predict(self,audio,onset_thresh=0,min_note_len=3,gap_tolerance_frames = 3,pitch_bend_depth = 1500,pitch_bend_steps = 4,include_pitch_bends=True,progress_callback: Callable[[int, int], None] = None,output_file="output.mid"):
|
75
75
|
model_output_to_notes(self.run_inference(audio,progress_callback),onset_thresh = onset_thresh,min_note_len = min_note_len,include_pitch_bends = include_pitch_bends,pitch_bend_depth=pitch_bend_depth,pitch_bend_steps=pitch_bend_steps,gap_tolerance_frames=gap_tolerance_frames).write(output_file)
|
76
76
|
return output_file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|