Quantcast
Channel: KVR Audio
Viewing all articles
Browse latest Browse all 4674

MeldaProduction • Re: Drum Map in Cubase for MDrummer

$
0
0
I would still like support for this. As a workaround, I "wrote" a python script that does the conversion from REAPER to Cubase. It's not very convenient, but better than nothing.

Code:

import xml.etree.ElementTree as ETdef convert_reaper_to_cubase_drum_map(reaper_file, cubase_file):    """    Converts REAPER MIDI note names to Cubase drum map XML format.    Args:        reaper_file (str): Path to the REAPER note names file.        cubase_file (str): Path to save the generated Cubase drum map XML file.    """    note_names = {}    with open(reaper_file, 'r') as f:        for line in f:            # Skip comment lines            if line.startswith('#'):                continue            parts = line.strip().split(maxsplit=1)            if len(parts) == 2:                try:                    note_number = int(parts[0])                    note_name = parts[1]                    note_names[note_number] = note_name                except ValueError:                    continue  # Handle potential non-integer lines gracefully    # Create the root element    drum_map = ET.Element("DrumMap")    # Add the Name element    string_element = ET.SubElement(drum_map, "string", name="Name", value=f"{cubase_file.split('.')[0]}", wide="true")    # Add the Quantize list (this is taken from the example, you might need to adjust)    quantize_list = ET.SubElement(drum_map, "list", name="Quantize", type="list")    item_element = ET.SubElement(quantize_list, "item")    ET.SubElement(item_element, "int", name="Grid", value="4")    ET.SubElement(item_element, "int", name="Type", value="0")    ET.SubElement(item_element, "float", name="Swing", value="0")    ET.SubElement(item_element, "int", name="Legato", value="50")    # Create the Map list    map_list = ET.SubElement(drum_map, "list", name="Map", type="list")    # Populate the Map list with items for each MIDI note (0-127)    for note_number in range(128):        item_element = ET.SubElement(map_list, "item")        ET.SubElement(item_element, "int", name="INote", value=str(note_number))        ET.SubElement(item_element, "int", name="ONote", value=str(note_number))        ET.SubElement(item_element, "int", name="Channel", value="0")        ET.SubElement(item_element, "float", name="Length", value="200")        ET.SubElement(item_element, "int", name="Mute", value="0")        ET.SubElement(item_element, "int", name="DisplayNote", value=str(note_number))        ET.SubElement(item_element, "int", name="HeadSymbol", value="0")        ET.SubElement(item_element, "int", name="Voice", value="0")        ET.SubElement(item_element, "int", name="PortIndex", value="0")                #Use names from the file or "..." if missing        note_name = note_names.get(note_number, "...")        ET.SubElement(item_element, "string", name="Name", value=note_name, wide="true")        ET.SubElement(item_element, "int", name="QuantizeIndex", value="0")    # Generate the "Order" list    order_list = ET.SubElement(drum_map, "list", name="Order", type="int")    for note_number in range(128):        item_element = ET.SubElement(order_list, "item", attrib={"value": str(note_number)})        #ET.SubElement(item_element, "int", name="ID", value=str(note_number))    # Write the XML to a file    tree = ET.ElementTree(drum_map)    ET.indent(tree, space="    ")  # Pretty formatting    tree.write(cubase_file, encoding="utf-8", xml_declaration=True)# Example usage (replace with your actual file paths)reaper_file = "mdrummer_note_names.txt"cubase_file = "MDrummerRhythms.drm"  # Cubase drum map extension is .drmconvert_reaper_to_cubase_drum_map(reaper_file, cubase_file)
To use it, export the note names from REAPER and save the file in the same directory as the python script. Change the reaper_file and cubase_file variables at the bottom to the correct file names and run the script without parameters.

Statistics: Posted by Held — Mon Mar 17, 2025 8:35 pm



Viewing all articles
Browse latest Browse all 4674

Trending Articles