Inicial
This commit is contained in:
1 parent
57c10131f5
commit
9da7f3347b
166 files changed
+24550
-23101
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,59 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_automation(file_path):
|
||||
try:
|
||||
tree = ET.parse(file_path)
|
||||
root = tree.getroot()
|
||||
bpm = root.find('./head').attrib.get('bpm', 'N/A')
|
||||
tracks = root.findall('./song/trackcontainer/track')
|
||||
track_info = []
|
||||
|
||||
for track in tracks:
|
||||
track_name = track.attrib.get('name', 'N/A')
|
||||
track_type = track.attrib.get('type')
|
||||
|
||||
# Verificando se o track é do tipo 'Automation' (track_type == '5' ou '6')
|
||||
if track_type in ['5', '6']: # Faixas de automação
|
||||
automation_info = {
|
||||
'automation_name': track_name,
|
||||
'type': 'automation',
|
||||
'automation_patterns': []
|
||||
}
|
||||
|
||||
# Lendo a tag <automationtrack>
|
||||
automationtrack = track.find('./automationtrack')
|
||||
if automationtrack is not None:
|
||||
automation_info['automationtrack'] = 'Present'
|
||||
|
||||
# Lendo as tags de automationpattern (caso existam)
|
||||
for automationpattern in track.findall('./automationpattern'):
|
||||
automation_pattern_info = {
|
||||
'name': automationpattern.attrib.get('name', 'N/A'),
|
||||
'mute': automationpattern.attrib.get('mute', '0'),
|
||||
'len': automationpattern.attrib.get('len', 'N/A'),
|
||||
'pos': automationpattern.attrib.get('pos', '0'),
|
||||
'prog': automationpattern.attrib.get('prog', '0'),
|
||||
'tens': automationpattern.attrib.get('tens', '1'),
|
||||
'times': [] # Inicializando uma lista para os tempos
|
||||
}
|
||||
|
||||
# Extraindo os tempos dentro do <automationpattern>
|
||||
for time in automationpattern.findall('./time'):
|
||||
time_info = {
|
||||
'value': time.attrib.get('value', 'N/A'),
|
||||
'pos': time.attrib.get('pos', 'N/A')
|
||||
}
|
||||
automation_pattern_info['times'].append(time_info)
|
||||
|
||||
# Adicionando os padrões de automação ao track
|
||||
automation_info['automation_patterns'].append(automation_pattern_info)
|
||||
|
||||
track_info.append(automation_info)
|
||||
|
||||
return {
|
||||
'automations': track_info
|
||||
}
|
||||
|
||||
except ET.ParseError as e:
|
||||
print(f'Erro ao analisar o arquivo XML {file_path}: {e}')
|
||||
return None
|
||||
Binary file not shown.
@@ -0,0 +1,135 @@
|
||||
def parse_basslines(track):
|
||||
track_name = track.attrib.get('name', 'N/A')
|
||||
bbtrack = track.find('./bbtrack')
|
||||
instruments = []
|
||||
tags = ''
|
||||
|
||||
if bbtrack is not None:
|
||||
for container in bbtrack.findall('./trackcontainer'):
|
||||
for instrument_track in container.findall('./track'):
|
||||
instrument_info = {}
|
||||
instrument_info['instrument_name'] = instrument_track.attrib.get('name', 'N/A')
|
||||
instrument_info['instrument_type'] = instrument_track.attrib.get('type', 'N/A')
|
||||
#print(instrument_info['tags'])
|
||||
# <instrumenttrack>
|
||||
instrumenttrack = instrument_track.find('./instrumenttrack')
|
||||
if instrumenttrack is not None:
|
||||
instrument_info.update({
|
||||
'pitch': instrumenttrack.attrib.get('pitch', ''),
|
||||
'pan': instrumenttrack.attrib.get('pan', ''),
|
||||
'vol': instrumenttrack.attrib.get('vol', ''),
|
||||
'pitchrange': instrumenttrack.attrib.get('pitchrange', ''),
|
||||
'basenote': instrumenttrack.attrib.get('basenote', ''),
|
||||
'fxch': instrumenttrack.attrib.get('fxch', ''),
|
||||
'usemasterpitch': instrumenttrack.attrib.get('usemasterpitch', '')
|
||||
})
|
||||
|
||||
# <audiofileprocessor>
|
||||
audiofileprocessor = instrument_track.find('.//audiofileprocessor')
|
||||
if audiofileprocessor is not None:
|
||||
if 'audiofileprocessor' not in tags:
|
||||
tags = 'audiofileprocessor'
|
||||
instrument_info['audiofileprocessor'] = {
|
||||
'amp': audiofileprocessor.attrib.get('amp', ''),
|
||||
'src': audiofileprocessor.attrib.get('src', ''),
|
||||
'lframe': audiofileprocessor.attrib.get('lframe', ''),
|
||||
'stutter': audiofileprocessor.attrib.get('stutter', ''),
|
||||
'interp': audiofileprocessor.attrib.get('interp', ''),
|
||||
'sframe': audiofileprocessor.attrib.get('sframe', ''),
|
||||
'looped': audiofileprocessor.attrib.get('looped', ''),
|
||||
'eframe': audiofileprocessor.attrib.get('eframe', ''),
|
||||
'reversed': audiofileprocessor.attrib.get('reversed', ''),
|
||||
}
|
||||
|
||||
# <eldata>
|
||||
eldata = instrument_track.find('./eldata')
|
||||
if eldata is not None:
|
||||
eldata_info = {
|
||||
'fwet': eldata.attrib.get('fwet', ''),
|
||||
'ftype': eldata.attrib.get('ftype', ''),
|
||||
'fcut': eldata.attrib.get('fcut', ''),
|
||||
'fres': eldata.attrib.get('fres', '')
|
||||
}
|
||||
|
||||
elvol = eldata.find('./elvol')
|
||||
if elvol is not None:
|
||||
eldata_info['elvol'] = {
|
||||
'sustain': elvol.attrib.get('sustain', ''),
|
||||
'lamt': elvol.attrib.get('lamt', ''),
|
||||
'lshp': elvol.attrib.get('lshp', ''),
|
||||
'amt': elvol.attrib.get('amt', ''),
|
||||
'pdel': elvol.attrib.get('pdel', ''),
|
||||
'lpdel': elvol.attrib.get('lpdel', ''),
|
||||
'lspd_numerator': elvol.attrib.get('lspd_numerator', ''),
|
||||
'lspd_syncmode': elvol.attrib.get('lspd_syncmode', ''),
|
||||
'latt': elvol.attrib.get('latt', ''),
|
||||
'ctlenvamt': elvol.attrib.get('ctlenvamt', ''),
|
||||
'x100': elvol.attrib.get('x100', ''),
|
||||
'dec': elvol.attrib.get('dec', ''),
|
||||
'hold': elvol.attrib.get('hold', ''),
|
||||
'rel': elvol.attrib.get('rel', ''),
|
||||
'lspd_denominator': elvol.attrib.get('lspd_denominator', ''),
|
||||
'userwavefile': elvol.attrib.get('userwavefile', ''),
|
||||
'att': elvol.attrib.get('att', ''),
|
||||
'lspd': elvol.attrib.get('lspd', '')
|
||||
}
|
||||
|
||||
elcut = eldata.find('./elcut')
|
||||
if elcut is not None:
|
||||
eldata_info['elcut'] = {
|
||||
'cutoff': elcut.attrib.get('cutoff', ''),
|
||||
'q': elcut.attrib.get('q', '')
|
||||
}
|
||||
|
||||
elres = eldata.find('./elres')
|
||||
if elres is not None:
|
||||
eldata_info['elres'] = {
|
||||
'res': elres.attrib.get('res', '')
|
||||
}
|
||||
|
||||
instrument_info['eldata'] = eldata_info
|
||||
|
||||
# <chordcreator>
|
||||
chordcreator = instrument_track.find('./chordcreator')
|
||||
if chordcreator is not None:
|
||||
instrument_info['chordcreator'] = {
|
||||
'chord_enabled': chordcreator.attrib.get('chord-enabled', ''),
|
||||
'chordrange': chordcreator.attrib.get('chordrange', ''),
|
||||
'chord': chordcreator.attrib.get('chord', '')
|
||||
}
|
||||
|
||||
# <arpeggiator>
|
||||
arpeggiator = instrument_track.find('./arpeggiator')
|
||||
if arpeggiator is not None:
|
||||
instrument_info['arpeggiator'] = {
|
||||
'arptime': arpeggiator.attrib.get('arptime', ''),
|
||||
'arpmode': arpeggiator.attrib.get('arpmode', ''),
|
||||
'arp': arpeggiator.attrib.get('arp', ''),
|
||||
'arprange': arpeggiator.attrib.get('arprange', '')
|
||||
}
|
||||
|
||||
# <midiport>
|
||||
midiport = instrument_track.find('./midiport')
|
||||
if midiport is not None:
|
||||
instrument_info['midiport'] = {
|
||||
'outputprogram': midiport.attrib.get('outputprogram', ''),
|
||||
'inputchannel': midiport.attrib.get('inputchannel', ''),
|
||||
'outputcontroller': midiport.attrib.get('outputcontroller', ''),
|
||||
'inputcontroller': midiport.attrib.get('inputcontroller', ''),
|
||||
'outputchannel': midiport.attrib.get('outputchannel', ''),
|
||||
'writable': midiport.attrib.get('writable', ''),
|
||||
'fixedinputvelocity': midiport.attrib.get('fixedinputvelocity', ''),
|
||||
'basevelocity': midiport.attrib.get('basevelocity', ''),
|
||||
'readable': midiport.attrib.get('readable', ''),
|
||||
'fixedoutputvelocity': midiport.attrib.get('fixedoutputvelocity', ''),
|
||||
'fixedoutputnote': midiport.attrib.get('fixedoutputnote', '')
|
||||
}
|
||||
|
||||
instruments.append(instrument_info)
|
||||
|
||||
return {
|
||||
'bassline_name': track_name,
|
||||
'type': 'bassline',
|
||||
'tags': tags, #verificar aqui
|
||||
'instruments': instruments
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
import os
|
||||
import xml.etree.ElementTree as ET
|
||||
import importlib
|
||||
|
||||
from automations.automations import parse_automation
|
||||
from basslines.basslines import parse_basslines
|
||||
from samples.samples import parse_samples
|
||||
from utils import SUPPORTED_PLUGINS
|
||||
|
||||
# Lista dos plugins suportados
|
||||
|
||||
def parse_mmp_file(file_path):
|
||||
if not os.path.exists(file_path):
|
||||
print(f"O arquivo {file_path} não existe!")
|
||||
return None
|
||||
|
||||
try:
|
||||
tree = ET.parse(file_path)
|
||||
root = tree.getroot()
|
||||
|
||||
bpm = root.find('./head').attrib.get('bpm', 'N/A')
|
||||
tracks = root.findall('./song/trackcontainer/track')
|
||||
track_info = []
|
||||
tags = {}
|
||||
tags['TAG'] = []
|
||||
tags['plugin'] = []
|
||||
tags['sample'] = []
|
||||
tags['bassline'] = []
|
||||
tags['automation'] = []
|
||||
|
||||
for track in tracks:
|
||||
track_name = track.attrib.get('name', 'N/A')
|
||||
track_type = track.attrib.get('type')
|
||||
|
||||
if track_type == '0':
|
||||
# Faixas de instrumento
|
||||
# Tem que verificar o sf2, verificar caminhos dos samples.
|
||||
instruments = track.findall('./instrumenttrack')
|
||||
for instrumenttrack in instruments:
|
||||
instrument = instrumenttrack.find('.//instrument')
|
||||
if instrument is not None:
|
||||
plugin_name = instrument.attrib.get('name')
|
||||
if plugin_name:
|
||||
plugin_info = parse_plugin_track(instrumenttrack, plugin_name)
|
||||
if plugin_info:
|
||||
# Adiciona metadados da faixa também
|
||||
plugin_info['track_name'] = track_name
|
||||
plugin_info['type'] = 'plugin'
|
||||
track_info.append(plugin_info)
|
||||
# Marcando os nomes dos plugins presentes
|
||||
if 'plugin' not in tags['TAG']:
|
||||
tags['TAG'].append('plugin')
|
||||
# Se algum plugin estiver com o nome diferente do original
|
||||
if track_name not in tags:
|
||||
if (track_name not in SUPPORTED_PLUGINS and
|
||||
plugin_name not in tags['plugin']):
|
||||
tags['plugin'].append(plugin_name)
|
||||
|
||||
elif track_type == '1': # Bassline (aparentemente, correto)
|
||||
bassline_info = parse_basslines(track)
|
||||
if bassline_info:
|
||||
track_info.append(bassline_info)
|
||||
if bassline_info['tags'] is not None:
|
||||
if 'bassline' not in tags['TAG']: #certo
|
||||
tags['TAG'].append('bassline')
|
||||
if track_name not in tags['TAG']: #certo
|
||||
tags['bassline'].append(track_name)
|
||||
if 'audiofileprocessor' not in tags['plugin']: #certo
|
||||
tags['plugin'].append(bassline_info['tags'])
|
||||
if 'tripleoscillator' not in tags['plugin']:
|
||||
if bassline_info['tags'] == 'tripleoscillator':
|
||||
tags['plugin'].append(bassline_info['tags'])
|
||||
|
||||
|
||||
elif track_type == '2': # Sample (aparentemente, correto)
|
||||
sample_info = parse_samples(file_path, track)
|
||||
if sample_info:
|
||||
track_info.append(sample_info)
|
||||
if 'sample' not in tags['TAG']:
|
||||
tags['TAG'].append('sample')
|
||||
sample_name = sample_info['sample_name']
|
||||
if sample_name == None:
|
||||
sample_name = track_name
|
||||
tags['sample'].append(sample_name)
|
||||
|
||||
elif track_type in ['5', '6']: # Automation (aparentemente, correto)
|
||||
automation_info = parse_automation(file_path)
|
||||
if automation_info:
|
||||
track_info.append(automation_info)
|
||||
if 'automation' not in tags['TAG']:
|
||||
tags['TAG'].append('automation')
|
||||
tags['automation'].append(track_name)
|
||||
|
||||
else:
|
||||
print('\n\n\n\n\n\nERRO\n\n\n\n\n\n')
|
||||
return
|
||||
|
||||
file_name_with_extension = os.path.basename(file_path)
|
||||
file_name, _ = os.path.splitext(file_name_with_extension)
|
||||
|
||||
return {
|
||||
'file': file_name,
|
||||
'src': file_path,
|
||||
'bpm': bpm,
|
||||
'tags': tags,
|
||||
'tracks': track_info
|
||||
}
|
||||
|
||||
except ET.ParseError as e:
|
||||
print(f'Erro ao analisar o arquivo XML {file_path}: {e}')
|
||||
return None
|
||||
|
||||
|
||||
def parse_generic_track(track):
|
||||
track_name = track.attrib.get('name', 'N/A')
|
||||
track_type = track.attrib.get('type')
|
||||
|
||||
return {
|
||||
'track_name': track_name,
|
||||
'type': track_type,
|
||||
'instruments': []
|
||||
}
|
||||
|
||||
|
||||
def parse_plugin_track(instrumenttrack_element, plugin_name):
|
||||
plugin_name = plugin_name.lower()
|
||||
|
||||
if plugin_name not in SUPPORTED_PLUGINS:
|
||||
return {'error': f"Plugin '{plugin_name}' não está na lista de suportados"}
|
||||
|
||||
try:
|
||||
module_path = f"plugins.{plugin_name}"
|
||||
plugin_module = importlib.import_module(module_path)
|
||||
|
||||
if hasattr(plugin_module, 'parse_instrument'):
|
||||
return plugin_module.parse_instrument(instrumenttrack_element)
|
||||
else:
|
||||
return {'error': f"O plugin '{plugin_name}' não possui a função 'parse_instrument'"}
|
||||
|
||||
except ModuleNotFoundError:
|
||||
return {'error': f"Módulo do plugin '{plugin_name}' não encontrado"}
|
||||
except Exception as e:
|
||||
return {'error': f"Erro ao carregar plugin '{plugin_name}': {e}"}
|
||||
@@ -0,0 +1,12 @@
|
||||
# file_saver.py
|
||||
|
||||
import json
|
||||
import yaml
|
||||
|
||||
def save_to_json(data, output_file):
|
||||
with open(output_file, 'w', encoding='utf-8') as f:
|
||||
json.dump(data, f, ensure_ascii=False, indent=4)
|
||||
|
||||
def save_to_yaml(data, output_file):
|
||||
with open(output_file, 'w', encoding='utf-8') as f:
|
||||
yaml.dump(data, f)
|
||||
@@ -0,0 +1,73 @@
|
||||
# main.py
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
from file_parser import parse_mmp_file
|
||||
from file_saver import save_to_json, save_to_yaml
|
||||
from utils import create_folders_if_not_exist
|
||||
|
||||
def process_mmps_in_folder(folder_path):
|
||||
mmp_files = [f for f in os.listdir(folder_path) if f.endswith('.mmp') or f.endswith('.mmpz')]
|
||||
all_data = []
|
||||
|
||||
mmpz_folder = os.path.join(folder_path, '/nethome/jotachina/projetos/mmpSearch/mmp/mmpz')
|
||||
wav_folder = os.path.join(folder_path, '/nethome/jotachina/projetos/mmpSearch/mmp/wav')
|
||||
metadata_folder = os.path.join(folder_path, '/nethome/jotachina/projetos/mmpSearch/metadata')
|
||||
data_folder = os.path.join(folder_path, '/nethome/jotachina/projetos/mmpSearch/_data')
|
||||
|
||||
create_folders_if_not_exist([mmpz_folder, wav_folder, metadata_folder, data_folder])
|
||||
|
||||
for file in mmp_files:
|
||||
file_path = os.path.join(folder_path, file)
|
||||
print(f'Processando arquivo: {file_path}')
|
||||
|
||||
if file.endswith('.mmpz'):
|
||||
destination_path = os.path.join(mmpz_folder, file)
|
||||
shutil.move(file_path, destination_path)
|
||||
print(f'Movido para: {destination_path}')
|
||||
|
||||
mmp_name = os.path.splitext(file)[0] + ".mmp"
|
||||
output_mmp_path = os.path.join(folder_path, mmp_name)
|
||||
convert_cmd = f'lmms --dump "{destination_path}" > "{output_mmp_path}"'
|
||||
|
||||
try:
|
||||
os.environ['QT_QPA_PLATFORM'] = 'offscreen'
|
||||
subprocess.run(convert_cmd, shell=True, check=True)
|
||||
print("Convertido para .mmp com sucesso!")
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Erro ao converter .mmpz para .mmp: {e}")
|
||||
|
||||
wav_output_path = os.path.join(wav_folder, os.path.splitext(file)[0])
|
||||
wav_convert_cmd = f'lmms -r "{destination_path}" -o "{wav_output_path}" -f wav'
|
||||
|
||||
try:
|
||||
subprocess.run(wav_convert_cmd, shell=True, check=True)
|
||||
print("Convertido para .wav com sucesso!")
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Erro ao converter .wav: {e}")
|
||||
|
||||
mmp_data = parse_mmp_file(output_mmp_path)
|
||||
|
||||
elif file.endswith('.mmp'):
|
||||
mmp_data = parse_mmp_file(file_path)
|
||||
|
||||
if mmp_data:
|
||||
all_data.append(mmp_data)
|
||||
|
||||
json_file_path = os.path.join(metadata_folder, os.path.splitext(file)[0] + ".json")
|
||||
yaml_file_path = os.path.join(data_folder, os.path.splitext(file)[0] + ".yml")
|
||||
|
||||
save_to_yaml(mmp_data, yaml_file_path)
|
||||
save_to_json(mmp_data, json_file_path)
|
||||
|
||||
print(f"Dados salvos: {json_file_path}, {yaml_file_path}")
|
||||
|
||||
return all_data
|
||||
|
||||
mmp_folder_path = '/nethome/jotachina/projetos/mmpSearch/mmp'
|
||||
processed_data = process_mmps_in_folder(mmp_folder_path)
|
||||
save_to_json(processed_data, '/nethome/jotachina/projetos/mmpSearch/metadata/all.json')
|
||||
save_to_yaml(processed_data, '/nethome/jotachina/projetos/mmpSearch/_data/all.yml')
|
||||
|
||||
print("Processamento concluído.")
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,55 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_instrument(instrumenttrack_element):
|
||||
instrument_info = {}
|
||||
|
||||
# Atributos básicos do <instrumenttrack>
|
||||
instrument_info['instrumenttrack'] = {
|
||||
'pitch': instrumenttrack_element.attrib.get('pitch', 'N/A'),
|
||||
'pan': instrumenttrack_element.attrib.get('pan', 'N/A'),
|
||||
'pitchrange': instrumenttrack_element.attrib.get('pitchrange', 'N/A'),
|
||||
'basenote': instrumenttrack_element.attrib.get('basenote', 'N/A'),
|
||||
'vol': instrumenttrack_element.attrib.get('vol', 'N/A'),
|
||||
'fxch': instrumenttrack_element.attrib.get('fxch', 'N/A'),
|
||||
'usemasterpitch': instrumenttrack_element.attrib.get('usemasterpitch', 'N/A')
|
||||
}
|
||||
|
||||
# Instrumento
|
||||
instrument = instrumenttrack_element.find('.//instrument')
|
||||
if instrument is not None:
|
||||
instrument_name = instrument.attrib.get('name', 'N/A')
|
||||
instrument_info['plugin_name'] = instrument_name
|
||||
|
||||
plugin_name = instrument_name.lower()
|
||||
plugin_element = instrument.find(f'.//{plugin_name}')
|
||||
if plugin_element is not None:
|
||||
instrument_info[plugin_name] = {
|
||||
key: value for key, value in plugin_element.attrib.items()
|
||||
}
|
||||
|
||||
# Dados de <eldata> e seus filhos
|
||||
eldata = instrumenttrack_element.find('.//eldata')
|
||||
if eldata is not None:
|
||||
instrument_info['eldata'] = {
|
||||
'fwet': eldata.attrib.get('fwet', 'N/A'),
|
||||
'ftype': eldata.attrib.get('ftype', 'N/A'),
|
||||
'fcut': eldata.attrib.get('fcut', 'N/A'),
|
||||
'fres': eldata.attrib.get('fres', 'N/A')
|
||||
}
|
||||
|
||||
for el in ['elvol', 'elcut', 'elres']:
|
||||
el_element = eldata.find(f'.//{el}')
|
||||
if el_element is not None:
|
||||
instrument_info[el] = {
|
||||
key: value for key, value in el_element.attrib.items()
|
||||
}
|
||||
|
||||
# Componentes auxiliares
|
||||
for tag in ['chordcreator', 'arpeggiator', 'midiport', 'fxchain']:
|
||||
tag_element = instrumenttrack_element.find(f'.//{tag}')
|
||||
if tag_element is not None:
|
||||
instrument_info[tag] = {
|
||||
key: value for key, value in tag_element.attrib.items()
|
||||
}
|
||||
|
||||
return instrument_info
|
||||
@@ -0,0 +1,59 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_instrument(instrumenttrack_element):
|
||||
instrument_info = {}
|
||||
|
||||
# Atributos básicos do <instrumenttrack>
|
||||
instrument_info['instrumenttrack'] = {
|
||||
'pitch': instrumenttrack_element.attrib.get('pitch', 'N/A'),
|
||||
'pan': instrumenttrack_element.attrib.get('pan', 'N/A'),
|
||||
'pitchrange': instrumenttrack_element.attrib.get('pitchrange', 'N/A'),
|
||||
'basenote': instrumenttrack_element.attrib.get('basenote', 'N/A'),
|
||||
'vol': instrumenttrack_element.attrib.get('vol', 'N/A'),
|
||||
'fxch': instrumenttrack_element.attrib.get('fxch', 'N/A'),
|
||||
'usemasterpitch': instrumenttrack_element.attrib.get('usemasterpitch', 'N/A')
|
||||
}
|
||||
|
||||
# Instrumento
|
||||
instrument = instrumenttrack_element.find('.//instrument')
|
||||
if instrument is not None:
|
||||
instrument_name = instrument.attrib.get('name', 'N/A')
|
||||
instrument_info['instrument_name'] = instrument_name
|
||||
|
||||
# Verificando e processando o plugin "bitinvader"
|
||||
if instrument_name.lower() == "bitinvader":
|
||||
bitinvader = instrument.find('.//bitinvader')
|
||||
if bitinvader is not None:
|
||||
instrument_info['bitinvader'] = {}
|
||||
|
||||
# Extraindo todos os atributos do bitinvader
|
||||
for key, value in bitinvader.attrib.items():
|
||||
instrument_info['bitinvader'][key] = value
|
||||
|
||||
# Dados de <eldata> e seus filhos
|
||||
eldata = instrumenttrack_element.find('.//eldata')
|
||||
if eldata is not None:
|
||||
instrument_info['eldata'] = {
|
||||
'fwet': eldata.attrib.get('fwet', 'N/A'),
|
||||
'ftype': eldata.attrib.get('ftype', 'N/A'),
|
||||
'fcut': eldata.attrib.get('fcut', 'N/A'),
|
||||
'fres': eldata.attrib.get('fres', 'N/A')
|
||||
}
|
||||
|
||||
# Extraindo dados dos elementos <elvol>, <elcut>, <elres>
|
||||
for el in ['elvol', 'elcut', 'elres']:
|
||||
el_element = eldata.find(f'.//{el}')
|
||||
if el_element is not None:
|
||||
instrument_info[el] = {}
|
||||
for key, value in el_element.attrib.items():
|
||||
instrument_info[el][key] = value
|
||||
|
||||
# Componentes auxiliares
|
||||
for tag in ['chordcreator', 'arpeggiator', 'midiport', 'fxchain']:
|
||||
tag_element = instrumenttrack_element.find(f'.//{tag}')
|
||||
if tag_element is not None:
|
||||
instrument_info[tag] = {}
|
||||
for key, value in tag_element.attrib.items():
|
||||
instrument_info[tag][key] = value
|
||||
|
||||
return instrument_info
|
||||
@@ -0,0 +1,76 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_instrument(instrumenttrack_element):
|
||||
instrument_info = {}
|
||||
|
||||
# Atributos básicos do <instrumenttrack>
|
||||
instrument_info['instrumenttrack'] = {
|
||||
'pitch': instrumenttrack_element.attrib.get('pitch', 'N/A'),
|
||||
'pan': instrumenttrack_element.attrib.get('pan', 'N/A'),
|
||||
'pitchrange': instrumenttrack_element.attrib.get('pitchrange', 'N/A'),
|
||||
'basenote': instrumenttrack_element.attrib.get('basenote', 'N/A'),
|
||||
'vol': instrumenttrack_element.attrib.get('vol', 'N/A'),
|
||||
'fxch': instrumenttrack_element.attrib.get('fxch', 'N/A'),
|
||||
'usemasterpitch': instrumenttrack_element.attrib.get('usemasterpitch', 'N/A')
|
||||
}
|
||||
|
||||
plugins = {}
|
||||
|
||||
# Instrumento
|
||||
instrument = instrumenttrack_element.find('.//instrument')
|
||||
if instrument is not None:
|
||||
instrument_name = instrument.attrib.get('name', 'N/A')
|
||||
instrument_info['instrument_name'] = instrument_name
|
||||
|
||||
# Verificando se há plugins e agrupando-os
|
||||
if instrument_name.lower() == "gigplayer":
|
||||
gigplayer = instrument.find('.//gigplayer')
|
||||
if gigplayer is not None:
|
||||
plugins['gigplayer'] = {
|
||||
key: value for key, value in gigplayer.attrib.items()
|
||||
}
|
||||
|
||||
if instrument_name.lower() == "papu":
|
||||
papu = instrument.find('.//papu')
|
||||
if papu is not None:
|
||||
plugins['papu'] = {
|
||||
key: value for key, value in papu.attrib.items()
|
||||
}
|
||||
|
||||
if instrument_name.lower() == "bitinvader":
|
||||
bitinvader = instrument.find('.//bitinvader')
|
||||
if bitinvader is not None:
|
||||
plugins['bitinvader'] = {
|
||||
key: value for key, value in bitinvader.attrib.items()
|
||||
}
|
||||
|
||||
# Se há plugins, adicionar na informação da track
|
||||
if plugins:
|
||||
instrument_info['plugins'] = plugins
|
||||
|
||||
# Dados de <eldata> e seus filhos
|
||||
eldata = instrumenttrack_element.find('.//eldata')
|
||||
if eldata is not None:
|
||||
instrument_info['eldata'] = {
|
||||
'fwet': eldata.attrib.get('fwet', 'N/A'),
|
||||
'ftype': eldata.attrib.get('ftype', 'N/A'),
|
||||
'fcut': eldata.attrib.get('fcut', 'N/A'),
|
||||
'fres': eldata.attrib.get('fres', 'N/A')
|
||||
}
|
||||
|
||||
for el in ['elvol', 'elcut', 'elres']:
|
||||
el_element = eldata.find(f'.//{el}')
|
||||
if el_element is not None:
|
||||
instrument_info[el] = {
|
||||
key: value for key, value in el_element.attrib.items()
|
||||
}
|
||||
|
||||
# Componentes auxiliares
|
||||
for tag in ['chordcreator', 'arpeggiator', 'midiport', 'fxchain']:
|
||||
tag_element = instrumenttrack_element.find(f'.//{tag}')
|
||||
if tag_element is not None:
|
||||
instrument_info[tag] = {
|
||||
key: value for key, value in tag_element.attrib.items()
|
||||
}
|
||||
|
||||
return instrument_info
|
||||
@@ -0,0 +1,55 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_instrument(instrumenttrack_element):
|
||||
instrument_info = {}
|
||||
|
||||
# Atributos básicos do <instrumenttrack>
|
||||
instrument_info['instrumenttrack'] = {
|
||||
'pitch': instrumenttrack_element.attrib.get('pitch', 'N/A'),
|
||||
'pan': instrumenttrack_element.attrib.get('pan', 'N/A'),
|
||||
'pitchrange': instrumenttrack_element.attrib.get('pitchrange', 'N/A'),
|
||||
'basenote': instrumenttrack_element.attrib.get('basenote', 'N/A'),
|
||||
'vol': instrumenttrack_element.attrib.get('vol', 'N/A'),
|
||||
'fxch': instrumenttrack_element.attrib.get('fxch', 'N/A'),
|
||||
'usemasterpitch': instrumenttrack_element.attrib.get('usemasterpitch', 'N/A')
|
||||
}
|
||||
|
||||
# Instrumento
|
||||
instrument = instrumenttrack_element.find('.//instrument')
|
||||
if instrument is not None:
|
||||
instrument_name = instrument.attrib.get('name', 'N/A')
|
||||
instrument_info['instrument_name'] = instrument_name
|
||||
|
||||
if instrument_name.lower() == "kicker":
|
||||
kicker = instrument.find('.//kicker') # Buscando pelo plugin "kicker"
|
||||
if kicker is not None:
|
||||
instrument_info['kicker'] = {}
|
||||
for key, value in kicker.attrib.items():
|
||||
instrument_info['kicker'][key] = value
|
||||
|
||||
# Dados de <eldata> e seus filhos
|
||||
eldata = instrumenttrack_element.find('.//eldata')
|
||||
if eldata is not None:
|
||||
instrument_info['eldata'] = {
|
||||
'fwet': eldata.attrib.get('fwet', 'N/A'),
|
||||
'ftype': eldata.attrib.get('ftype', 'N/A'),
|
||||
'fcut': eldata.attrib.get('fcut', 'N/A'),
|
||||
'fres': eldata.attrib.get('fres', 'N/A')
|
||||
}
|
||||
|
||||
for el in ['elvol', 'elcut', 'elres']:
|
||||
el_element = eldata.find(f'.//{el}')
|
||||
if el_element is not None:
|
||||
instrument_info[el] = {
|
||||
key: value for key, value in el_element.attrib.items()
|
||||
}
|
||||
|
||||
# Componentes auxiliares
|
||||
for tag in ['chordcreator', 'arpeggiator', 'midiport', 'fxchain']:
|
||||
tag_element = instrumenttrack_element.find(f'.//{tag}')
|
||||
if tag_element is not None:
|
||||
instrument_info[tag] = {
|
||||
key: value for key, value in tag_element.attrib.items()
|
||||
}
|
||||
|
||||
return instrument_info
|
||||
@@ -0,0 +1,55 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_instrument(instrumenttrack_element):
|
||||
instrument_info = {}
|
||||
|
||||
# Atributos básicos do <instrumenttrack>
|
||||
instrument_info['instrumenttrack'] = {
|
||||
'pitch': instrumenttrack_element.attrib.get('pitch', 'N/A'),
|
||||
'pan': instrumenttrack_element.attrib.get('pan', 'N/A'),
|
||||
'pitchrange': instrumenttrack_element.attrib.get('pitchrange', 'N/A'),
|
||||
'basenote': instrumenttrack_element.attrib.get('basenote', 'N/A'),
|
||||
'vol': instrumenttrack_element.attrib.get('vol', 'N/A'),
|
||||
'fxch': instrumenttrack_element.attrib.get('fxch', 'N/A'),
|
||||
'usemasterpitch': instrumenttrack_element.attrib.get('usemasterpitch', 'N/A')
|
||||
}
|
||||
|
||||
# Verifica se o instrumento é o 'lb302'
|
||||
instrument = instrumenttrack_element.find('.//instrument')
|
||||
if instrument is not None:
|
||||
instrument_name = instrument.attrib.get('name', 'N/A')
|
||||
instrument_info['instrument_name'] = instrument_name
|
||||
|
||||
if instrument_name.lower() == "lb302":
|
||||
lb302 = instrument.find('.//lb302') # Buscando pelo plugin "lb302"
|
||||
if lb302 is not None:
|
||||
instrument_info['lb302'] = {}
|
||||
for key, value in lb302.attrib.items():
|
||||
instrument_info['lb302'][key] = value
|
||||
|
||||
# Extraindo os dados do <eldata>
|
||||
eldata = instrumenttrack_element.find('.//eldata')
|
||||
if eldata is not None:
|
||||
instrument_info['eldata'] = {
|
||||
'fwet': eldata.attrib.get('fwet', 'N/A'),
|
||||
'ftype': eldata.attrib.get('ftype', 'N/A'),
|
||||
'fcut': eldata.attrib.get('fcut', 'N/A'),
|
||||
'fres': eldata.attrib.get('fres', 'N/A')
|
||||
}
|
||||
|
||||
for el in ['elvol', 'elcut', 'elres']:
|
||||
el_element = eldata.find(f'.//{el}')
|
||||
if el_element is not None:
|
||||
instrument_info[el] = {
|
||||
key: value for key, value in el_element.attrib.items()
|
||||
}
|
||||
|
||||
# Componentes auxiliares
|
||||
for tag in ['chordcreator', 'arpeggiator', 'midiport', 'fxchain']:
|
||||
tag_element = instrumenttrack_element.find(f'.//{tag}')
|
||||
if tag_element is not None:
|
||||
instrument_info[tag] = {
|
||||
key: value for key, value in tag_element.attrib.items()
|
||||
}
|
||||
|
||||
return instrument_info
|
||||
@@ -0,0 +1,55 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_instrument(instrumenttrack_element):
|
||||
instrument_info = {}
|
||||
|
||||
# Atributos básicos do <instrumenttrack>
|
||||
instrument_info['instrumenttrack'] = {
|
||||
'pitch': instrumenttrack_element.attrib.get('pitch', 'N/A'),
|
||||
'pan': instrumenttrack_element.attrib.get('pan', 'N/A'),
|
||||
'pitchrange': instrumenttrack_element.attrib.get('pitchrange', 'N/A'),
|
||||
'basenote': instrumenttrack_element.attrib.get('basenote', 'N/A'),
|
||||
'vol': instrumenttrack_element.attrib.get('vol', 'N/A'),
|
||||
'fxch': instrumenttrack_element.attrib.get('fxch', 'N/A'),
|
||||
'usemasterpitch': instrumenttrack_element.attrib.get('usemasterpitch', 'N/A')
|
||||
}
|
||||
|
||||
# Verifica se o instrumento é o 'malletsstk'
|
||||
instrument = instrumenttrack_element.find('.//instrument')
|
||||
if instrument is not None:
|
||||
instrument_name = instrument.attrib.get('name', 'N/A')
|
||||
instrument_info['instrument_name'] = instrument_name
|
||||
|
||||
if instrument_name.lower() == "malletsstk":
|
||||
malletsstk = instrument.find('.//malletsstk') # Buscando pelo plugin "malletsstk"
|
||||
if malletsstk is not None:
|
||||
instrument_info['malletsstk'] = {}
|
||||
for key, value in malletsstk.attrib.items():
|
||||
instrument_info['malletsstk'][key] = value
|
||||
|
||||
# Extraindo os dados do <eldata>
|
||||
eldata = instrumenttrack_element.find('.//eldata')
|
||||
if eldata is not None:
|
||||
instrument_info['eldata'] = {
|
||||
'fwet': eldata.attrib.get('fwet', 'N/A'),
|
||||
'ftype': eldata.attrib.get('ftype', 'N/A'),
|
||||
'fcut': eldata.attrib.get('fcut', 'N/A'),
|
||||
'fres': eldata.attrib.get('fres', 'N/A')
|
||||
}
|
||||
|
||||
for el in ['elvol', 'elcut', 'elres']:
|
||||
el_element = eldata.find(f'.//{el}')
|
||||
if el_element is not None:
|
||||
instrument_info[el] = {
|
||||
key: value for key, value in el_element.attrib.items()
|
||||
}
|
||||
|
||||
# Componentes auxiliares
|
||||
for tag in ['chordcreator', 'arpeggiator', 'midiport', 'fxchain']:
|
||||
tag_element = instrumenttrack_element.find(f'.//{tag}')
|
||||
if tag_element is not None:
|
||||
instrument_info[tag] = {
|
||||
key: value for key, value in tag_element.attrib.items()
|
||||
}
|
||||
|
||||
return instrument_info
|
||||
@@ -0,0 +1,55 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_instrument(instrumenttrack_element):
|
||||
instrument_info = {}
|
||||
|
||||
# Atributos básicos do <instrumenttrack>
|
||||
instrument_info['instrumenttrack'] = {
|
||||
'pitch': instrumenttrack_element.attrib.get('pitch', 'N/A'),
|
||||
'pan': instrumenttrack_element.attrib.get('pan', 'N/A'),
|
||||
'pitchrange': instrumenttrack_element.attrib.get('pitchrange', 'N/A'),
|
||||
'basenote': instrumenttrack_element.attrib.get('basenote', 'N/A'),
|
||||
'vol': instrumenttrack_element.attrib.get('vol', 'N/A'),
|
||||
'fxch': instrumenttrack_element.attrib.get('fxch', 'N/A'),
|
||||
'usemasterpitch': instrumenttrack_element.attrib.get('usemasterpitch', 'N/A')
|
||||
}
|
||||
|
||||
# Verifica se o instrumento é o 'monstro'
|
||||
instrument = instrumenttrack_element.find('.//instrument')
|
||||
if instrument is not None:
|
||||
instrument_name = instrument.attrib.get('name', 'N/A')
|
||||
instrument_info['instrument_name'] = instrument_name
|
||||
|
||||
if instrument_name.lower() == "monstro":
|
||||
monstro = instrument.find('.//monstro') # Buscando pelo plugin "monstro"
|
||||
if monstro is not None:
|
||||
instrument_info['monstro'] = {}
|
||||
for key, value in monstro.attrib.items():
|
||||
instrument_info['monstro'][key] = value
|
||||
|
||||
# Extraindo os dados do <eldata>
|
||||
eldata = instrumenttrack_element.find('.//eldata')
|
||||
if eldata is not None:
|
||||
instrument_info['eldata'] = {
|
||||
'fwet': eldata.attrib.get('fwet', 'N/A'),
|
||||
'ftype': eldata.attrib.get('ftype', 'N/A'),
|
||||
'fcut': eldata.attrib.get('fcut', 'N/A'),
|
||||
'fres': eldata.attrib.get('fres', 'N/A')
|
||||
}
|
||||
|
||||
for el in ['elvol', 'elcut', 'elres']:
|
||||
el_element = eldata.find(f'.//{el}')
|
||||
if el_element is not None:
|
||||
instrument_info[el] = {
|
||||
key: value for key, value in el_element.attrib.items()
|
||||
}
|
||||
|
||||
# Componentes auxiliares
|
||||
for tag in ['chordcreator', 'arpeggiator', 'midiport', 'fxchain']:
|
||||
tag_element = instrumenttrack_element.find(f'.//{tag}')
|
||||
if tag_element is not None:
|
||||
instrument_info[tag] = {
|
||||
key: value for key, value in tag_element.attrib.items()
|
||||
}
|
||||
|
||||
return instrument_info
|
||||
@@ -0,0 +1,55 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_instrument(instrumenttrack_element):
|
||||
instrument_info = {}
|
||||
|
||||
# Atributos básicos do <instrumenttrack>
|
||||
instrument_info['instrumenttrack'] = {
|
||||
'pitch': instrumenttrack_element.attrib.get('pitch', 'N/A'),
|
||||
'pan': instrumenttrack_element.attrib.get('pan', 'N/A'),
|
||||
'pitchrange': instrumenttrack_element.attrib.get('pitchrange', 'N/A'),
|
||||
'basenote': instrumenttrack_element.attrib.get('basenote', 'N/A'),
|
||||
'vol': instrumenttrack_element.attrib.get('vol', 'N/A'),
|
||||
'fxch': instrumenttrack_element.attrib.get('fxch', 'N/A'),
|
||||
'usemasterpitch': instrumenttrack_element.attrib.get('usemasterpitch', 'N/A')
|
||||
}
|
||||
|
||||
# Verifica se o instrumento é o 'nes'
|
||||
instrument = instrumenttrack_element.find('.//instrument')
|
||||
if instrument is not None:
|
||||
instrument_name = instrument.attrib.get('name', 'N/A')
|
||||
instrument_info['instrument_name'] = instrument_name
|
||||
|
||||
if instrument_name.lower() == "nes":
|
||||
nescaline = instrument.find('.//nes') # Buscando pelo plugin "nes"
|
||||
if nescaline is not None:
|
||||
instrument_info['nescaline'] = {}
|
||||
for key, value in nescaline.attrib.items():
|
||||
instrument_info['nescaline'][key] = value
|
||||
|
||||
# Extraindo os dados do <eldata>
|
||||
eldata = instrumenttrack_element.find('.//eldata')
|
||||
if eldata is not None:
|
||||
instrument_info['eldata'] = {
|
||||
'fwet': eldata.attrib.get('fwet', 'N/A'),
|
||||
'ftype': eldata.attrib.get('ftype', 'N/A'),
|
||||
'fcut': eldata.attrib.get('fcut', 'N/A'),
|
||||
'fres': eldata.attrib.get('fres', 'N/A')
|
||||
}
|
||||
|
||||
for el in ['elvol', 'elcut', 'elres']:
|
||||
el_element = eldata.find(f'.//{el}')
|
||||
if el_element is not None:
|
||||
instrument_info[el] = {
|
||||
key: value for key, value in el_element.attrib.items()
|
||||
}
|
||||
|
||||
# Componentes auxiliares
|
||||
for tag in ['chordcreator', 'arpeggiator', 'midiport', 'fxchain']:
|
||||
tag_element = instrumenttrack_element.find(f'.//{tag}')
|
||||
if tag_element is not None:
|
||||
instrument_info[tag] = {
|
||||
key: value for key, value in tag_element.attrib.items()
|
||||
}
|
||||
|
||||
return instrument_info
|
||||
@@ -0,0 +1,55 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_instrument(instrumenttrack_element):
|
||||
instrument_info = {}
|
||||
|
||||
# Atributos básicos do <instrumenttrack>
|
||||
instrument_info['instrumenttrack'] = {
|
||||
'pitch': instrumenttrack_element.attrib.get('pitch', 'N/A'),
|
||||
'pan': instrumenttrack_element.attrib.get('pan', 'N/A'),
|
||||
'pitchrange': instrumenttrack_element.attrib.get('pitchrange', 'N/A'),
|
||||
'basenote': instrumenttrack_element.attrib.get('basenote', 'N/A'),
|
||||
'vol': instrumenttrack_element.attrib.get('vol', 'N/A'),
|
||||
'fxch': instrumenttrack_element.attrib.get('fxch', 'N/A'),
|
||||
'usemasterpitch': instrumenttrack_element.attrib.get('usemasterpitch', 'N/A')
|
||||
}
|
||||
|
||||
# Verifica se o instrumento é o 'OPL2'
|
||||
instrument = instrumenttrack_element.find('.//instrument')
|
||||
if instrument is not None:
|
||||
instrument_name = instrument.attrib.get('name', 'N/A')
|
||||
instrument_info['instrument_name'] = instrument_name
|
||||
|
||||
if instrument_name.lower() == "opl2":
|
||||
opl2 = instrument.find('.//OPL2') # Buscando pelo plugin "OPL2"
|
||||
if opl2 is not None:
|
||||
instrument_info['opl2'] = {}
|
||||
for key, value in opl2.attrib.items():
|
||||
instrument_info['opl2'][key] = value
|
||||
|
||||
# Extraindo os dados do <eldata>
|
||||
eldata = instrumenttrack_element.find('.//eldata')
|
||||
if eldata is not None:
|
||||
instrument_info['eldata'] = {
|
||||
'fwet': eldata.attrib.get('fwet', 'N/A'),
|
||||
'ftype': eldata.attrib.get('ftype', 'N/A'),
|
||||
'fcut': eldata.attrib.get('fcut', 'N/A'),
|
||||
'fres': eldata.attrib.get('fres', 'N/A')
|
||||
}
|
||||
|
||||
for el in ['elvol', 'elcut', 'elres']:
|
||||
el_element = eldata.find(f'.//{el}')
|
||||
if el_element is not None:
|
||||
instrument_info[el] = {
|
||||
key: value for key, value in el_element.attrib.items()
|
||||
}
|
||||
|
||||
# Componentes auxiliares
|
||||
for tag in ['chordcreator', 'arpeggiator', 'midiport', 'fxchain']:
|
||||
tag_element = instrumenttrack_element.find(f'.//{tag}')
|
||||
if tag_element is not None:
|
||||
instrument_info[tag] = {
|
||||
key: value for key, value in tag_element.attrib.items()
|
||||
}
|
||||
|
||||
return instrument_info
|
||||
@@ -0,0 +1,55 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_instrument(instrumenttrack_element):
|
||||
instrument_info = {}
|
||||
|
||||
# Atributos básicos do <instrumenttrack>
|
||||
instrument_info['instrumenttrack'] = {
|
||||
'pitch': instrumenttrack_element.attrib.get('pitch', 'N/A'),
|
||||
'pan': instrumenttrack_element.attrib.get('pan', 'N/A'),
|
||||
'pitchrange': instrumenttrack_element.attrib.get('pitchrange', 'N/A'),
|
||||
'basenote': instrumenttrack_element.attrib.get('basenote', 'N/A'),
|
||||
'vol': instrumenttrack_element.attrib.get('vol', 'N/A'),
|
||||
'fxch': instrumenttrack_element.attrib.get('fxch', 'N/A'),
|
||||
'usemasterpitch': instrumenttrack_element.attrib.get('usemasterpitch', 'N/A')
|
||||
}
|
||||
|
||||
# Verifica se o instrumento é o 'organic'
|
||||
instrument = instrumenttrack_element.find('.//instrument')
|
||||
if instrument is not None:
|
||||
instrument_name = instrument.attrib.get('name', 'N/A')
|
||||
instrument_info['instrument_name'] = instrument_name
|
||||
|
||||
if instrument_name.lower() == "organic":
|
||||
organic = instrument.find('.//organic') # Buscando pelo plugin "organic"
|
||||
if organic is not None:
|
||||
instrument_info['organic'] = {}
|
||||
for key, value in organic.attrib.items():
|
||||
instrument_info['organic'][key] = value
|
||||
|
||||
# Extraindo os dados do <eldata>
|
||||
eldata = instrumenttrack_element.find('.//eldata')
|
||||
if eldata is not None:
|
||||
instrument_info['eldata'] = {
|
||||
'fwet': eldata.attrib.get('fwet', 'N/A'),
|
||||
'ftype': eldata.attrib.get('ftype', 'N/A'),
|
||||
'fcut': eldata.attrib.get('fcut', 'N/A'),
|
||||
'fres': eldata.attrib.get('fres', 'N/A')
|
||||
}
|
||||
|
||||
for el in ['elvol', 'elcut', 'elres']:
|
||||
el_element = eldata.find(f'.//{el}')
|
||||
if el_element is not None:
|
||||
instrument_info[el] = {
|
||||
key: value for key, value in el_element.attrib.items()
|
||||
}
|
||||
|
||||
# Componentes auxiliares
|
||||
for tag in ['chordcreator', 'arpeggiator', 'midiport', 'fxchain']:
|
||||
tag_element = instrumenttrack_element.find(f'.//{tag}')
|
||||
if tag_element is not None:
|
||||
instrument_info[tag] = {
|
||||
key: value for key, value in tag_element.attrib.items()
|
||||
}
|
||||
|
||||
return instrument_info
|
||||
@@ -0,0 +1,65 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_instrument(instrumenttrack_element):
|
||||
instrument_info = {}
|
||||
|
||||
# Atributos básicos do <instrumenttrack>
|
||||
instrument_info['instrumenttrack'] = {
|
||||
'pitch': instrumenttrack_element.attrib.get('pitch', 'N/A'),
|
||||
'pan': instrumenttrack_element.attrib.get('pan', 'N/A'),
|
||||
'pitchrange': instrumenttrack_element.attrib.get('pitchrange', 'N/A'),
|
||||
'basenote': instrumenttrack_element.attrib.get('basenote', 'N/A'),
|
||||
'vol': instrumenttrack_element.attrib.get('vol', 'N/A'),
|
||||
'fxch': instrumenttrack_element.attrib.get('fxch', 'N/A'),
|
||||
'usemasterpitch': instrumenttrack_element.attrib.get('usemasterpitch', 'N/A')
|
||||
}
|
||||
|
||||
# Instrumento
|
||||
instrument = instrumenttrack_element.find('.//instrument')
|
||||
if instrument is not None:
|
||||
instrument_name = instrument.attrib.get('name', 'N/A')
|
||||
instrument_info['instrument_name'] = instrument_name
|
||||
|
||||
# Verificar e processar o plugin "papu"
|
||||
if instrument_name.lower() == "papu":
|
||||
papu = instrument.find('.//papu')
|
||||
if papu is not None:
|
||||
instrument_info['papu'] = {
|
||||
key: value for key, value in papu.attrib.items()
|
||||
}
|
||||
|
||||
# Verificar e processar o plugin "bitinvader"
|
||||
if instrument_name.lower() == "bitinvader":
|
||||
bitinvader = instrument.find('.//bitinvader')
|
||||
if bitinvader is not None:
|
||||
instrument_info['bitinvader'] = {
|
||||
key: value for key, value in bitinvader.attrib.items()
|
||||
}
|
||||
|
||||
# Dados de <eldata> e seus filhos
|
||||
eldata = instrumenttrack_element.find('.//eldata')
|
||||
if eldata is not None:
|
||||
instrument_info['eldata'] = {
|
||||
'fwet': eldata.attrib.get('fwet', 'N/A'),
|
||||
'ftype': eldata.attrib.get('ftype', 'N/A'),
|
||||
'fcut': eldata.attrib.get('fcut', 'N/A'),
|
||||
'fres': eldata.attrib.get('fres', 'N/A')
|
||||
}
|
||||
|
||||
# Extraindo dados dos elementos <elvol>, <elcut>, <elres>
|
||||
for el in ['elvol', 'elcut', 'elres']:
|
||||
el_element = eldata.find(f'.//{el}')
|
||||
if el_element is not None:
|
||||
instrument_info[el] = {
|
||||
key: value for key, value in el_element.attrib.items()
|
||||
}
|
||||
|
||||
# Componentes auxiliares
|
||||
for tag in ['chordcreator', 'arpeggiator', 'midiport', 'fxchain']:
|
||||
tag_element = instrumenttrack_element.find(f'.//{tag}')
|
||||
if tag_element is not None:
|
||||
instrument_info[tag] = {
|
||||
key: value for key, value in tag_element.attrib.items()
|
||||
}
|
||||
|
||||
return instrument_info
|
||||
@@ -0,0 +1,55 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_instrument(instrumenttrack_element):
|
||||
instrument_info = {}
|
||||
|
||||
# Atributos básicos do <instrumenttrack>
|
||||
instrument_info['instrumenttrack'] = {
|
||||
'pitch': instrumenttrack_element.attrib.get('pitch', 'N/A'),
|
||||
'pan': instrumenttrack_element.attrib.get('pan', 'N/A'),
|
||||
'pitchrange': instrumenttrack_element.attrib.get('pitchrange', 'N/A'),
|
||||
'basenote': instrumenttrack_element.attrib.get('basenote', 'N/A'),
|
||||
'vol': instrumenttrack_element.attrib.get('vol', 'N/A'),
|
||||
'fxch': instrumenttrack_element.attrib.get('fxch', 'N/A'),
|
||||
'usemasterpitch': instrumenttrack_element.attrib.get('usemasterpitch', 'N/A')
|
||||
}
|
||||
|
||||
# Verifica se o instrumento é o 'patman'
|
||||
instrument = instrumenttrack_element.find('.//instrument')
|
||||
if instrument is not None:
|
||||
instrument_name = instrument.attrib.get('name', 'N/A')
|
||||
instrument_info['instrument_name'] = instrument_name
|
||||
|
||||
if instrument_name.lower() == "patman":
|
||||
patman = instrument.find('.//patman') # Buscando pelo plugin "patman"
|
||||
if patman is not None:
|
||||
instrument_info['patman'] = {}
|
||||
for key, value in patman.attrib.items():
|
||||
instrument_info['patman'][key] = value
|
||||
|
||||
# Extraindo os dados do <eldata>
|
||||
eldata = instrumenttrack_element.find('.//eldata')
|
||||
if eldata is not None:
|
||||
instrument_info['eldata'] = {
|
||||
'fwet': eldata.attrib.get('fwet', 'N/A'),
|
||||
'ftype': eldata.attrib.get('ftype', 'N/A'),
|
||||
'fcut': eldata.attrib.get('fcut', 'N/A'),
|
||||
'fres': eldata.attrib.get('fres', 'N/A')
|
||||
}
|
||||
|
||||
for el in ['elvol', 'elcut', 'elres']:
|
||||
el_element = eldata.find(f'.//{el}')
|
||||
if el_element is not None:
|
||||
instrument_info[el] = {
|
||||
key: value for key, value in el_element.attrib.items()
|
||||
}
|
||||
|
||||
# Componentes auxiliares
|
||||
for tag in ['chordcreator', 'arpeggiator', 'midiport', 'fxchain']:
|
||||
tag_element = instrumenttrack_element.find(f'.//{tag}')
|
||||
if tag_element is not None:
|
||||
instrument_info[tag] = {
|
||||
key: value for key, value in tag_element.attrib.items()
|
||||
}
|
||||
|
||||
return instrument_info
|
||||
@@ -0,0 +1,55 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_instrument(instrumenttrack_element):
|
||||
instrument_info = {}
|
||||
|
||||
# Atributos básicos do <instrumenttrack>
|
||||
instrument_info['instrumenttrack'] = {
|
||||
'pitch': instrumenttrack_element.attrib.get('pitch', 'N/A'),
|
||||
'pan': instrumenttrack_element.attrib.get('pan', 'N/A'),
|
||||
'pitchrange': instrumenttrack_element.attrib.get('pitchrange', 'N/A'),
|
||||
'basenote': instrumenttrack_element.attrib.get('basenote', 'N/A'),
|
||||
'vol': instrumenttrack_element.attrib.get('vol', 'N/A'),
|
||||
'fxch': instrumenttrack_element.attrib.get('fxch', 'N/A'),
|
||||
'usemasterpitch': instrumenttrack_element.attrib.get('usemasterpitch', 'N/A')
|
||||
}
|
||||
|
||||
# Verifica se o instrumento é o 'sf2player'
|
||||
instrument = instrumenttrack_element.find('.//instrument')
|
||||
if instrument is not None:
|
||||
instrument_name = instrument.attrib.get('name', 'N/A')
|
||||
instrument_info['instrument_name'] = instrument_name
|
||||
|
||||
if instrument_name.lower() == "sf2player":
|
||||
sf2player = instrument.find('.//sf2player') # Buscando pelo plugin "sf2player"
|
||||
if sf2player is not None:
|
||||
instrument_info['sf2player'] = {}
|
||||
for key, value in sf2player.attrib.items():
|
||||
instrument_info['sf2player'][key] = value
|
||||
|
||||
# Extraindo os dados do <eldata>
|
||||
eldata = instrumenttrack_element.find('.//eldata')
|
||||
if eldata is not None:
|
||||
instrument_info['eldata'] = {
|
||||
'fwet': eldata.attrib.get('fwet', 'N/A'),
|
||||
'ftype': eldata.attrib.get('ftype', 'N/A'),
|
||||
'fcut': eldata.attrib.get('fcut', 'N/A'),
|
||||
'fres': eldata.attrib.get('fres', 'N/A')
|
||||
}
|
||||
|
||||
for el in ['elvol', 'elcut', 'elres']:
|
||||
el_element = eldata.find(f'.//{el}')
|
||||
if el_element is not None:
|
||||
instrument_info[el] = {
|
||||
key: value for key, value in el_element.attrib.items()
|
||||
}
|
||||
|
||||
# Componentes auxiliares
|
||||
for tag in ['chordcreator', 'arpeggiator', 'midiport', 'fxchain']:
|
||||
tag_element = instrumenttrack_element.find(f'.//{tag}')
|
||||
if tag_element is not None:
|
||||
instrument_info[tag] = {
|
||||
key: value for key, value in tag_element.attrib.items()
|
||||
}
|
||||
|
||||
return instrument_info
|
||||
@@ -0,0 +1,55 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_instrument(instrumenttrack_element):
|
||||
instrument_info = {}
|
||||
|
||||
# Atributos básicos do <instrumenttrack>
|
||||
instrument_info['instrumenttrack'] = {
|
||||
'pitch': instrumenttrack_element.attrib.get('pitch', 'N/A'),
|
||||
'pan': instrumenttrack_element.attrib.get('pan', 'N/A'),
|
||||
'pitchrange': instrumenttrack_element.attrib.get('pitchrange', 'N/A'),
|
||||
'basenote': instrumenttrack_element.attrib.get('basenote', 'N/A'),
|
||||
'vol': instrumenttrack_element.attrib.get('vol', 'N/A'),
|
||||
'fxch': instrumenttrack_element.attrib.get('fxch', 'N/A'),
|
||||
'usemasterpitch': instrumenttrack_element.attrib.get('usemasterpitch', 'N/A')
|
||||
}
|
||||
|
||||
# Verifica se o instrumento é o 'sfxr'
|
||||
instrument = instrumenttrack_element.find('.//instrument')
|
||||
if instrument is not None:
|
||||
instrument_name = instrument.attrib.get('name', 'N/A')
|
||||
instrument_info['instrument_name'] = instrument_name
|
||||
|
||||
if instrument_name.lower() == "sfxr":
|
||||
sfxr = instrument.find('.//sfxr') # Buscando pelo plugin "sfxr"
|
||||
if sfxr is not None:
|
||||
instrument_info['sfxr'] = {}
|
||||
for key, value in sfxr.attrib.items():
|
||||
instrument_info['sfxr'][key] = value
|
||||
|
||||
# Extraindo os dados do <eldata>
|
||||
eldata = instrumenttrack_element.find('.//eldata')
|
||||
if eldata is not None:
|
||||
instrument_info['eldata'] = {
|
||||
'fwet': eldata.attrib.get('fwet', 'N/A'),
|
||||
'ftype': eldata.attrib.get('ftype', 'N/A'),
|
||||
'fcut': eldata.attrib.get('fcut', 'N/A'),
|
||||
'fres': eldata.attrib.get('fres', 'N/A')
|
||||
}
|
||||
|
||||
for el in ['elvol', 'elcut', 'elres']:
|
||||
el_element = eldata.find(f'.//{el}')
|
||||
if el_element is not None:
|
||||
instrument_info[el] = {
|
||||
key: value for key, value in el_element.attrib.items()
|
||||
}
|
||||
|
||||
# Componentes auxiliares
|
||||
for tag in ['chordcreator', 'arpeggiator', 'midiport', 'fxchain']:
|
||||
tag_element = instrumenttrack_element.find(f'.//{tag}')
|
||||
if tag_element is not None:
|
||||
instrument_info[tag] = {
|
||||
key: value for key, value in tag_element.attrib.items()
|
||||
}
|
||||
|
||||
return instrument_info
|
||||
@@ -0,0 +1,55 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_instrument(instrumenttrack_element):
|
||||
instrument_info = {}
|
||||
|
||||
# Atributos básicos do <instrumenttrack>
|
||||
instrument_info['instrumenttrack'] = {
|
||||
'pitch': instrumenttrack_element.attrib.get('pitch', 'N/A'),
|
||||
'pan': instrumenttrack_element.attrib.get('pan', 'N/A'),
|
||||
'pitchrange': instrumenttrack_element.attrib.get('pitchrange', 'N/A'),
|
||||
'basenote': instrumenttrack_element.attrib.get('basenote', 'N/A'),
|
||||
'vol': instrumenttrack_element.attrib.get('vol', 'N/A'),
|
||||
'fxch': instrumenttrack_element.attrib.get('fxch', 'N/A'),
|
||||
'usemasterpitch': instrumenttrack_element.attrib.get('usemasterpitch', 'N/A')
|
||||
}
|
||||
|
||||
# Verifica se o instrumento é o 'sid'
|
||||
instrument = instrumenttrack_element.find('.//instrument')
|
||||
if instrument is not None:
|
||||
instrument_name = instrument.attrib.get('name', 'N/A')
|
||||
instrument_info['instrument_name'] = instrument_name
|
||||
|
||||
if instrument_name.lower() == "sid":
|
||||
sid = instrument.find('.//sid') # Buscando pelo plugin "sid"
|
||||
if sid is not None:
|
||||
instrument_info['sid'] = {}
|
||||
for key, value in sid.attrib.items():
|
||||
instrument_info['sid'][key] = value
|
||||
|
||||
# Extraindo os dados do <eldata>
|
||||
eldata = instrumenttrack_element.find('.//eldata')
|
||||
if eldata is not None:
|
||||
instrument_info['eldata'] = {
|
||||
'fwet': eldata.attrib.get('fwet', 'N/A'),
|
||||
'ftype': eldata.attrib.get('ftype', 'N/A'),
|
||||
'fcut': eldata.attrib.get('fcut', 'N/A'),
|
||||
'fres': eldata.attrib.get('fres', 'N/A')
|
||||
}
|
||||
|
||||
for el in ['elvol', 'elcut', 'elres']:
|
||||
el_element = eldata.find(f'.//{el}')
|
||||
if el_element is not None:
|
||||
instrument_info[el] = {
|
||||
key: value for key, value in el_element.attrib.items()
|
||||
}
|
||||
|
||||
# Componentes auxiliares
|
||||
for tag in ['chordcreator', 'arpeggiator', 'midiport', 'fxchain']:
|
||||
tag_element = instrumenttrack_element.find(f'.//{tag}')
|
||||
if tag_element is not None:
|
||||
instrument_info[tag] = {
|
||||
key: value for key, value in tag_element.attrib.items()
|
||||
}
|
||||
|
||||
return instrument_info
|
||||
@@ -0,0 +1,56 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_instrument(instrumenttrack_element):
|
||||
instrument_info = {}
|
||||
|
||||
# Atributos básicos do <instrumenttrack>
|
||||
instrument_info['instrumenttrack'] = {
|
||||
'pitch': instrumenttrack_element.attrib.get('pitch', 'N/A'),
|
||||
'pan': instrumenttrack_element.attrib.get('pan', 'N/A'),
|
||||
'pitchrange': instrumenttrack_element.attrib.get('pitchrange', 'N/A'),
|
||||
'basenote': instrumenttrack_element.attrib.get('basenote', 'N/A'),
|
||||
'vol': instrumenttrack_element.attrib.get('vol', 'N/A'),
|
||||
'fxch': instrumenttrack_element.attrib.get('fxch', 'N/A'),
|
||||
'usemasterpitch': instrumenttrack_element.attrib.get('usemasterpitch', 'N/A')
|
||||
}
|
||||
|
||||
# Verifica se o instrumento contém o nome
|
||||
instrument = instrumenttrack_element.find('.//instrument')
|
||||
if instrument is not None:
|
||||
instrument_name = instrument.attrib.get('name', 'N/A')
|
||||
instrument_info['instrument_name'] = instrument_name
|
||||
instrument_info['tags'] = instrument_name
|
||||
|
||||
# Verifica o plugin "tripleoscillator"
|
||||
tripleoscillator = instrument.find('.//tripleoscillator')
|
||||
if tripleoscillator is not None:
|
||||
instrument_info['tripleoscillator'] = {}
|
||||
for key, value in tripleoscillator.attrib.items():
|
||||
instrument_info['tripleoscillator'][key] = value
|
||||
|
||||
# Extraindo os dados do <eldata>
|
||||
eldata = instrumenttrack_element.find('.//eldata')
|
||||
if eldata is not None:
|
||||
instrument_info['eldata'] = {
|
||||
'fwet': eldata.attrib.get('fwet', 'N/A'),
|
||||
'ftype': eldata.attrib.get('ftype', 'N/A'),
|
||||
'fcut': eldata.attrib.get('fcut', 'N/A'),
|
||||
'fres': eldata.attrib.get('fres', 'N/A')
|
||||
}
|
||||
|
||||
for el in ['elvol', 'elcut', 'elres']:
|
||||
el_element = eldata.find(f'.//{el}')
|
||||
if el_element is not None:
|
||||
instrument_info[el] = {
|
||||
key: value for key, value in el_element.attrib.items()
|
||||
}
|
||||
|
||||
# Componentes auxiliares
|
||||
for tag in ['chordcreator', 'arpeggiator', 'midiport', 'fxchain']:
|
||||
tag_element = instrumenttrack_element.find(f'.//{tag}')
|
||||
if tag_element is not None:
|
||||
instrument_info[tag] = {
|
||||
key: value for key, value in tag_element.attrib.items()
|
||||
}
|
||||
|
||||
return instrument_info
|
||||
@@ -0,0 +1,62 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_instrument(instrumenttrack_element):
|
||||
try:
|
||||
instrument_info = {}
|
||||
|
||||
# Extraindo os atributos do <instrumenttrack>
|
||||
instrument_info['instrumenttrack'] = {
|
||||
'pitch': instrumenttrack_element.attrib.get('pitch', 'N/A'),
|
||||
'pan': instrumenttrack_element.attrib.get('pan', 'N/A'),
|
||||
'pitchrange': instrumenttrack_element.attrib.get('pitchrange', 'N/A'),
|
||||
'basenote': instrumenttrack_element.attrib.get('basenote', 'N/A'),
|
||||
'vol': instrumenttrack_element.attrib.get('vol', 'N/A'),
|
||||
'fxch': instrumenttrack_element.attrib.get('fxch', 'N/A'),
|
||||
'usemasterpitch': instrumenttrack_element.attrib.get('usemasterpitch', 'N/A')
|
||||
}
|
||||
|
||||
# Extraindo o instrumento e verificando se é o plugin "vibedstrings" ou "tripleoscillator"
|
||||
instrument = instrumenttrack_element.find('.//instrument')
|
||||
if instrument is not None:
|
||||
instrument_name = instrument.attrib.get('name', 'N/A')
|
||||
instrument_info['instrument_name'] = instrument_name
|
||||
|
||||
# Verificar se é o "vibedstrings" e extrair os atributos
|
||||
if instrument_name.lower() == "vibedstrings":
|
||||
vibedstrings = instrument.find('.//vibedstrings') # Buscando pelo plugin "vibedstrings"
|
||||
if vibedstrings is not None:
|
||||
instrument_info['vibedstrings'] = {}
|
||||
for key, value in vibedstrings.attrib.items():
|
||||
instrument_info['vibedstrings'][key] = value
|
||||
|
||||
# Extraindo os dados do <eldata>
|
||||
eldata = instrumenttrack_element.find('.//eldata')
|
||||
if eldata is not None:
|
||||
instrument_info['eldata'] = {
|
||||
'fwet': eldata.attrib.get('fwet', 'N/A'),
|
||||
'ftype': eldata.attrib.get('ftype', 'N/A'),
|
||||
'fcut': eldata.attrib.get('fcut', 'N/A'),
|
||||
'fres': eldata.attrib.get('fres', 'N/A')
|
||||
}
|
||||
|
||||
# Extraindo os elementos <elvol>, <elcut>, <elres>
|
||||
for el in ['elvol', 'elcut', 'elres']:
|
||||
el_element = eldata.find('.//' + el)
|
||||
if el_element is not None:
|
||||
instrument_info[el] = {}
|
||||
for key, value in el_element.attrib.items():
|
||||
instrument_info[el][key] = value
|
||||
|
||||
# Extraindo dados do <chordcreator>, <arpeggiator>, <midiport>, <fxchain>
|
||||
for tag_name in ['chordcreator', 'arpeggiator', 'midiport', 'fxchain']:
|
||||
tag_element = instrumenttrack_element.find('.//' + tag_name)
|
||||
if tag_element is not None:
|
||||
instrument_info[tag_name] = {}
|
||||
for key, value in tag_element.attrib.items():
|
||||
instrument_info[tag_name][key] = value
|
||||
|
||||
return instrument_info
|
||||
|
||||
except ET.ParseError as e:
|
||||
print(f'Erro ao analisar o arquivo XML: {e}')
|
||||
return None
|
||||
@@ -0,0 +1,62 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_instrument(instrumenttrack_element):
|
||||
try:
|
||||
instrument_info = {}
|
||||
|
||||
# Extraindo os atributos do <instrumenttrack>
|
||||
instrument_info['instrumenttrack'] = {
|
||||
'pitch': instrumenttrack_element.attrib.get('pitch', 'N/A'),
|
||||
'pan': instrumenttrack_element.attrib.get('pan', 'N/A'),
|
||||
'pitchrange': instrumenttrack_element.attrib.get('pitchrange', 'N/A'),
|
||||
'basenote': instrumenttrack_element.attrib.get('basenote', 'N/A'),
|
||||
'vol': instrumenttrack_element.attrib.get('vol', 'N/A'),
|
||||
'fxch': instrumenttrack_element.attrib.get('fxch', 'N/A'),
|
||||
'usemasterpitch': instrumenttrack_element.attrib.get('usemasterpitch', 'N/A')
|
||||
}
|
||||
|
||||
# Buscando o nome do plugin
|
||||
instrument = instrumenttrack_element.find('.//instrument')
|
||||
if instrument is not None:
|
||||
instrument_name = instrument.attrib.get('name', 'N/A')
|
||||
instrument_info['instrument_name'] = instrument_name
|
||||
|
||||
# Caso seja o plugin "watsyn", extraímos informações específicas
|
||||
if instrument_name.lower() == "watsyn":
|
||||
watsyn = instrument.find('.//watsyn') # Buscando pelo plugin "watsyn"
|
||||
if watsyn is not None:
|
||||
instrument_info['watsyn'] = {}
|
||||
for key, value in watsyn.attrib.items():
|
||||
instrument_info['watsyn'][key] = value
|
||||
|
||||
# Extraindo os dados do <eldata>
|
||||
eldata = instrumenttrack_element.find('.//eldata')
|
||||
if eldata is not None:
|
||||
instrument_info['eldata'] = {
|
||||
'fwet': eldata.attrib.get('fwet', 'N/A'),
|
||||
'ftype': eldata.attrib.get('ftype', 'N/A'),
|
||||
'fcut': eldata.attrib.get('fcut', 'N/A'),
|
||||
'fres': eldata.attrib.get('fres', 'N/A')
|
||||
}
|
||||
|
||||
# Extraindo os elementos <elvol>, <elcut>, <elres>
|
||||
for el in ['elvol', 'elcut', 'elres']:
|
||||
el_element = eldata.find('.//' + el)
|
||||
if el_element is not None:
|
||||
instrument_info[el] = {}
|
||||
for key, value in el_element.attrib.items():
|
||||
instrument_info[el][key] = value
|
||||
|
||||
# Extraindo dados do <chordcreator>, <arpeggiator>, <midiport>, <fxchain>
|
||||
for tag_name in ['chordcreator', 'arpeggiator', 'midiport', 'fxchain']:
|
||||
tag_element = instrumenttrack_element.find('.//' + tag_name)
|
||||
if tag_element is not None:
|
||||
instrument_info[tag_name] = {}
|
||||
for key, value in tag_element.attrib.items():
|
||||
instrument_info[tag_name][key] = value
|
||||
|
||||
return instrument_info
|
||||
|
||||
except Exception as e:
|
||||
print(f'Erro ao processar o instrumento: {e}')
|
||||
return {'error': f"Erro ao processar o instrumento: {e}"}
|
||||
@@ -0,0 +1,97 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
def parse_instrument(instrumenttrack_element):
|
||||
try:
|
||||
instrument_info = {}
|
||||
|
||||
# Extraindo os atributos do <instrumenttrack>
|
||||
instrument_info['instrumenttrack'] = {
|
||||
'pitch': instrumenttrack_element.attrib.get('pitch', 'N/A'),
|
||||
'pan': instrumenttrack_element.attrib.get('pan', 'N/A'),
|
||||
'pitchrange': instrumenttrack_element.attrib.get('pitchrange', 'N/A'),
|
||||
'basenote': instrumenttrack_element.attrib.get('basenote', 'N/A'),
|
||||
'vol': instrumenttrack_element.attrib.get('vol', 'N/A'),
|
||||
'fxch': instrumenttrack_element.attrib.get('fxch', 'N/A'),
|
||||
'usemasterpitch': instrumenttrack_element.attrib.get('usemasterpitch', 'N/A')
|
||||
}
|
||||
|
||||
# Buscando o nome do plugin
|
||||
instrument = instrumenttrack_element.find('.//instrument')
|
||||
if instrument is not None:
|
||||
instrument_name = instrument.attrib.get('name', 'N/A')
|
||||
instrument_info['instrument_name'] = instrument_name
|
||||
|
||||
# Caso seja o plugin "watsyn", extraímos informações específicas
|
||||
if instrument_name.lower() == "watsyn":
|
||||
watsyn = instrument.find('.//watsyn') # Buscando pelo plugin "watsyn"
|
||||
if watsyn is not None:
|
||||
instrument_info['watsyn'] = {}
|
||||
for key, value in watsyn.attrib.items():
|
||||
instrument_info['watsyn'][key] = value
|
||||
|
||||
# Extraindo os dados do <eldata>
|
||||
eldata = instrumenttrack_element.find('.//eldata')
|
||||
if eldata is not None:
|
||||
instrument_info['eldata'] = {
|
||||
'fwet': eldata.attrib.get('fwet', 'N/A'),
|
||||
'ftype': eldata.attrib.get('ftype', 'N/A'),
|
||||
'fcut': eldata.attrib.get('fcut', 'N/A'),
|
||||
'fres': eldata.attrib.get('fres', 'N/A')
|
||||
}
|
||||
|
||||
# Extraindo os elementos <elvol>, <elcut>, <elres>
|
||||
for el in ['elvol', 'elcut', 'elres']:
|
||||
el_element = eldata.find('.//' + el)
|
||||
if el_element is not None:
|
||||
instrument_info[el] = {}
|
||||
for key, value in el_element.attrib.items():
|
||||
instrument_info[el][key] = value
|
||||
|
||||
# Extraindo dados do <chordcreator>, <arpeggiator>, <midiport>, <fxchain>
|
||||
for tag_name in ['chordcreator', 'arpeggiator', 'midiport', 'fxchain']:
|
||||
tag_element = instrumenttrack_element.find('.//' + tag_name)
|
||||
if tag_element is not None:
|
||||
instrument_info[tag_name] = {}
|
||||
for key, value in tag_element.attrib.items():
|
||||
instrument_info[tag_name][key] = value
|
||||
|
||||
# Extraindo dados do <INSTRUMENT_EFFECTS>, <SYSTEM_EFFECTS>, <INSERTION_EFFECTS>
|
||||
instrument_effects = instrumenttrack_element.findall('.//INSTRUMENT_EFFECTS/INSTRUMENT_EFFECT')
|
||||
if instrument_effects:
|
||||
instrument_info['instrument_effects'] = []
|
||||
for effect in instrument_effects:
|
||||
effect_info = {}
|
||||
for param in effect.findall('.//par'):
|
||||
effect_info[param.attrib['name']] = param.attrib['value']
|
||||
instrument_info['instrument_effects'].append(effect_info)
|
||||
|
||||
system_effects = instrumenttrack_element.findall('.//SYSTEM_EFFECTS/SYSTEM_EFFECT')
|
||||
if system_effects:
|
||||
instrument_info['system_effects'] = []
|
||||
for effect in system_effects:
|
||||
effect_info = {}
|
||||
for param in effect.findall('.//par'):
|
||||
effect_info[param.attrib['name']] = param.attrib['value']
|
||||
instrument_info['system_effects'].append(effect_info)
|
||||
|
||||
insertion_effects = instrumenttrack_element.findall('.//INSERTION_EFFECTS/INSERTION_EFFECT')
|
||||
if insertion_effects:
|
||||
instrument_info['insertion_effects'] = []
|
||||
for effect in insertion_effects:
|
||||
effect_info = {}
|
||||
for param in effect.findall('.//par'):
|
||||
effect_info[param.attrib['name']] = param.attrib['value']
|
||||
instrument_info['insertion_effects'].append(effect_info)
|
||||
|
||||
# Extraindo dados do <CONTROLLER>
|
||||
controller = instrumenttrack_element.find('.//CONTROLLER')
|
||||
if controller is not None:
|
||||
instrument_info['controller'] = {}
|
||||
for param in controller.findall('.//par'):
|
||||
instrument_info['controller'][param.attrib['name']] = param.attrib['value']
|
||||
|
||||
return instrument_info
|
||||
|
||||
except Exception as e:
|
||||
print(f'Erro ao processar o instrumento: {e}')
|
||||
return {'error': f"Erro ao processar o instrumento: {e}"}
|
||||
Binary file not shown.
@@ -0,0 +1,28 @@
|
||||
import os
|
||||
|
||||
def parse_samples(file_path, track):
|
||||
track_name = track.attrib.get('name', 'N/A')
|
||||
|
||||
sample_info = {}
|
||||
sample_name = None
|
||||
|
||||
sampletrack = track.find('./sampletrack')
|
||||
if sampletrack is not None:
|
||||
sample_info['pan'] = sampletrack.attrib.get('pan', '')
|
||||
sample_info['vol'] = sampletrack.attrib.get('vol', '')
|
||||
|
||||
sampletco = track.find('./sampletco')
|
||||
if sampletco is not None:
|
||||
sample_info['src'] = sampletco.attrib.get('src', '')
|
||||
sample_info['len'] = sampletco.attrib.get('len', '')
|
||||
sample_info['sample_rate'] = sampletco.attrib.get('sample_rate', '')
|
||||
sample_info['pos'] = sampletco.attrib.get('pos', '')
|
||||
sample_info['muted'] = sampletco.attrib.get('muted', '')
|
||||
sample_name = os.path.basename(sample_info['src'])
|
||||
|
||||
return {
|
||||
'track_name': track_name,
|
||||
'sample_name': sample_name,
|
||||
'type': 'sample',
|
||||
'sample_info': sample_info,
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
# utils.py
|
||||
|
||||
import os
|
||||
|
||||
SUPPORTED_PLUGINS = [
|
||||
'audiofileprocessor', 'bitinvader', 'freeboy', 'papu', 'gigplayer', 'kicker', 'lb302', 'malletsstk',
|
||||
'monstro', 'nes', 'opl2', 'organic', 'patman', 'sf2player', 'sfxr', 'sid',
|
||||
'tripleoscillator', 'vibedstrings', 'watsyn', 'zynaddsubfx'
|
||||
]
|
||||
|
||||
tags = {}
|
||||
tags['TAG'] = []
|
||||
tags['plugin'] = []
|
||||
tags['sample'] = []
|
||||
tags['bassline'] = []
|
||||
tags['automation'] = []
|
||||
|
||||
def create_folders_if_not_exist(folders):
|
||||
for folder in folders:
|
||||
if not os.path.exists(folder):
|
||||
os.makedirs(folder)
|
||||
Reference in new issue
Block a user