Convert a Note object to a midi event and adds it to the
        track_data.

        To set the channel on which to play this note, set Note.channel, the
        same goes for Note.velocity.
349215
def play_Note(self, note):
        
        velocity = 64
        channel = 1
        if hasattr(note, 'dynamics'):
            if 'velocity' in note.dynamics:
                velocity = note.dynamics['velocity']
            if 'channel' in note.dynamics:
                channel = note.dynamics['channel']
        if hasattr(note, 'channel'):
            channel = note.channel
        if hasattr(note, 'velocity'):
            velocity = note.velocity
        if self.change_instrument:
            self.set_instrument(channel, self.instrument)
            self.change_instrument = False
        self.track_data += self.note_on(channel, int(note) + 12, velocity)
267209
function add(track, playbackSuccess, playbackError, statusChange, progressChange) {
        if (!track.url) {
            console.log('ionic-audio: missing track url');
            return;
        }

        angular.extend(track, {
            onSuccess: playbackSuccess,
            onError: playbackError,
            onStatusChange: statusChange,
            onProgress: progressChange,
            status: 0,
            duration: -1,
            progress: 0
        });

        if (find(track)) {
            return track.id;
        }

        track.id  = tracks.push(track) - 1;
        return track.id;
    }
1243750
public void fillInfoPanelWith(Sequence currentSequence, String songName)
	{
		getMidiDuration().setText(Helpers.getTimeStringFromMilliseconds(currentSequence.getMicrosecondLength() / 1000L));
		getMidiName().setText(songName);
		Track[] tracks = currentSequence.getTracks();
		StringBuilder fullText = new StringBuilder();
		for (int t=0; t<tracks.length; t++)
		{
			int size = tracks[t].size();
			for (int ticks=0; ticks<size; ticks++)
			{
				MidiEvent event = tracks[t].get(ticks);
				MidiMessage message = event.getMessage();
				if (message instanceof MetaMessage)
				{
					int type = ((MetaMessage)message).getType();
					if (type <= 0x04)
					{
						fullText.append(new String(((MetaMessage)message).getData())).append('\n');
					}
				}
			}
		}
		getMidiInfo().setText(fullText.toString());
		getMidiInfo().select(0, 0);
	}
803451
def from_Track(track):
    """"""
    # Throw exception
    if not hasattr(track, 'bars'):
        return False
    lastkey = Key('C')
    lasttime = (4, 4)

    # Handle the Bars:
    result = ''
    for bar in track.bars:
        if lastkey != bar.key:
            showkey = True
        else:
            showkey = False
        if lasttime != bar.meter:
            showtime = True
        else:
            showtime = False
        result += from_Bar(bar, showkey, showtime) + ' '
        lastkey = bar.key
        lasttime = bar.meter
    return '{ %s}' % result
132924
def add_note(self, note, octave=None, dynamics={}):
        
        if type(note) == str:
            if octave is not None:
                note = Note(note, octave, dynamics)
            elif len(self.notes) == 0:
                note = Note(note, 4, dynamics)
            else:
                if Note(note, self.notes[-1].octave) < self.notes[-1]:
                    note = Note(note, self.notes[-1].octave + 1, dynamics)
                else:
                    note = Note(note, self.notes[-1].octave, dynamics)
        if not hasattr(note, 'name'):
            raise UnexpectedObjectError("Object '%s' was not expected. "
                    "Expecting a mingus.containers.Note object." % note)
        if note not in self.notes:
            self.notes.append(note)
            self.notes.sort()
        return self.notes
901597
def note_off(self, channel, note, velocity):
        """"""
        return self.midi_event(NOTE_OFF, channel, note, velocity)
760443
def play_tune(self, tune):
        ''''''
        msg = self.message_factory.play_tune_encode(0, 0, tune)
        self.send_mavlink(msg)
651104
function(track, stream) {
    stream.addTrack(track);
    stream.dispatchEvent(new window.MediaStreamTrackEvent('addtrack',
      {track: track}));
  }
165689
def play_track(self, track_id=DEFAULT_TRACK_ID, position=0):
        """"""
        self.publish(
            action='playTrack',
            resource='audioPlayback/player',
            publish_response=False,
            properties={'trackId': track_id, 'position': position}
        )
1308749
public void meta(MetaMessage meta) {
		//System.out.println("Meta Message detected : " + meta.getType());
		if (meta.getType()==MidiMessageType.TEMPO_CHANGE ||
				// Work around part with generic meta message work around
				(meta.getType()==MidiMessageType.MARKER && MetaMessageWA.isTempoMessage(meta))
				) {
			int expectdNotesNbPerMn = TempoMessage.getTempo(meta.getData()).getNotesNumberPerMinute();
			//System.out.println("detected tempo change : " + expectdNotesNbPerMn +
			//		" current seq tempo : " + seq.getTempoInBPM());
			// Work around for JDK 1.5 (seems to work in JDK 1.4....)
			if ((int)seq.getTempoInBPM()!=expectdNotesNbPerMn)
				seq.setTempoInBPM(expectdNotesNbPerMn);
			notifyForTempoChange((int)seq.getTempoInBPM());
		}
		else
			if (meta.getType()==MidiMessageType.NOTE_INDEX_MARKER) {
				//FIXME notifyNotePlayedChange, use MusicReference? what is NoteIndexMessage.getIndex
				//notifyNotePlayedChanged((NoteAbstract)m_tune.getMusic().elementAt(NoteIndexMessage.getIndex(meta.getData())));
			}
			else
				if (MetaMessageWA.isNotationMarker(meta)) {
					//System.out.println("NOTATION MARKER");
					int begin = NotationMarkerMessage.getBeginOffset(meta.getData());
					int end = NotationMarkerMessage.getEndOffset(meta.getData());
					notifyForPartPlayedChanged (begin, end);
				}
				else
					if (meta.getType()==MidiMessageType.END_OF_TRACK) {
						notifyForPlayEnd();
					}
  }
108536
function (format, numTracks) {
  var chunklen = padNumber(6, 4); // MIDI header is always 6 bytes long
  var ntracks = padNumber(numTracks, 2);
  var tickdiv = padNumber(ticksPerBeat, 2);
  format = padNumber(format, 2); // Usually format 1 MIDI file (multuple overlayed tracks)

  return Buffer.concat([midiHeader, chunklen, format, ntracks, tickdiv]);
}
22921
protected void doRowEvent()
	{
		final PatternRow patternRow = currentPattern.getPatternRow(currentRow);
		if (patternRow==null) return;
		
		patternRow.setRowPlayed();
		final int nChannels = mod.getNChannels();
		for (int c=0; c<nChannels; c++)
		{
			// get pattern and channel memory data for current channel
			final PatternElement element = patternRow.getPatternElement(c);
			final ChannelMemory aktMemo = channelMemory[c];
			
			// reset all effects on this channel
			resetAllEffects(aktMemo, element, false);
			
			// Now copy the pattern data but remain old values for note and instrument
			aktMemo.currentElement = element;
			if (element.getPeriod()>0) aktMemo.assignedNotePeriod = element.getPeriod();
			if (element.getNoteIndex()>0) aktMemo.assignedNoteIndex = element.getNoteIndex();
			if (element.getInstrument()>0)
			{
				aktMemo.assignedInstrumentIndex = element.getInstrument();
				aktMemo.assignedInstrument = mod.getInstrumentContainer().getInstrument(element.getInstrument()-1);
			}
			aktMemo.effekt = element.getEffekt(); 
			aktMemo.effektParam = element.getEffektOp();
			aktMemo.volumeEffekt = element.getVolumeEffekt();
			aktMemo.volumeEffektOp = element.getVolumeEffektOp();
			
			// Key Off?
			if (element.getPeriod()==Helpers.KEY_OFF || element.getNoteIndex()==Helpers.KEY_OFF)
			{
				aktMemo.keyOff = true;
			}
			else
			if (element.getPeriod()==Helpers.NOTE_CUT || element.getNoteIndex()==Helpers.NOTE_CUT)
			{
				aktMemo.fadeOutVolume = 0;
			}
			else
			if (!isNoteDelayEffekt(aktMemo)) // If this is a noteDelay, we lose for now, this is all done later!
			{
				setNewInstrumentAndPeriod(aktMemo);
			}
			
			processEffekts(false, aktMemo);
		}
	}
1303442
def _update(self, data: TransDict, *args, **kwargs):
        

        for l in self.listeners:
            l(data, *args, **kwargs)
152735
def play_Track(self, track):
        """"""
        if hasattr(track, 'name'):
            self.set_track_name(track.name)
        self.delay = 0
        instr = track.instrument
        if hasattr(instr, 'instrument_nr'):
            self.change_instrument = True
            self.instrument = instr.instrument_nr
        for bar in track:
            self.play_Bar(bar)
237558
protected void adaptToTune(Tune tune, ScoreMetrics metrics) {
		//reinit the values of the engraving mode
		setMode(m_mode, m_variation);
		
		if (m_mode != NONE) {
			//11=notes spacing at 45px (default font size)
			double ratio = 100 * (11 / metrics.getNotesSpacing()) - 100;
			int oldVariation = m_variation;
			setMode(m_mode, m_variation - (int)ratio);
			m_variation = oldVariation;
			
			Music music = tune.getMusic();
			Note shortestNote = music.getShortestNoteInAllVoices();
			int shortestDuration = Note.SIXTEENTH;
			if (shortestNote != null)
				shortestDuration = shortestNote.getDuration();
			//System.out.println("shortest note duration = "+shortest.getDuration());
			short min = /*(shortestDuration >= Note.QUARTER)
				? Note.SIXTEENTH
				: */Note.SIXTEENTH;
			if (shortestDuration > min) {
				TreeSet set = new TreeSet(spacesAfter.keySet());
				Object[] durations = set.toArray();
				int iMin = 0, iShortest = 0;
				for (int i = 0; i < durations.length; i++) {
					//System.out.println("durations["+i+"] = "+durations[i]);
					int j = (Integer) durations[i];
					if (j == min)
						iMin = i;
					if (j == shortestDuration)
						iShortest = i;
				}
				int offset = (iShortest>iMin)?iShortest - iMin:0;
				if (offset != 0) {
					for (int i = durations.length-1; i >= iShortest; i--) {
						//DEBUG
						/*String s = "";
						for (Iterator itSet = set.iterator(); itSet.hasNext();) {
							Integer i2 = (Integer) itSet.next();
							System.out.print(i2+"\t");
							s += getSpaceAfter(i2.intValue())+"\t";
						}
						System.out.println("\n"+s);*/
						setSpaceAfter((Integer) durations[i],
							getSpaceAfter((Integer) durations[i - offset])
							);
					}
				}
				//System.out.println(spaceAfter.keySet().toArray());
				//System.out.println(spaceAfter.entrySet().toArray());
			}
		}
	}
743279
def attach(self, gui):
        """"""
        super(WaveformView, self).attach(gui)
        self.actions.add(self.toggle_waveform_overlap)
        self.actions.add(self.toggle_show_labels)
        self.actions.separator()

        # Box scaling.
        self.actions.add(self.widen)
        self.actions.add(self.narrow)
        self.actions.separator()
        self.actions.add(self.increase)
        self.actions.add(self.decrease)
        self.actions.separator()

        # Probe scaling.
        self.actions.add(self.extend_horizontally)
        self.actions.add(self.shrink_horizontally)
        self.actions.separator()
        self.actions.add(self.extend_vertically)
        self.actions.add(self.shrink_vertically)

        # We forward the event from VisPy to the phy GUI.
        @self.connect
        def on_channel_click(e):
            gui.emit('channel_click',
                     channel_id=e.channel_id,
                     key=e.key,
                     button=e.button,
                     )
1307610
function (notes, settings) {
  var noteEvents = makeNoteEvents(notes, settings);
  var setPatch = makePatchEvent(0, settings.melodyPatch);
  var length = setPatch.length + noteEvents.length + trackFooter.length;

  return Buffer.concat([trackHeader, padNumber(length, 4), setPatch, noteEvents, trackFooter]);
}