Skip to content

Commit

Permalink
[Roland D-50] Now change the D-50 to use the new expanded GenericRola…
Browse files Browse the repository at this point in the history
…nd module. This passes tests, but we cannot load bank dumps yet.
  • Loading branch information
christofmuc committed May 13, 2024
1 parent 71ed27c commit 5b051c2
Showing 1 changed file with 47 additions and 18 deletions.
65 changes: 47 additions & 18 deletions adaptations/RolandD50.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
#

# The Roland D-50 implements the Roland Exclusive Format Type IV, and thus is a good Roland example
import sys
from typing import List

import knobkraft
import testing
from roland import DataBlock, RolandData, GenericRoland

roland_id = 0x41 # Roland
model_id = 0b00010100 # D-50
Expand All @@ -20,18 +22,53 @@
[chr(x) for x in range(ord('a'), ord('z') + 1)] + \
[chr(x) for x in range(ord('1'), ord('9') + 1)] + ['0', '-']


def name():
return "Roland D-50"


def createDeviceDetectMessage(channel):
this_module = sys.modules[__name__]

# The D50 patch data
_d50_patch_data = [DataBlock((0x00, 0x00, 0x00), 0x40, "Upper partial-1"),
DataBlock((0x00, 0x00, 0x40), 0x40, "Upper partial-2"),
DataBlock((0x00, 0x01, 0x00), 0x40, "Upper common"),
DataBlock((0x00, 0x01, 0x40), 0x40, "Lower partial-1"),
DataBlock((0x00, 0x02, 0x00), 0x40, "Lower partial-2"),
DataBlock((0x00, 0x02, 0x40), 0x40, "Lower common"),
DataBlock((0x00, 0x03, 0x00), 0x40, "Patch"),
]
_d50_edit_buffer_addresses = RolandData("D-50 Temporary Patch"
, num_items=1
, num_address_bytes=3
, num_size_bytes=3
, base_address=(0x00, 0x00, 0x00)
, blocks=_d50_patch_data
, uses_consecutive_addresses=True)
_d50_program_buffer_addresses = RolandData("D-50 Internal Patch"
, num_items=0x40
, num_address_bytes=3
, num_size_bytes=3
, base_address=(0x02, 0x00, 0x00)
, blocks=_d50_patch_data
, uses_consecutive_addresses=True)
d_50 = GenericRoland("Roland D-50",
model_id=[model_id],
address_size=3,
edit_buffer=_d50_edit_buffer_addresses,
program_dump=_d50_program_buffer_addresses,
device_detect_message=_d50_edit_buffer_addresses,
patch_name_message_number=6, # Different from more modern Rolands the patch name is in message number 6, not 0
patch_name_length=18, # Longer than the normal 12 characters!
use_roland_character_set=True,
uses_consecutive_addresses=True
)

d_50.install(this_module)


def old_createDeviceDetectMessage(channel):
# Just request the upper common block from the edit buffer - if we get a reply, there is a D-50
# Command is RQ1 = 0x11, the address is 0 1 0, the size is 0x40 for one block
return buildRolandMessage(channel, command_rq1, [0x00, 0x01, 0x00], [0x00, 0x00, 0x40])


def channelIfValidDeviceResponse(message):
def old_channelIfValidDeviceResponse(message):
# We are expecting a DT1 message response (command 0x12)
if isOwnSysex(message):
command, address, data = parseRolandMessage(message)
Expand All @@ -40,14 +77,6 @@ def channelIfValidDeviceResponse(message):
return -1


def nameFromDump(message):
patch_parts = knobkraft.splitSysex(message)
command, address, data = parseRolandMessage(patch_parts[6])
if command == command_dt1 and address == [0x00, 0x03, 0x00]:
return "".join([character_set[x] for x in data[:18]])
raise Exception("Error in Roland D-50 data structure - did not find Patch data block")


def loadD50BankDump(messages):
# The Bank dumps of the D-50 basically are just a lists of messages with the whole memory content of the synth
# We need to put them together, and then can read the individual data items from the RAM
Expand Down Expand Up @@ -107,16 +136,16 @@ def index_to_address(index):


def make_test_data():

def make_patches(test_data: testing.TestData) -> List[testing.ProgramTestData]:
# Quick test of device detect
detectMessage = createDeviceDetectMessage(0x7)
detectMessage = old_createDeviceDetectMessage(0x7)
g_command, g_address, g_data = parseRolandMessage(detectMessage)
assert (g_command == command_rq1)
assert (g_address == [0x00, 0x01, 0x00])
assert (g_data == [0x00, 0x00, 0x40])

patches = loadD50BankDump(test_data.all_messages)
yield testing.ProgramTestData(message=patches[0], name="SOUNDTRACK II ")
yield testing.ProgramTestData(message=patches[17], name="DIMENSIONAL PAD ")

return testing.TestData(sysex=R"testData/Roland_D50_DIGITAL DREAMS.syx", program_generator=make_patches)
return testing.TestData(sysex=R"testData/Roland_D50_DIGITAL DREAMS.syx", edit_buffer_generator=make_patches)

0 comments on commit 5b051c2

Please sign in to comment.