pysynth/wrappers/querty.py
def decode(self, key, pressed):

        """
        We decode the given keys and convert them into instructions for the sequencer.

        We require a parameter to tell us if the key is being pressed or un-pressed.

        :param key: Key to be handled
        :type key str
        :param pressed: Determines if the key is being pressed or released
        :type pressed: bool
        """

        # Check if key is in notes:

        if key in self.seq.notes:

            # Calculate the note value given the note index, and offset:

            note = Note.from_num(self.seq.off - self.seq.notes.index(key))

            # Send the note to the sequencer, determining on press value:

            if pressed:

                # Toggle the note to be on:

                self.seq.start_note(note, name=self.instrument)

                return

            # Otherwise, lets stop the note:

            self.seq.stop_note(note, name=self.instrument)

            return

        if not pressed:

            # We only care about pressed keys, lets quit:

            return

        # Check if key in instruments:

        if key in self.seq.instrument_selection:

            # Get and set the index of the instrument:

            self.instrument = self.seq.instrument_selection.index(key)

            # Stop all playing notes:

            self.seq.stop_all()

            return

        # Check if we should increment the instrument:

        if key == self.seq.increment:

            # Increment the step by 1:

            self.seq.off += 1

            return

        # Check if we should decrement the instrument:

        if key == self.seq.decrement:

            # Decrement the step by 1:

            self.seq.off -= 1

            return

        # Otherwise, exit as the key is invalid

        return

        We decode the given keys and convert them into instructions for the sequencer.

        We require a parameter to tell us if the key is being pressed or un-pressed.

        :param key: Key to be handled
        :type key str
        :param pressed: Determines if the key is being pressed or released
        :type pressed: bool
        
We decode the given keys and convert them into instructions for the sequencer.
We require a parameter to tell us if the key is being pressed or un-pressed.


We decode the given keys and convert them into instructions for the sequencer . We require a parameter to tell us if the key is being pressed or un - pressed .
def decode(self, key, pressed):
        if key in self.seq.notes:
            note = Note.from_num(self.seq.off - self.seq.notes.index(key))
            if pressed:
                self.seq.start_note(note, name=self.instrument)
                return
            self.seq.stop_note(note, name=self.instrument)
            return
        if not pressed:
            return
        if key in self.seq.instrument_selection:
            self.instrument = self.seq.instrument_selection.index(key)
            self.seq.stop_all()
            return
        if key == self.seq.increment:
            self.seq.off += 1
            return
        if key == self.seq.decrement:
            self.seq.off -= 1
            return
        return
def decode ( self , key , pressed ) : if key in self . seq . notes : note = Note . from_num ( self . seq . off - self . seq . notes . index ( key ) ) if pressed : self . seq . start_note ( note , name = self . instrument ) return self . seq . stop_note ( note , name = self . instrument ) return if not pressed : return if key in self . seq . instrument_selection : self . instrument = self . seq . instrument_selection . index ( key ) self . seq . stop_all ( ) return if key == self . seq . increment : self . seq . off += 1 return if key == self . seq . decrement : self . seq . off -= 1 return return
We decode the given keys and convert them into instructions for the sequencer.
We decode the given keys and convert them into instructions for the sequencer .
"""
        We decode the given keys and convert them into instructions for the sequencer.

        We require a parameter to tell us if the key is being pressed or un-pressed.

        :param key: Key to be handled
        :type key str
        :param pressed: Determines if the key is being pressed or released
        :type pressed: bool
        """ # Check if key is in notes: # Calculate the note value given the note index, and offset: # Send the note to the sequencer, determining on press value: # Toggle the note to be on: # Otherwise, lets stop the note: # We only care about pressed keys, lets quit: # Check if key in instruments: # Get and set the index of the instrument: # Stop all playing notes: # Check if we should increment the instrument: # Increment the step by 1: # Check if we should decrement the instrument: # Decrement the step by 1: # Otherwise, exit as the key is invalid
self
key
pressed