Returns the corresponding midi events for a multi note.
6629
public MidiEvent[] getMidiEventsFor(MultiNote notes, KeySignature key, long elapsedTime) throws InvalidMidiDataException
  {
    Vector notesVector = notes.getNotesAsVector();
    MidiEvent[] events = new MidiEvent[2*notesVector.size()+1];
    for (int j=0; j<notesVector.size(); j++)
    {
      Note note = (Note)(notesVector.elementAt(j));
      float noteLength = getNoteLengthInTicks(note);//, defaultLength);
      if (!note.isRest())
      {
        ShortMessage myNoteOn = new ShortMessage();
        myNoteOn.setMessage(ShortMessage.NOTE_ON, getMidiNoteNumber(note, key), 50);
        events[j] = new MidiEvent(myNoteOn,elapsedTime);
      }
    }

    events[notesVector.size()] = new MidiEvent(new NotationMarkerMessage((MultiNote)notes), elapsedTime);

    for (int j=0; j<notesVector.size(); j++)
    {
      Note note = (Note)(notesVector.elementAt(j));
      long noteLength = getNoteLengthInTicks(note);//, defaultLength);
      if (!note.isRest())
      {
        ShortMessage myNoteOff = new ShortMessage();
        myNoteOff.setMessage(ShortMessage.NOTE_OFF , getMidiNoteNumber(note, key), 50);
        events[notesVector.size()+j+1] = new MidiEvent(myNoteOff,elapsedTime+noteLength);
      }
    }
    return events;
  }
1171499
def remove_note(self, note, octave=-1):
        
        res = []
        for x in self.notes:
            if type(note) == str:
                if x.name != note:
                    res.append(x)
                else:
                    if x.octave != octave and octave != -1:
                        res.append(x)
            else:
                if x != note:
                    res.append(x)
        self.notes = res
        return res
579084
def get_key_signature_accidentals(key='C'):
    """"""
    accidentals = get_key_signature(key)
    res = []

    if accidentals < 0:
        for i in range(-accidentals):
            res.append('{0}{1}'.format(list(reversed(notes.fifths))[i], 'b'))
    elif accidentals > 0:
        for i in range(accidentals):
            res.append('{0}{1}'.format(notes.fifths[i], '#'))
    return res
1167611
def determine(notes):
    
    notes = set(notes)
    res = []

    for key in keys:
        for scale in _Scale.__subclasses__():
            if scale.type == 'major':
                if (notes <= set(scale(key[0]).ascending()) or
                        notes <= set(scale(key[0]).descending())):
                    res.append(scale(key[0]).name)
            elif scale.type == 'minor':
                if (notes <= set(scale(get_notes(key[1])[0]).ascending()) or
                        notes <= set(scale(get_notes(key[1])[0]).descending())):
                    res.append(scale(get_notes(key[1])[0]).name)
    return res
816531
def get_tuning(self):
        
        if self.instrument and self.instrument.tuning:
            return self.instrument.tuning
        return self.tuning
1137819
def can_play_notes(self, notes):
        
        if hasattr(notes, 'notes'):
            notes = notes.notes
        if type(notes) != list:
            notes = [notes]
        for n in notes:
            if not self.note_in_range(n):
                return False
        return True
847808
def get_listeners(self):
        """"""
        return [(name, getattr(self, method_name)) for name, method_name in self.__cog_listeners__]
658704
def keyevent2tuple(event):
    """"""
    return (event.type(), event.key(), event.modifiers(), event.text(),
            event.isAutoRepeat(), event.count())
1169516
def __get_axis_events(self, state, timeval=None):
        """"""
        axis_changes = self.__detect_axis_events(state)
        events = self.__emulate_axis(axis_changes, timeval)
        return events
1191109
async def get_events(
        self, device_ids, group_ids=None, from_time=None, to_time=None, event_types=None
    ):
        """"""
        if to_time is None:
            to_time = datetime.utcnow()
        if from_time is None:
            from_time = to_time - timedelta(seconds=EVENT_INTERVAL)
        if event_types is None:
            event_types = ["allEvents"]

        get_params = []

        get_params.extend([("deviceId", value) for value in device_ids])
        if group_ids is not None:
            get_params.extend([("groupId", value) for value in group_ids])
        get_params.extend([("from", from_time.isoformat() + "Z")])
        get_params.extend([("to", to_time.isoformat() + "Z")])
        get_params.extend([("type", value) for value in event_types])

        data = await self.api("reports/events", get_params)

        if self.connected and self.authenticated:
            self._events = data
        else:
            self._events = self._events

        return self._events
296036
def events(self):
        
        if self._events is None:
            self._events = EventList(self._version, workspace_sid=self._solution['sid'], )
        return self._events
246181
def get_interval(note, interval, key='C'):
    
    intervals = map(lambda x: (notes.note_to_int(key) + x) % 12, [
        0,
        2,
        4,
        5,
        7,
        9,
        11,
        ])
    key_notes = keys.get_notes(key)
    for x in key_notes:
        if x[0] == note[0]:
            result = (intervals[key_notes.index(x)] + interval) % 12
    if result in intervals:
        return key_notes[intervals.index(result)] + note[1:]
    else:
        return notes.diminish(key_notes[intervals.index((result + 1) % 12)]
                               + note[1:])
575655
def _get_events(self, result):
        """""""
        events = []

        for event_data in result:
            event = Event.factory(event_data)

            if event is not None:
                events.append(event)

                if isinstance(event, DeviceStateChangedEvent):
                    # change device state
                    if self.__devices[event.device_url] is None:
                        raise Exception(
                            "Received device change " +
                            "state for unknown device '" +
                            event.device_url + "'")

                    self.__devices[event.device_url].set_active_states(
                        event.states)

        return events
950325
def get_stacked_pianoroll(self):
        
        multitrack = deepcopy(self)
        multitrack.pad_to_same()
        stacked = np.stack([track.pianoroll for track in multitrack.tracks], -1)
        return stacked
427064
function getEvents(duration){

    if (positionCallback == null){
        return [];
    }

    currentPosition = positionCallback();

    if (!currentPosition){

        return [];
        
    }

    const extra = {
        'ik': ['Time'],
        'iv': [utils.getDataPointDuration(duration)],
        'fk': [],
        'fv': []
    };

    return [['vadrPosition', currentPosition, extra]];

}
858490
def events(self):
        
        events = [self.acknowledge_event] + self.verification_events
        return [x for x in events if x]
750789
def _read_midi_length(fileobj):
    """"""

    TEMPO, MIDI = range(2)

    def read_chunk(fileobj):
        info = fileobj.read(8)
        if len(info) != 8:
            raise SMFError("truncated")
        chunklen = struct.unpack(">I", info[4:])[0]
        data = fileobj.read(chunklen)
        if len(data) != chunklen:
            raise SMFError("truncated")
        return info[:4], data

    identifier, chunk = read_chunk(fileobj)
    if identifier != b"MThd":
        raise SMFError("Not a MIDI file")

    if len(chunk) != 6:
        raise SMFError("truncated")

    format_, ntracks, tickdiv = struct.unpack(">HHH", chunk)
    if format_ > 1:
        raise SMFError("Not supported format %d" % format_)

    if tickdiv >> 15:
        # fps = (-(tickdiv >> 8)) & 0xFF
        # subres = tickdiv & 0xFF
        # never saw one of those
        raise SMFError("Not supported timing interval")

    # get a list of events and tempo changes for each track
    tracks = []
    first_tempos = None
    for tracknum in xrange(ntracks):
        identifier, chunk = read_chunk(fileobj)
        if identifier != b"MTrk":
            continue
        events, tempos = _read_track(chunk)

        # In case of format == 1, copy the first tempo list to all tracks
        first_tempos = first_tempos or tempos
        if format_ == 1:
            tempos = list(first_tempos)
        events += tempos
        events.sort()
        tracks.append(events)

    # calculate the duration of each track
    durations = []
    for events in tracks:
        tempo = 500000
        parts = []
        deltasum = 0
        for (dummy, type_, data) in events:
            if type_ == TEMPO:
                parts.append((deltasum, tempo))
                tempo = data
                deltasum = 0
            else:
                deltasum += data
        parts.append((deltasum, tempo))

        duration = 0
        for (deltasum, tempo) in parts:
            quarter, tpq = deltasum / float(tickdiv), tempo
            duration += (quarter * tpq)
        duration /= 10 ** 6

        durations.append(duration)

    # return the longest one
    return max(durations)