# Path: pylsdj/bread_spec.py
# def padded_hex(pad_count):
# def hex_array(x):
# EMPTY_BLOCK = 0xff
# NUM_PHRASES = 255
# NUM_TABLES = 32
# NUM_SYNTHS = 16
# WAVES_PER_SYNTH = 16
# FRAMES_PER_WAVE = 32
# ENTRIES_PER_TABLE = 16
# NUM_INSTRUMENTS = 64
# NUM_SONG_CHAINS = 256
# NUM_CHAINS = 128
# PHRASES_PER_CHAIN = 16
# NUM_GROOVES = 32
# STEPS_PER_PHRASE = 16
# STEPS_PER_GROOVE = 16
# STEPS_PER_TABLE = 16
# WORD_LENGTH = 0x10
# NUM_WORDS = 42
# INSTRUMENT_TYPE_CODE = {
#     "pulse": 0,
#     "wave": 1,
#     "kit": 2,
#     "noise": 3
# }
# FX_COMMANDS = {
#     0: '-',
#     1: 'A',
#     2: 'C',
#     3: 'D',
#     4: 'E',
#     5: 'F',
#     6: 'G',
#     7: 'H',
#     8: 'K',
#     9: 'L',
#     10: 'M',
#     11: 'O',
#     12: 'P',
#     13: 'R',
#     14: 'S',
#     15: 'T',
#     16: 'V',
#     17: 'W',
#     18: 'Z',
#     # Arduinoboy-specific
#     19: 'N',
#     20: 'X',
#     21: 'Q',
#     22: 'Y'
# }
# NOTES = ['---']
# NOTES_DICT = {}
# NUM_ROM_KITS = 21
# SAMPLES_PER_KIT = 15
# KIT_SAMPLE_NAME_LENGTH = 3
# KIT_NAME_LENGTH = 6
# SAMPLE_START_ADDRESS = 0x4060
# MAX_SAMPLE_LENGTH = 0x3fa0
# 
# Path: pylsdj/utils.py
# def fixed_width_string(string, width, fill=' '):
#     return string[:width].ljust(fill)


import wave
import bread as b
from .vendor.six.moves import range
from .bread_spec import lsdj_rom_kits, KIT_SAMPLE_NAME_LENGTH, \
    SAMPLES_PER_KIT, KIT_NAME_LENGTH, SAMPLE_START_ADDRESS, MAX_SAMPLE_LENGTH
from .utils import fixed_width_string
            return 0
        else:
            sample_start, sample_end = self._get_sample_data_bounds(index)

            return (sample_end - sample_start + 1)

    def _get_sample_data(self, index):
        if not self._sample_used(index):
            return None

        sample_start, sample_end = self._get_sample_data_bounds(index)

        return bytearray(self._data.sample_data[sample_start:sample_end])

    @property
    def force_loop(self):
        """true if the sample will loop, false otherwise"""
        return self._data.force_loop[self.force_loop_index]

    @force_loop.setter
    def force_loop(self, value):
        self._data.force_loop[self.force_loop_index] = value

    @property
    def name(self):
        """the sample's name"""
        return self._data.sample_names[self.index]

    @name.setter
    def name(self, value):

# Path: pylsdj/bread_spec.py
# def padded_hex(pad_count):
# def hex_array(x):
# EMPTY_BLOCK = 0xff
# NUM_PHRASES = 255
# NUM_TABLES = 32
# NUM_SYNTHS = 16
# WAVES_PER_SYNTH = 16
# FRAMES_PER_WAVE = 32
# ENTRIES_PER_TABLE = 16
# NUM_INSTRUMENTS = 64
# NUM_SONG_CHAINS = 256
# NUM_CHAINS = 128
# PHRASES_PER_CHAIN = 16
# NUM_GROOVES = 32
# STEPS_PER_PHRASE = 16
# STEPS_PER_GROOVE = 16
# STEPS_PER_TABLE = 16
# WORD_LENGTH = 0x10
# NUM_WORDS = 42
# INSTRUMENT_TYPE_CODE = {
#     "pulse": 0,
#     "wave": 1,
#     "kit": 2,
#     "noise": 3
# }
# FX_COMMANDS = {
#     0: '-',
#     1: 'A',
#     2: 'C',
#     3: 'D',
#     4: 'E',
#     5: 'F',
#     6: 'G',
#     7: 'H',
#     8: 'K',
#     9: 'L',
#     10: 'M',
#     11: 'O',
#     12: 'P',
#     13: 'R',
#     14: 'S',
#     15: 'T',
#     16: 'V',
#     17: 'W',
#     18: 'Z',
#     # Arduinoboy-specific
#     19: 'N',
#     20: 'X',
#     21: 'Q',
#     22: 'Y'
# }
# NOTES = ['---']
# NOTES_DICT = {}
# NUM_ROM_KITS = 21
# SAMPLES_PER_KIT = 15
# KIT_SAMPLE_NAME_LENGTH = 3
# KIT_NAME_LENGTH = 6
# SAMPLE_START_ADDRESS = 0x4060
# MAX_SAMPLE_LENGTH = 0x3fa0
# 
# Path: pylsdj/utils.py
# def fixed_width_string(string, width, fill=' '):
#     return string[:width].ljust(fill)


# Path: pylsdj/kits.py
import wave
import bread as b
from .vendor.six.moves import range
from .bread_spec import lsdj_rom_kits, KIT_SAMPLE_NAME_LENGTH, \
    SAMPLES_PER_KIT, KIT_NAME_LENGTH, SAMPLE_START_ADDRESS, MAX_SAMPLE_LENGTH
from .utils import fixed_width_string

            return 0
        else:
            sample_start, sample_end = self._get_sample_data_bounds(index)

            return (sample_end - sample_start + 1)

    def _get_sample_data(self, index):
        if not self._sample_used(index):
            return None

        sample_start, sample_end = self._get_sample_data_bounds(index)

        return bytearray(self._data.sample_data[sample_start:sample_end])

    @property
    def force_loop(self):
        """true if the sample will loop, false otherwise"""
        return self._data.force_loop[self.force_loop_index]

    @force_loop.setter
    def force_loop(self, value):
        self._data.force_loop[self.force_loop_index] = value

    @property
    def name(self):
        """the sample's name"""
        return self._data.sample_names[self.index]

    @name.setter
    def name(self, value):

        self._data.sample_names[self.index] = fixed_width_string(