PageRenderTime 48ms CodeModel.GetById 3ms app.highlight 34ms RepoModel.GetById 2ms app.codeStats 0ms

/apidocs/echonest.support.midi.MidiFileParser-pysrc.html

http://echo-nest-remix.googlecode.com/
HTML | 346 lines | 315 code | 10 blank | 21 comment | 0 complexity | 6fb1e3747e04b89a73490fa61cc5e18c MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1<?xml version="1.0" encoding="ascii"?>
  2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  3          "DTD/xhtml1-transitional.dtd">
  4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  5<head>
  6  <title>echonest.support.midi.MidiFileParser</title>
  7  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  8  <script type="text/javascript" src="epydoc.js"></script>
  9</head>
 10
 11<body bgcolor="white" text="black" link="blue" vlink="#204080"
 12      alink="#204080">
 13<!-- ==================== NAVIGATION BAR ==================== -->
 14<table class="navbar" border="0" width="100%" cellpadding="0"
 15       bgcolor="#a0c0ff" cellspacing="0">
 16  <tr valign="middle">
 17
 18  <!-- Tree link -->
 19      <th>&nbsp;&nbsp;&nbsp;<a
 20        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
 21
 22  <!-- Index link -->
 23      <th>&nbsp;&nbsp;&nbsp;<a
 24        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
 25
 26  <!-- Help link -->
 27      <th>&nbsp;&nbsp;&nbsp;<a
 28        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
 29
 30  <!-- Project homepage -->
 31      <th class="navbar" align="right" width="100%">
 32        <table border="0" cellpadding="0" cellspacing="0">
 33          <tr><th class="navbar" align="center"
 34            ><a class="navbar" target="_top" href="http://code.google.com/p/echo-nest-remix/">Project Homepage</a></th>
 35          </tr></table></th>
 36  </tr>
 37</table>
 38<table width="100%" cellpadding="0" cellspacing="0">
 39  <tr valign="top">
 40    <td width="100%">
 41      <span class="breadcrumbs">
 42        <a href="echonest-module.html">Package&nbsp;echonest</a> ::
 43        <a href="echonest.support-module.html">Package&nbsp;support</a> ::
 44        <a href="echonest.support.midi-module.html">Package&nbsp;midi</a> ::
 45        Module&nbsp;MidiFileParser
 46      </span>
 47    </td>
 48    <td>
 49      <table cellpadding="0" cellspacing="0">
 50        <!-- hide/show private -->
 51        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
 52    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
 53        <tr><td align="right"><span class="options"
 54            >[<a href="frames.html" target="_top">frames</a
 55            >]&nbsp;|&nbsp;<a href="echonest.support.midi.MidiFileParser-pysrc.html"
 56            target="_top">no&nbsp;frames</a>]</span></td></tr>
 57      </table>
 58    </td>
 59  </tr>
 60</table>
 61<h1 class="epydoc">Source Code for <a href="echonest.support.midi.MidiFileParser-module.html">Module echonest.support.midi.MidiFileParser</a></h1>
 62<pre class="py-src">
 63<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment"># -*- coding: ISO-8859-1 -*-</tt>
 </tt>
 64<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line">
 </tt>
 65<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-comment"># std library</tt>
 </tt>
 66<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">struct</tt> <tt class="py-keyword">import</tt> <tt class="py-name">unpack</tt> </tt>
 67<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line">
 </tt>
 68<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-comment"># uhh I don't really like this, but there are so many constants to </tt>
 </tt>
 69<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-comment"># import otherwise</tt>
 </tt>
 70<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-0" class="py-name" targets="Module echonest.support.midi.constants=echonest.support.midi.constants-module.html"><a title="echonest.support.midi.constants" class="py-name" href="#" onclick="return doclink('link-0', 'constants', 'link-0');">constants</a></tt> <tt class="py-keyword">import</tt> <tt class="py-op">*</tt> </tt>
 71<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line">
 </tt>
 72<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-1" class="py-name" targets="Module echonest.support.midi.EventDispatcher=echonest.support.midi.EventDispatcher-module.html,Class echonest.support.midi.EventDispatcher.EventDispatcher=echonest.support.midi.EventDispatcher.EventDispatcher-class.html"><a title="echonest.support.midi.EventDispatcher
 73echonest.support.midi.EventDispatcher.EventDispatcher" class="py-name" href="#" onclick="return doclink('link-1', 'EventDispatcher', 'link-1');">EventDispatcher</a></tt> <tt class="py-keyword">import</tt> <tt id="link-2" class="py-name"><a title="echonest.support.midi.EventDispatcher
 74echonest.support.midi.EventDispatcher.EventDispatcher" class="py-name" href="#" onclick="return doclink('link-2', 'EventDispatcher', 'link-1');">EventDispatcher</a></tt> </tt>
 75<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line">
 </tt>
 76<a name="MidiFileParser"></a><div id="MidiFileParser-def"><a name="L12"></a><tt class="py-lineno"> 12</tt> <a class="py-toggle" href="#" id="MidiFileParser-toggle" onclick="return toggle('MidiFileParser');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="echonest.support.midi.MidiFileParser.MidiFileParser-class.html">MidiFileParser</a><tt class="py-op">:</tt> </tt>
 77</div><div id="MidiFileParser-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="MidiFileParser-expanded"><a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line">
 </tt>
 78<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line">    <tt class="py-docstring">"""
</tt> </tt>
 79<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-docstring">    
</tt> </tt>
 80<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-docstring">    The MidiFileParser is the lowest level parser that see the data as 
</tt> </tt>
 81<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-docstring">    midi data. It generates events that gets triggered on the outstream.
</tt> </tt>
 82<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-docstring">    
</tt> </tt>
 83<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
 84<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line">
 </tt>
 85<a name="MidiFileParser.__init__"></a><div id="MidiFileParser.__init__-def"><a name="L21"></a><tt class="py-lineno"> 21</tt> <a class="py-toggle" href="#" id="MidiFileParser.__init__-toggle" onclick="return toggle('MidiFileParser.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.support.midi.MidiFileParser.MidiFileParser-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">raw_in</tt><tt class="py-op">,</tt> <tt class="py-param">outstream</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
 86</div><div id="MidiFileParser.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="MidiFileParser.__init__-expanded"><a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line">
 </tt>
 87<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line">        <tt class="py-docstring">"""
</tt> </tt>
 88<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-docstring">        raw_data is the raw content of a midi file as a string.
</tt> </tt>
 89<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
 90<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line">
 </tt>
 91<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line">        <tt class="py-comment"># internal values, don't mess with 'em directly</tt>
 </tt>
 92<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">raw_in</tt> <tt class="py-op">=</tt> <tt class="py-name">raw_in</tt> </tt>
 93<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dispatch</tt> <tt class="py-op">=</tt> <tt id="link-3" class="py-name"><a title="echonest.support.midi.EventDispatcher
 94echonest.support.midi.EventDispatcher.EventDispatcher" class="py-name" href="#" onclick="return doclink('link-3', 'EventDispatcher', 'link-1');">EventDispatcher</a></tt><tt class="py-op">(</tt><tt class="py-name">outstream</tt><tt class="py-op">)</tt> </tt>
 95<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line">
 </tt>
 96<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line">        <tt class="py-comment"># Used to keep track of stuff</tt>
 </tt>
 97<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_running_status</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
 98</div><a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line">
 </tt>
 99<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line">
 </tt>
100<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line">
 </tt>
101<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line">
 </tt>
102<a name="MidiFileParser.parseMThdChunk"></a><div id="MidiFileParser.parseMThdChunk-def"><a name="L37"></a><tt class="py-lineno"> 37</tt> <a class="py-toggle" href="#" id="MidiFileParser.parseMThdChunk-toggle" onclick="return toggle('MidiFileParser.parseMThdChunk');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.support.midi.MidiFileParser.MidiFileParser-class.html#parseMThdChunk">parseMThdChunk</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
103</div><div id="MidiFileParser.parseMThdChunk-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="MidiFileParser.parseMThdChunk-expanded"><a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line">        
 </tt>
104<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line">        <tt class="py-docstring">"Parses the header chunk"</tt> </tt>
105<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line">        
 </tt>
106<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line">        <tt class="py-name">raw_in</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">raw_in</tt> </tt>
107<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line">
 </tt>
108<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line">        <tt class="py-name">header_chunk_type</tt> <tt class="py-op">=</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-4" class="py-name" targets="Method echonest.support.midi.RawInstreamFile.RawInstreamFile.nextSlice()=echonest.support.midi.RawInstreamFile.RawInstreamFile-class.html#nextSlice"><a title="echonest.support.midi.RawInstreamFile.RawInstreamFile.nextSlice" class="py-name" href="#" onclick="return doclink('link-4', 'nextSlice', 'link-4');">nextSlice</a></tt><tt class="py-op">(</tt><tt class="py-number">4</tt><tt class="py-op">)</tt> </tt>
109<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line">        <tt class="py-name">header_chunk_zise</tt> <tt class="py-op">=</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-5" class="py-name" targets="Function echonest.support.midi.DataTypeConverters.readBew()=echonest.support.midi.DataTypeConverters-module.html#readBew,Method echonest.support.midi.RawInstreamFile.RawInstreamFile.readBew()=echonest.support.midi.RawInstreamFile.RawInstreamFile-class.html#readBew"><a title="echonest.support.midi.DataTypeConverters.readBew
110echonest.support.midi.RawInstreamFile.RawInstreamFile.readBew" class="py-name" href="#" onclick="return doclink('link-5', 'readBew', 'link-5');">readBew</a></tt><tt class="py-op">(</tt><tt class="py-number">4</tt><tt class="py-op">)</tt> </tt>
111<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line">
 </tt>
112<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line">        <tt class="py-comment"># check if it is a proper midi file</tt>
 </tt>
113<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">header_chunk_type</tt> <tt class="py-op">!=</tt> <tt class="py-string">'MThd'</tt><tt class="py-op">:</tt> </tt>
114<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">TypeError</tt><tt class="py-op">,</tt> <tt class="py-string">"It is not a valid midi file!"</tt> </tt>
115<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line">
 </tt>
116<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line">        <tt class="py-comment"># Header values are at fixed locations, so no reason to be clever</tt>
 </tt>
117<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">format</tt> <tt class="py-op">=</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-6" class="py-name"><a title="echonest.support.midi.DataTypeConverters.readBew
118echonest.support.midi.RawInstreamFile.RawInstreamFile.readBew" class="py-name" href="#" onclick="return doclink('link-6', 'readBew', 'link-5');">readBew</a></tt><tt class="py-op">(</tt><tt class="py-number">2</tt><tt class="py-op">)</tt> </tt>
119<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">nTracks</tt> <tt class="py-op">=</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-7" class="py-name"><a title="echonest.support.midi.DataTypeConverters.readBew
120echonest.support.midi.RawInstreamFile.RawInstreamFile.readBew" class="py-name" href="#" onclick="return doclink('link-7', 'readBew', 'link-5');">readBew</a></tt><tt class="py-op">(</tt><tt class="py-number">2</tt><tt class="py-op">)</tt> </tt>
121<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">division</tt> <tt class="py-op">=</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-8" class="py-name"><a title="echonest.support.midi.DataTypeConverters.readBew
122echonest.support.midi.RawInstreamFile.RawInstreamFile.readBew" class="py-name" href="#" onclick="return doclink('link-8', 'readBew', 'link-5');">readBew</a></tt><tt class="py-op">(</tt><tt class="py-number">2</tt><tt class="py-op">)</tt> </tt>
123<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line">        
 </tt>
124<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line">        <tt class="py-comment"># Theoretically a header larger than 6 bytes can exist</tt>
 </tt>
125<a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line">        <tt class="py-comment"># but no one has seen one in the wild</tt>
 </tt>
126<a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line">        <tt class="py-comment"># But correctly ignore unknown data if it is though</tt>
 </tt>
127<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">header_chunk_zise</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">6</tt><tt class="py-op">:</tt> </tt>
128<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line">            <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-9" class="py-name" targets="Method echonest.support.midi.RawInstreamFile.RawInstreamFile.moveCursor()=echonest.support.midi.RawInstreamFile.RawInstreamFile-class.html#moveCursor"><a title="echonest.support.midi.RawInstreamFile.RawInstreamFile.moveCursor" class="py-name" href="#" onclick="return doclink('link-9', 'moveCursor', 'link-9');">moveCursor</a></tt><tt class="py-op">(</tt><tt class="py-name">header_chunk_zise</tt><tt class="py-op">-</tt><tt class="py-number">6</tt><tt class="py-op">)</tt> </tt>
129<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line">
 </tt>
130<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line">        <tt class="py-comment"># call the header event handler on the stream</tt>
 </tt>
131<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dispatch</tt><tt class="py-op">.</tt><tt id="link-10" class="py-name" targets="Method echonest.support.midi.EventDispatcher.EventDispatcher.header()=echonest.support.midi.EventDispatcher.EventDispatcher-class.html#header,Method echonest.support.midi.MidiOutFile.MidiOutFile.header()=echonest.support.midi.MidiOutFile.MidiOutFile-class.html#header,Method echonest.support.midi.MidiOutStream.MidiOutStream.header()=echonest.support.midi.MidiOutStream.MidiOutStream-class.html#header,Method echonest.support.midi.MidiToText.MidiToText.header()=echonest.support.midi.MidiToText.MidiToText-class.html#header"><a title="echonest.support.midi.EventDispatcher.EventDispatcher.header
132echonest.support.midi.MidiOutFile.MidiOutFile.header
133echonest.support.midi.MidiOutStream.MidiOutStream.header
134echonest.support.midi.MidiToText.MidiToText.header" class="py-name" href="#" onclick="return doclink('link-10', 'header', 'link-10');">header</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">format</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">nTracks</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">division</tt><tt class="py-op">)</tt> </tt>
135</div><a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line">
 </tt>
136<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line">
 </tt>
137<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line">
 </tt>
138<a name="MidiFileParser.parseMTrkChunk"></a><div id="MidiFileParser.parseMTrkChunk-def"><a name="L66"></a><tt class="py-lineno"> 66</tt> <a class="py-toggle" href="#" id="MidiFileParser.parseMTrkChunk-toggle" onclick="return toggle('MidiFileParser.parseMTrkChunk');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.support.midi.MidiFileParser.MidiFileParser-class.html#parseMTrkChunk">parseMTrkChunk</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
139</div><div id="MidiFileParser.parseMTrkChunk-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="MidiFileParser.parseMTrkChunk-expanded"><a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line">        
 </tt>
140<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line">        <tt class="py-docstring">"Parses a track chunk. This is the most important part of the parser."</tt> </tt>
141<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line">        
 </tt>
142<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line">        <tt class="py-comment"># set time to 0 at start of a track</tt>
 </tt>
143<a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dispatch</tt><tt class="py-op">.</tt><tt id="link-11" class="py-name" targets="Method echonest.support.midi.EventDispatcher.EventDispatcher.reset_time()=echonest.support.midi.EventDispatcher.EventDispatcher-class.html#reset_time,Method echonest.support.midi.MidiOutStream.MidiOutStream.reset_time()=echonest.support.midi.MidiOutStream.MidiOutStream-class.html#reset_time"><a title="echonest.support.midi.EventDispatcher.EventDispatcher.reset_time
144echonest.support.midi.MidiOutStream.MidiOutStream.reset_time" class="py-name" href="#" onclick="return doclink('link-11', 'reset_time', 'link-11');">reset_time</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
145<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line">        
 </tt>
146<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line">        <tt class="py-name">dispatch</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dispatch</tt> </tt>
147<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line">        <tt class="py-name">raw_in</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">raw_in</tt> </tt>
148<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line">        
 </tt>
149<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line">        <tt class="py-comment"># Trigger event at the start of a track</tt>
 </tt>
150<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line">        <tt class="py-name">dispatch</tt><tt class="py-op">.</tt><tt id="link-12" class="py-name" targets="Method echonest.support.midi.EventDispatcher.EventDispatcher.start_of_track()=echonest.support.midi.EventDispatcher.EventDispatcher-class.html#start_of_track,Method echonest.support.midi.MidiOutFile.MidiOutFile.start_of_track()=echonest.support.midi.MidiOutFile.MidiOutFile-class.html#start_of_track,Method echonest.support.midi.MidiOutStream.MidiOutStream.start_of_track()=echonest.support.midi.MidiOutStream.MidiOutStream-class.html#start_of_track,Method echonest.support.midi.MidiToText.MidiToText.start_of_track()=echonest.support.midi.MidiToText.MidiToText-class.html#start_of_track"><a title="echonest.support.midi.EventDispatcher.EventDispatcher.start_of_track
151echonest.support.midi.MidiOutFile.MidiOutFile.start_of_track
152echonest.support.midi.MidiOutStream.MidiOutStream.start_of_track
153echonest.support.midi.MidiToText.MidiToText.start_of_track" class="py-name" href="#" onclick="return doclink('link-12', 'start_of_track', 'link-12');">start_of_track</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_current_track</tt><tt class="py-op">)</tt> </tt>
154<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line">        <tt class="py-comment"># position cursor after track header</tt>
 </tt>
155<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line">        <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-13" class="py-name"><a title="echonest.support.midi.RawInstreamFile.RawInstreamFile.moveCursor" class="py-name" href="#" onclick="return doclink('link-13', 'moveCursor', 'link-9');">moveCursor</a></tt><tt class="py-op">(</tt><tt class="py-number">4</tt><tt class="py-op">)</tt> </tt>
156<a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line">        <tt class="py-comment"># unsigned long is 4 bytes</tt>
 </tt>
157<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line">        <tt class="py-name">tracklength</tt> <tt class="py-op">=</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-14" class="py-name"><a title="echonest.support.midi.DataTypeConverters.readBew
158echonest.support.midi.RawInstreamFile.RawInstreamFile.readBew" class="py-name" href="#" onclick="return doclink('link-14', 'readBew', 'link-5');">readBew</a></tt><tt class="py-op">(</tt><tt class="py-number">4</tt><tt class="py-op">)</tt> </tt>
159<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line">        <tt class="py-name">track_endposition</tt> <tt class="py-op">=</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-15" class="py-name" targets="Method echonest.support.midi.RawInstreamFile.RawInstreamFile.getCursor()=echonest.support.midi.RawInstreamFile.RawInstreamFile-class.html#getCursor"><a title="echonest.support.midi.RawInstreamFile.RawInstreamFile.getCursor" class="py-name" href="#" onclick="return doclink('link-15', 'getCursor', 'link-15');">getCursor</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt class="py-name">tracklength</tt> <tt class="py-comment"># absolute position!</tt> </tt>
160<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line">
 </tt>
161<a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line">        <tt class="py-keyword">while</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-16" class="py-name"><a title="echonest.support.midi.RawInstreamFile.RawInstreamFile.getCursor" class="py-name" href="#" onclick="return doclink('link-16', 'getCursor', 'link-15');">getCursor</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">&lt;</tt> <tt class="py-name">track_endposition</tt><tt class="py-op">:</tt> </tt>
162<a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line">        
 </tt>
163<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line">            <tt class="py-comment"># find relative time of the event</tt>
 </tt>
164<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line">            <tt class="py-name">time</tt> <tt class="py-op">=</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-17" class="py-name" targets="Method echonest.support.midi.RawInstreamFile.RawInstreamFile.readVarLen()=echonest.support.midi.RawInstreamFile.RawInstreamFile-class.html#readVarLen"><a title="echonest.support.midi.RawInstreamFile.RawInstreamFile.readVarLen" class="py-name" href="#" onclick="return doclink('link-17', 'readVarLen', 'link-17');">readVarLen</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
165<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line">            <tt class="py-name">dispatch</tt><tt class="py-op">.</tt><tt id="link-18" class="py-name" targets="Method echonest.support.midi.EventDispatcher.EventDispatcher.update_time()=echonest.support.midi.EventDispatcher.EventDispatcher-class.html#update_time,Method echonest.support.midi.MidiOutStream.MidiOutStream.update_time()=echonest.support.midi.MidiOutStream.MidiOutStream-class.html#update_time"><a title="echonest.support.midi.EventDispatcher.EventDispatcher.update_time
166echonest.support.midi.MidiOutStream.MidiOutStream.update_time" class="py-name" href="#" onclick="return doclink('link-18', 'update_time', 'link-18');">update_time</a></tt><tt class="py-op">(</tt><tt class="py-name">time</tt><tt class="py-op">)</tt> </tt>
167<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line">            
 </tt>
168<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line">            <tt class="py-comment"># be aware of running status!!!!</tt>
 </tt>
169<a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line">            <tt class="py-name">peak_ahead</tt> <tt class="py-op">=</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-19" class="py-name"><a title="echonest.support.midi.DataTypeConverters.readBew
170echonest.support.midi.RawInstreamFile.RawInstreamFile.readBew" class="py-name" href="#" onclick="return doclink('link-19', 'readBew', 'link-5');">readBew</a></tt><tt class="py-op">(</tt><tt class="py-name">move_cursor</tt><tt class="py-op">=</tt><tt class="py-number">0</tt><tt class="py-op">)</tt> </tt>
171<a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-op">(</tt><tt class="py-name">peak_ahead</tt> <tt class="py-op">&amp;</tt> <tt class="py-number">0x80</tt><tt class="py-op">)</tt><tt class="py-op">:</tt>  </tt>
172<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line">                <tt class="py-comment"># the status byte has the high bit set, so it</tt>
 </tt>
173<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line">                <tt class="py-comment"># was not running data but proper status byte</tt>
 </tt>
174<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">                <tt class="py-name">status</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_running_status</tt> <tt class="py-op">=</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-20" class="py-name"><a title="echonest.support.midi.DataTypeConverters.readBew
175echonest.support.midi.RawInstreamFile.RawInstreamFile.readBew" class="py-name" href="#" onclick="return doclink('link-20', 'readBew', 'link-5');">readBew</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
176<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
177<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line">                <tt class="py-comment"># use that darn running status</tt>
 </tt>
178<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">                <tt class="py-name">status</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_running_status</tt> </tt>
179<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">                <tt class="py-comment"># could it be illegal data ?? Do we need to test for that?</tt>
 </tt>
180<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line">                <tt class="py-comment"># I need more example midi files to be shure.</tt>
 </tt>
181<a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line">                
 </tt>
182<a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line">                <tt class="py-comment"># Also, while I am almost certain that no realtime </tt>
 </tt>
183<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line">                <tt class="py-comment"># messages will pop up in a midi file, I might need to </tt>
 </tt>
184<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line">                <tt class="py-comment"># change my mind later.</tt>
 </tt>
185<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line">
 </tt>
186<a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line">            <tt class="py-comment"># we need to look at nibbles here</tt>
 </tt>
187<a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line">            <tt class="py-name">hi_nible</tt><tt class="py-op">,</tt> <tt class="py-name">lo_nible</tt> <tt class="py-op">=</tt> <tt class="py-name">status</tt> <tt class="py-op">&amp;</tt> <tt class="py-number">0xF0</tt><tt class="py-op">,</tt> <tt class="py-name">status</tt> <tt class="py-op">&amp;</tt> <tt class="py-number">0x0F</tt> </tt>
188<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line">            
 </tt>
189<a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line">            <tt class="py-comment"># match up with events</tt>
 </tt>
190<a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line">
 </tt>
191<a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line">            <tt class="py-comment"># Is it a meta_event ??</tt>
 </tt>
192<a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line">            <tt class="py-comment"># these only exists in midi files, not in transmitted midi data</tt>
 </tt>
193<a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line">            <tt class="py-comment"># In transmitted data META_EVENT (0xFF) is a system reset</tt>
 </tt>
194<a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">status</tt> <tt class="py-op">==</tt> <tt id="link-21" class="py-name" targets="Variable echonest.support.midi.constants.META_EVENT=echonest.support.midi.constants-module.html#META_EVENT"><a title="echonest.support.midi.constants.META_EVENT" class="py-name" href="#" onclick="return doclink('link-21', 'META_EVENT', 'link-21');">META_EVENT</a></tt><tt class="py-op">:</tt> </tt>
195<a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line">                <tt class="py-name">meta_type</tt> <tt class="py-op">=</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-22" class="py-name"><a title="echonest.support.midi.DataTypeConverters.readBew
196echonest.support.midi.RawInstreamFile.RawInstreamFile.readBew" class="py-name" href="#" onclick="return doclink('link-22', 'readBew', 'link-5');">readBew</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
197<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line">                <tt class="py-name">meta_length</tt> <tt class="py-op">=</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-23" class="py-name"><a title="echonest.support.midi.RawInstreamFile.RawInstreamFile.readVarLen" class="py-name" href="#" onclick="return doclink('link-23', 'readVarLen', 'link-17');">readVarLen</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
198<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line">                <tt class="py-name">meta_data</tt> <tt class="py-op">=</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-24" class="py-name"><a title="echonest.support.midi.RawInstreamFile.RawInstreamFile.nextSlice" class="py-name" href="#" onclick="return doclink('link-24', 'nextSlice', 'link-4');">nextSlice</a></tt><tt class="py-op">(</tt><tt class="py-name">meta_length</tt><tt class="py-op">)</tt> </tt>
199<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line">                <tt class="py-name">dispatch</tt><tt class="py-op">.</tt><tt id="link-25" class="py-name" targets="Method echonest.support.midi.EventDispatcher.EventDispatcher.meta_event()=echonest.support.midi.EventDispatcher.EventDispatcher-class.html#meta_event,Method echonest.support.midi.MidiOutFile.MidiOutFile.meta_event()=echonest.support.midi.MidiOutFile.MidiOutFile-class.html#meta_event,Method echonest.support.midi.MidiOutStream.MidiOutStream.meta_event()=echonest.support.midi.MidiOutStream.MidiOutStream-class.html#meta_event,Method echonest.support.midi.MidiToText.MidiToText.meta_event()=echonest.support.midi.MidiToText.MidiToText-class.html#meta_event"><a title="echonest.support.midi.EventDispatcher.EventDispatcher.meta_event
200echonest.support.midi.MidiOutFile.MidiOutFile.meta_event
201echonest.support.midi.MidiOutStream.MidiOutStream.meta_event
202echonest.support.midi.MidiToText.MidiToText.meta_event" class="py-name" href="#" onclick="return doclink('link-25', 'meta_event', 'link-25');">meta_event</a></tt><tt class="py-op">(</tt><tt class="py-name">meta_type</tt><tt class="py-op">,</tt> <tt class="py-name">meta_data</tt><tt class="py-op">)</tt> </tt>
203<a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line">
 </tt>
204<a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line">
 </tt>
205<a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line">            <tt class="py-comment"># Is it a sysex_event ??</tt>
 </tt>
206<a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">status</tt> <tt class="py-op">==</tt> <tt id="link-26" class="py-name" targets="Variable echonest.support.midi.constants.SYSTEM_EXCLUSIVE=echonest.support.midi.constants-module.html#SYSTEM_EXCLUSIVE"><a title="echonest.support.midi.constants.SYSTEM_EXCLUSIVE" class="py-name" href="#" onclick="return doclink('link-26', 'SYSTEM_EXCLUSIVE', 'link-26');">SYSTEM_EXCLUSIVE</a></tt><tt class="py-op">:</tt> </tt>
207<a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line">                <tt class="py-comment"># ignore sysex events</tt>
 </tt>
208<a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line">                <tt class="py-name">sysex_length</tt> <tt class="py-op">=</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-27" class="py-name"><a title="echonest.support.midi.RawInstreamFile.RawInstreamFile.readVarLen" class="py-name" href="#" onclick="return doclink('link-27', 'readVarLen', 'link-17');">readVarLen</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
209<a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line">                <tt class="py-comment"># don't read sysex terminator</tt>
 </tt>
210<a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line">                <tt class="py-name">sysex_data</tt> <tt class="py-op">=</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-28" class="py-name"><a title="echonest.support.midi.RawInstreamFile.RawInstreamFile.nextSlice" class="py-name" href="#" onclick="return doclink('link-28', 'nextSlice', 'link-4');">nextSlice</a></tt><tt class="py-op">(</tt><tt class="py-name">sysex_length</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">)</tt> </tt>
211<a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line">                <tt class="py-comment"># only read last data byte if it is a sysex terminator</tt>
 </tt>
212<a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line">                <tt class="py-comment"># It should allways be there, but better safe than sorry</tt>
 </tt>
213<a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-29" class="py-name"><a title="echonest.support.midi.DataTypeConverters.readBew
214echonest.support.midi.RawInstreamFile.RawInstreamFile.readBew" class="py-name" href="#" onclick="return doclink('link-29', 'readBew', 'link-5');">readBew</a></tt><tt class="py-op">(</tt><tt class="py-name">move_cursor</tt><tt class="py-op">=</tt><tt class="py-number">0</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt id="link-30" class="py-name" targets="Variable echonest.support.midi.constants.END_OFF_EXCLUSIVE=echonest.support.midi.constants-module.html#END_OFF_EXCLUSIVE"><a title="echonest.support.midi.constants.END_OFF_EXCLUSIVE" class="py-name" href="#" onclick="return doclink('link-30', 'END_OFF_EXCLUSIVE', 'link-30');">END_OFF_EXCLUSIVE</a></tt><tt class="py-op">:</tt> </tt>
215<a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line">                    <tt class="py-name">eo_sysex</tt> <tt class="py-op">=</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-31" class="py-name"><a title="echonest.support.midi.DataTypeConverters.readBew
216echonest.support.midi.RawInstreamFile.RawInstreamFile.readBew" class="py-name" href="#" onclick="return doclink('link-31', 'readBew', 'link-5');">readBew</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
217<a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line">                <tt class="py-name">dispatch</tt><tt class="py-op">.</tt><tt id="link-32" class="py-name" targets="Method echonest.support.midi.EventDispatcher.EventDispatcher.sysex_event()=echonest.support.midi.EventDispatcher.EventDispatcher-class.html#sysex_event,Method echonest.support.midi.MidiToText.MidiToText.sysex_event()=echonest.support.midi.MidiToText.MidiToText-class.html#sysex_event"><a title="echonest.support.midi.EventDispatcher.EventDispatcher.sysex_event
218echonest.support.midi.MidiToText.MidiToText.sysex_event" class="py-name" href="#" onclick="return doclink('link-32', 'sysex_event', 'link-32');">sysex_event</a></tt><tt class="py-op">(</tt><tt class="py-name">sysex_data</tt><tt class="py-op">)</tt> </tt>
219<a name="L132"></a><tt class="py-lineno">132</tt>  <tt class="py-line">                <tt class="py-comment"># the sysex code has not been properly tested, and might be fishy!</tt>
 </tt>
220<a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line">
 </tt>
221<a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line">
 </tt>
222<a name="L135"></a><tt class="py-lineno">135</tt>  <tt class="py-line">            <tt class="py-comment"># is it a system common event?</tt>
 </tt>
223<a name="L136"></a><tt class="py-lineno">136</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">hi_nible</tt> <tt class="py-op">==</tt> <tt class="py-number">0xF0</tt><tt class="py-op">:</tt> <tt class="py-comment"># Hi bits are set then</tt> </tt>
224<a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line">                <tt class="py-name">data_sizes</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt>
 </tt>
225<a name="L138"></a><tt class="py-lineno">138</tt>  <tt class="py-line">                    <tt id="link-33" class="py-name" targets="Variable echonest.support.midi.constants.MTC=echonest.support.midi.constants-module.html#MTC"><a title="echonest.support.midi.constants.MTC" class="py-name" href="#" onclick="return doclink('link-33', 'MTC', 'link-33');">MTC</a></tt><tt class="py-op">:</tt><tt class="py-number">1</tt><tt class="py-op">,</tt>
 </tt>
226<a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line">                    <tt id="link-34" class="py-name" targets="Variable echonest.support.midi.constants.SONG_POSITION_POINTER=echonest.support.midi.constants-module.html#SONG_POSITION_POINTER"><a title="echonest.support.midi.constants.SONG_POSITION_POINTER" class="py-name" href="#" onclick="return doclink('link-34', 'SONG_POSITION_POINTER', 'link-34');">SONG_POSITION_POINTER</a></tt><tt class="py-op">:</tt><tt class="py-number">2</tt><tt class="py-op">,</tt>
 </tt>
227<a name="L140"></a><tt class="py-lineno">140</tt>  <tt class="py-line">                    <tt id="link-35" class="py-name" targets="Variable echonest.support.midi.constants.SONG_SELECT=echonest.support.midi.constants-module.html#SONG_SELECT"><a title="echonest.support.midi.constants.SONG_SELECT" class="py-name" href="#" onclick="return doclink('link-35', 'SONG_SELECT', 'link-35');">SONG_SELECT</a></tt><tt class="py-op">:</tt><tt class="py-number">1</tt><tt class="py-op">,</tt>
 </tt>
228<a name="L141"></a><tt class="py-lineno">141</tt>  <tt class="py-line">                <tt class="py-op">}</tt> </tt>
229<a name="L142"></a><tt class="py-lineno">142</tt>  <tt class="py-line">                <tt class="py-name">data_size</tt> <tt class="py-op">=</tt> <tt class="py-name">data_sizes</tt><tt class="py-op">.</tt><tt id="link-36" class="py-name" targets="Method echonest.action.Edit.get()=echonest.action.Edit-class.html#get"><a title="echonest.action.Edit.get" class="py-name" href="#" onclick="return doclink('link-36', 'get', 'link-36');">get</a></tt><tt class="py-op">(</tt><tt class="py-name">hi_nible</tt><tt class="py-op">,</tt> <tt class="py-number">0</tt><tt class="py-op">)</tt> </tt>
230<a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line">                <tt class="py-name">common_data</tt> <tt class="py-op">=</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-37" class="py-name"><a title="echonest.support.midi.RawInstreamFile.RawInstreamFile.nextSlice" class="py-name" href="#" onclick="return doclink('link-37', 'nextSlice', 'link-4');">nextSlice</a></tt><tt class="py-op">(</tt><tt class="py-name">data_size</tt><tt class="py-op">)</tt> </tt>
231<a name="L144"></a><tt class="py-lineno">144</tt>  <tt class="py-line">                <tt class="py-name">common_type</tt> <tt class="py-op">=</tt> <tt class="py-name">lo_nible</tt> </tt>
232<a name="L145"></a><tt class="py-lineno">145</tt>  <tt class="py-line">                <tt class="py-name">dispatch</tt><tt class="py-op">.</tt><tt class="py-name">system_common</tt><tt class="py-op">(</tt><tt class="py-name">common_type</tt><tt class="py-op">,</tt> <tt class="py-name">common_data</tt><tt class="py-op">)</tt> </tt>
233<a name="L146"></a><tt class="py-lineno">146</tt>  <tt class="py-line">            
 </tt>
234<a name="L147"></a><tt class="py-lineno">147</tt>  <tt class="py-line">
 </tt>
235<a name="L148"></a><tt class="py-lineno">148</tt>  <tt class="py-line">            <tt class="py-comment"># Oh! Then it must be a midi event (channel voice message)</tt>
 </tt>
236<a name="L149"></a><tt class="py-lineno">149</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
237<a name="L150"></a><tt class="py-lineno">150</tt>  <tt class="py-line">                <tt class="py-name">data_sizes</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt>
 </tt>
238<a name="L151"></a><tt class="py-lineno">151</tt>  <tt class="py-line">                    <tt id="link-38" class="py-name" targets="Variable echonest.support.midi.constants.PATCH_CHANGE=echonest.support.midi.constants-module.html#PATCH_CHANGE"><a title="echonest.support.midi.constants.PATCH_CHANGE" class="py-name" href="#" onclick="return doclink('link-38', 'PATCH_CHANGE', 'link-38');">PATCH_CHANGE</a></tt><tt class="py-op">:</tt><tt class="py-number">1</tt><tt class="py-op">,</tt>
 </tt>
239<a name="L152"></a><tt class="py-lineno">152</tt>  <tt class="py-line">                    <tt id="link-39" class="py-name" targets="Variable echonest.support.midi.constants.CHANNEL_PRESSURE=echonest.support.midi.constants-module.html#CHANNEL_PRESSURE"><a title="echonest.support.midi.constants.CHANNEL_PRESSURE" class="py-name" href="#" onclick="return doclink('link-39', 'CHANNEL_PRESSURE', 'link-39');">CHANNEL_PRESSURE</a></tt><tt class="py-op">:</tt><tt class="py-number">1</tt><tt class="py-op">,</tt>
 </tt>
240<a name="L153"></a><tt class="py-lineno">153</tt>  <tt class="py-line">                    <tt id="link-40" class="py-name" targets="Variable echonest.support.midi.constants.NOTE_OFF=echonest.support.midi.constants-module.html#NOTE_OFF"><a title="echonest.support.midi.constants.NOTE_OFF" class="py-name" href="#" onclick="return doclink('link-40', 'NOTE_OFF', 'link-40');">NOTE_OFF</a></tt><tt class="py-op">:</tt><tt class="py-number">2</tt><tt class="py-op">,</tt>
 </tt>
241<a name="L154"></a><tt class="py-lineno">154</tt>  <tt class="py-line">                    <tt id="link-41" class="py-name" targets="Variable echonest.support.midi.constants.NOTE_ON=echonest.support.midi.constants-module.html#NOTE_ON"><a title="echonest.support.midi.constants.NOTE_ON" class="py-name" href="#" onclick="return doclink('link-41', 'NOTE_ON', 'link-41');">NOTE_ON</a></tt><tt class="py-op">:</tt><tt class="py-number">2</tt><tt class="py-op">,</tt>
 </tt>
242<a name="L155"></a><tt class="py-lineno">155</tt>  <tt class="py-line">                    <tt id="link-42" class="py-name" targets="Variable echonest.support.midi.constants.AFTERTOUCH=echonest.support.midi.constants-module.html#AFTERTOUCH"><a title="echonest.support.midi.constants.AFTERTOUCH" class="py-name" href="#" onclick="return doclink('link-42', 'AFTERTOUCH', 'link-42');">AFTERTOUCH</a></tt><tt class="py-op">:</tt><tt class="py-number">2</tt><tt class="py-op">,</tt>
 </tt>
243<a name="L156"></a><tt class="py-lineno">156</tt>  <tt class="py-line">                    <tt id="link-43" class="py-name" targets="Variable echonest.support.midi.constants.CONTINUOUS_CONTROLLER=echonest.support.midi.constants-module.html#CONTINUOUS_CONTROLLER"><a title="echonest.support.midi.constants.CONTINUOUS_CONTROLLER" class="py-name" href="#" onclick="return doclink('link-43', 'CONTINUOUS_CONTROLLER', 'link-43');">CONTINUOUS_CONTROLLER</a></tt><tt class="py-op">:</tt><tt class="py-number">2</tt><tt class="py-op">,</tt>
 </tt>
244<a name="L157"></a><tt class="py-lineno">157</tt>  <tt class="py-line">                    <tt id="link-44" class="py-name" targets="Variable echonest.support.midi.constants.PITCH_BEND=echonest.support.midi.constants-module.html#PITCH_BEND"><a title="echonest.support.midi.constants.PITCH_BEND" class="py-name" href="#" onclick="return doclink('link-44', 'PITCH_BEND', 'link-44');">PITCH_BEND</a></tt><tt class="py-op">:</tt><tt class="py-number">2</tt><tt class="py-op">,</tt>
 </tt>
245<a name="L158"></a><tt class="py-lineno">158</tt>  <tt class="py-line">                <tt class="py-op">}</tt> </tt>
246<a name="L159"></a><tt class="py-lineno">159</tt>  <tt class="py-line">                <tt class="py-name">data_size</tt> <tt class="py-op">=</tt> <tt class="py-name">data_sizes</tt><tt class="py-op">.</tt><tt id="link-45" class="py-name"><a title="echonest.action.Edit.get" class="py-name" href="#" onclick="return doclink('link-45', 'get', 'link-36');">get</a></tt><tt class="py-op">(</tt><tt class="py-name">hi_nible</tt><tt class="py-op">,</tt> <tt class="py-number">0</tt><tt class="py-op">)</tt> </tt>
247<a name="L160"></a><tt class="py-lineno">160</tt>  <tt class="py-line">                <tt class="py-name">channel_data</tt> <tt class="py-op">=</tt> <tt class="py-name">raw_in</tt><tt class="py-op">.</tt><tt id="link-46" class="py-name"><a title="echonest.support.midi.RawInstreamFile.RawInstreamFile.nextSlice" class="py-name" href="#" onclick="return doclink('link-46', 'nextSlice', 'link-4');">nextSlice</a></tt><tt class="py-op">(</tt><tt class="py-name">data_size</tt><tt class="py-op">)</tt> </tt>
248<a name="L161"></a><tt class="py-lineno">161</tt>  <tt class="py-line">                <tt class="py-name">event_type</tt><tt class="py-op">,</tt> <tt class="py-name">channel</tt> <tt class="py-op">=</tt> <tt class="py-name">hi_nible</tt><tt class="py-op">,</tt> <tt class="py-name">lo_nible</tt> </tt>
249<a name="L162"></a><tt class="py-lineno">162</tt>  <tt class="py-line">                <tt class="py-name">dispatch</tt><tt class="py-op">.</tt><tt id="link-47" class="py-name" targets="Method echonest.support.midi.EventDispatcher.EventDispatcher.channel_messages()=echonest.support.midi.EventDispatcher.EventDispatcher-class.html#channel_messages"><a title="echonest…

Large files files are truncated, but you can click here to view the full file