Reputation: 557
I am trying to write some codes to convert MP3 files to midi in the main colab page.
so i remember that creating midi file form mp3 is a big project, and I probably have trouble importing a personal song or audio file into this project. (Audio format to MIDI, in some places is done with artificial intelligence (such as PolyphonicPianoTranscription), (list of AudiotoMIDI conversion projects).
So i have tried to convert the MP3 to WAV by this function:
def MP3_to_WAV(MP3_file):
from pydub import AudioSegment
sound = AudioSegment.from_mp3(MP3_file)
filename = os.path.basename(MP3_file)
wav_file_name=output_path+filename.split('.')[0]+'.wav'
sound.export(wav_file_name, format="wav")
return wav_file_name
and the tried to convert The WAV to MIDI by this instruction and this function:
def wav_to_midi(wav_f_n):
filename2 = os.path.basename(wav_f_n)
midi_file_name=output_path+filename2.split('.')[0]+'.midi'
run_comand("python /content/audio_to_midi_melodia/audio_to_midi_melodia.py "+wav_file+' '+ midi_file_name+" 120")
return midi_file_name
but in the WAV to Midi Block codes of my colab page (link),i get this error:
Vamp::HostExt::PluginLoader: No library found in Vamp path for plugin "mtg-melodia:melodia"
Loading audio...
Extracting melody f0 with MELODIA...
Traceback (most recent call last):
File "/content/audio_to_midi_melodia/audio_to_midi_melodia.py", line 225, in <module>
savejams=args.jams)
File "/content/audio_to_midi_melodia/audio_to_midi_melodia.py", line 174, in audio_to_midi_melodia
parameters={"voicing": 0.2})
File "/usr/local/lib/python3.7/dist-packages/vamp/collect.py", line 166, in collect
plugin, step_size, block_size = vamp.load.load_and_configure(data, sample_rate, plugin_key, parameters, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/vamp/load.py", line 83, in load_and_configure
vampyhost.ADAPT_CHANNEL_COUNT)
TypeError: Failed to load plugin: mtg-melodia:melodia
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-35-c99e6fb96073> in <module>()
84 print('\n'+files+'\n')
85 wav_file=MP3_to_WAV(files)
---> 86 midi_file=wav_to_midi(wav_file)
87
88
2 frames
<ipython-input-35-c99e6fb96073> in execute(command)
55 return output
56 else:
---> 57 raise ProcessException(command, exitCode, output)
58
59
TypeError: __init__() takes 2 positional arguments but 4 were given
I guess it must happened because of the python version mismatching, but is asked here.
Thanks for your attention.
Upvotes: 0
Views: 2367
Reputation: 1224
To install a plugin set, copy the plugin's library file and any supplied category or RDF files into your system or personal Vamp plugin location.
The plugin file extension and the location to copy into depend on which operating system you are using:
Your operating systemFile extension for pluginsWhere to put the plugin filesmacOS.dylib
On a Mac:/Library/Audio/Plug-Ins/Vamp
$HOME/Library/Audio/Plug-Ins/Vamp
Library
folders are hidden by default; see here for details of how to show them.dll
When using a 64-bit version of Windows:C:\Program Files (x86)\Vamp Plugins
C:\Program Files\Vamp Plugins
.dll
When using a 32-bit version of Windows:C:\Program Files\Vamp Plugins
.so
On Linux, BSD systems, etc:/usr/local/lib/vamp
$HOME/vamp
You can alternatively set the VAMP_PATH
environment variable to override the search path for for Vamp plugins. VAMP_PATH
should contain a semicolon-separated (on Windows) or colon-separated (macOS, Linux) list of directory locations. If it is set, it will completely override the standard locations listed above. (N.B. When using 32-bit plugins on 64-bit Windows, some hosts will check for the VAMP_PATH_32
environment variable instead of VAMP_PATH
.)
source from here
Upvotes: 0
Reputation: 566
It looks like the root problem is Vamp::HostExt::PluginLoader: No library found in Vamp path for plugin "mtg-melodia:melodia"
.
So either mtg-melodia:melodia's path needs to be added to Vamp path, or mtg-melodia:melodia needs to be installed and configured.
It looks like you are using the instructions from the following url to set up mtg-melodia. Could you recheck there for mtg-melodia install and configure details, there may have been a step you missed.
https://ourcodeworld.com/articles/read/983/how-to-extract-the-melody-from-an-audio-file-and-export-it-to-midi-generate-quantized-midi-using-python-in-ubuntu-18-04
Upvotes: 1