PageRenderTime 974ms CodeModel.GetById 182ms app.highlight 457ms RepoModel.GetById 219ms app.codeStats 1ms

/apidocs/echonest.sorting-module.html

http://echo-nest-remix.googlecode.com/
HTML | 456 lines | 401 code | 33 blank | 22 comment | 0 complexity | 08941048d12bf020cf284429e7292940 MD5 | raw 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.sorting</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        Module&nbsp;sorting
 44      </span>
 45    </td>
 46    <td>
 47      <table cellpadding="0" cellspacing="0">
 48        <!-- hide/show private -->
 49        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
 50    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
 51        <tr><td align="right"><span class="options"
 52            >[<a href="frames.html" target="_top">frames</a
 53            >]&nbsp;|&nbsp;<a href="echonest.sorting-module.html"
 54            target="_top">no&nbsp;frames</a>]</span></td></tr>
 55      </table>
 56    </td>
 57  </tr>
 58</table>
 59<!-- ==================== MODULE DESCRIPTION ==================== -->
 60<h1 class="epydoc">Module sorting</h1><p class="nomargin-top"><span class="codelink"><a href="echonest.sorting-pysrc.html">source&nbsp;code</a></span></p>
 61<p>Sorting key functions as utilities for <a href="echonest.audio-module.html" class="link">echonest.audio</a>.</p>
 62<p>For convenience, intended to be imported as:</p>
 63<pre class="rst-literal-block">
 64from audio.sorting import *
 65</pre>
 66<p>All of the functions in this module can be used as a sorting key for
 67<code class="link">AudioQuantumList.ordered_by</code>, as in:</p>
 68<pre class="rst-literal-block">
 69analysis.segments.ordered_by(duration)
 70</pre>
 71<p>Some of the functions in this module return <em>another</em> function that takes
 72one argument, an <a href="echonest.audio.AudioQuantum-class.html" class="link">AudioQuantum</a>, and returns a value (typically a <code class="link">float</code>)
 73that can then be used as a sorting value.</p>
 74<p>By convention, all of these functions are named to be noun phrases that
 75follow <code class="link">sorted_by</code>, as seen above.</p>
 76
 77<!-- ==================== FUNCTIONS ==================== -->
 78<a name="section-Functions"></a>
 79<table class="summary" border="1" cellpadding="3"
 80       cellspacing="0" width="100%" bgcolor="white">
 81<tr bgcolor="#70b0f0" class="table-header">
 82  <td colspan="2" class="table-header">
 83    <table border="0" cellpadding="0" cellspacing="0" width="100%">
 84      <tr valign="top">
 85        <td align="left"><span class="table-header">Functions</span></td>
 86        <td align="right" valign="top"
 87         ><span class="options">[<a href="#section-Functions"
 88         class="privatelink" onclick="toggle_private();"
 89         >hide private</a>]</span></td>
 90      </tr>
 91    </table>
 92  </td>
 93</tr>
 94<tr>
 95    <td width="15%" align="right" valign="top" class="summary">
 96      <span class="summary-type">&nbsp;</span>
 97    </td><td class="summary">
 98      <table width="100%" cellpadding="0" cellspacing="0" border="0">
 99        <tr>
100          <td><span class="summary-sig"><a name="confidence"></a><span class="summary-sig-name">confidence</span>(<span class="summary-sig-arg">x</span>)</span><br />
101      Returns the <a href="echonest.audio.AudioQuantum-class.html" class="link">AudioQuantum</a>'s <a href="echonest.sorting-module.html#confidence" class="link">confidence</a> as a sorting value.</td>
102          <td align="right" valign="top">
103            <span class="codelink"><a href="echonest.sorting-pysrc.html#confidence">source&nbsp;code</a></span>
104            
105          </td>
106        </tr>
107      </table>
108      
109    </td>
110  </tr>
111<tr>
112    <td width="15%" align="right" valign="top" class="summary">
113      <span class="summary-type">&nbsp;</span>
114    </td><td class="summary">
115      <table width="100%" cellpadding="0" cellspacing="0" border="0">
116        <tr>
117          <td><span class="summary-sig"><a name="duration"></a><span class="summary-sig-name">duration</span>(<span class="summary-sig-arg">x</span>)</span><br />
118      Returns the <a href="echonest.audio.AudioQuantum-class.html" class="link">AudioQuantum</a>'s <a href="echonest.sorting-module.html#duration" class="link">duration</a> as a sorting value.</td>
119          <td align="right" valign="top">
120            <span class="codelink"><a href="echonest.sorting-pysrc.html#duration">source&nbsp;code</a></span>
121            
122          </td>
123        </tr>
124      </table>
125      
126    </td>
127  </tr>
128<tr>
129    <td width="15%" align="right" valign="top" class="summary">
130      <span class="summary-type">&nbsp;</span>
131    </td><td class="summary">
132      <table width="100%" cellpadding="0" cellspacing="0" border="0">
133        <tr>
134          <td><span class="summary-sig"><a href="echonest.sorting-module.html#timbre_value" class="summary-sig-name">timbre_value</a>(<span class="summary-sig-arg">index</span>)</span><br />
135      Returns a function that returns the value of <code class="link">timbre</code>[<em>index</em>]
136of its input <a href="echonest.audio.AudioQuantum-class.html" class="link">AudioQuantum</a>.</td>
137          <td align="right" valign="top">
138            <span class="codelink"><a href="echonest.sorting-pysrc.html#timbre_value">source&nbsp;code</a></span>
139            
140          </td>
141        </tr>
142      </table>
143      
144    </td>
145  </tr>
146<tr>
147    <td width="15%" align="right" valign="top" class="summary">
148      <span class="summary-type">&nbsp;</span>
149    </td><td class="summary">
150      <table width="100%" cellpadding="0" cellspacing="0" border="0">
151        <tr>
152          <td><span class="summary-sig"><a href="echonest.sorting-module.html#pitch_value" class="summary-sig-name">pitch_value</a>(<span class="summary-sig-arg">index</span>)</span><br />
153      Returns a function that returns the value of <code class="link">pitch</code>[<em>index</em>]
154of its input <a href="echonest.audio.AudioQuantum-class.html" class="link">AudioQuantum</a>.</td>
155          <td align="right" valign="top">
156            <span class="codelink"><a href="echonest.sorting-pysrc.html#pitch_value">source&nbsp;code</a></span>
157            
158          </td>
159        </tr>
160      </table>
161      
162    </td>
163  </tr>
164<tr>
165    <td width="15%" align="right" valign="top" class="summary">
166      <span class="summary-type">&nbsp;</span>
167    </td><td class="summary">
168      <table width="100%" cellpadding="0" cellspacing="0" border="0">
169        <tr>
170          <td><span class="summary-sig"><a href="echonest.sorting-module.html#pitch_distance_from" class="summary-sig-name">pitch_distance_from</a>(<span class="summary-sig-arg">seg</span>)</span><br />
171      Returns a function that returns the sum of the squared differences
172between the <code class="link">pitch</code> vector of its input <a href="echonest.audio.AudioQuantum-class.html" class="link">AudioQuantum</a> and the <code class="link">pitch</code>
173vector of the reference parameter <em>seg</em>.</td>
174          <td align="right" valign="top">
175            <span class="codelink"><a href="echonest.sorting-pysrc.html#pitch_distance_from">source&nbsp;code</a></span>
176            
177          </td>
178        </tr>
179      </table>
180      
181    </td>
182  </tr>
183<tr>
184    <td width="15%" align="right" valign="top" class="summary">
185      <span class="summary-type">&nbsp;</span>
186    </td><td class="summary">
187      <table width="100%" cellpadding="0" cellspacing="0" border="0">
188        <tr>
189          <td><span class="summary-sig"><a href="echonest.sorting-module.html#timbre_distance_from" class="summary-sig-name">timbre_distance_from</a>(<span class="summary-sig-arg">seg</span>)</span><br />
190      Returns a function that returns the sum of the squared differences
191between the <code class="link">pitch</code> vector of its input <a href="echonest.audio.AudioQuantum-class.html" class="link">AudioQuantum</a> and the <code class="link">pitch</code>
192vector of the reference parameter <em>seg</em>.</td>
193          <td align="right" valign="top">
194            <span class="codelink"><a href="echonest.sorting-pysrc.html#timbre_distance_from">source&nbsp;code</a></span>
195            
196          </td>
197        </tr>
198      </table>
199      
200    </td>
201  </tr>
202<tr>
203    <td width="15%" align="right" valign="top" class="summary">
204      <span class="summary-type">&nbsp;</span>
205    </td><td class="summary">
206      <table width="100%" cellpadding="0" cellspacing="0" border="0">
207        <tr>
208          <td><span class="summary-sig"><a href="echonest.sorting-module.html#noisiness" class="summary-sig-name">noisiness</a>(<span class="summary-sig-arg">x</span>)</span><br />
209      Returns the sum of the twelve pitch vectors' elements.</td>
210          <td align="right" valign="top">
211            <span class="codelink"><a href="echonest.sorting-pysrc.html#noisiness">source&nbsp;code</a></span>
212            
213          </td>
214        </tr>
215      </table>
216      
217    </td>
218  </tr>
219<tr class="private">
220    <td width="15%" align="right" valign="top" class="summary">
221      <span class="summary-type">&nbsp;</span>
222    </td><td class="summary">
223      <table width="100%" cellpadding="0" cellspacing="0" border="0">
224        <tr>
225          <td><span class="summary-sig"><a href="echonest.sorting-module.html#_diff_squared" class="summary-sig-name" onclick="show_private();">_diff_squared</a>(<span class="summary-sig-arg">a</span>,
226        <span class="summary-sig-arg">b</span>)</span><br />
227      Local helper function.</td>
228          <td align="right" valign="top">
229            <span class="codelink"><a href="echonest.sorting-pysrc.html#_diff_squared">source&nbsp;code</a></span>
230            
231          </td>
232        </tr>
233      </table>
234      
235    </td>
236  </tr>
237</table>
238<!-- ==================== VARIABLES ==================== -->
239<a name="section-Variables"></a>
240<table class="summary" border="1" cellpadding="3"
241       cellspacing="0" width="100%" bgcolor="white">
242<tr bgcolor="#70b0f0" class="table-header">
243  <td colspan="2" class="table-header">
244    <table border="0" cellpadding="0" cellspacing="0" width="100%">
245      <tr valign="top">
246        <td align="left"><span class="table-header">Variables</span></td>
247        <td align="right" valign="top"
248         ><span class="options">[<a href="#section-Variables"
249         class="privatelink" onclick="toggle_private();"
250         >hide private</a>]</span></td>
251      </tr>
252    </table>
253  </td>
254</tr>
255<tr>
256    <td width="15%" align="right" valign="top" class="summary">
257      <span class="summary-type">&nbsp;</span>
258    </td><td class="summary">
259        <a name="__package__"></a><span class="summary-name">__package__</span> = <code title="None">None</code><br />
260      hash(x)
261    </td>
262  </tr>
263</table>
264<!-- ==================== FUNCTION DETAILS ==================== -->
265<a name="section-FunctionDetails"></a>
266<table class="details" border="1" cellpadding="3"
267       cellspacing="0" width="100%" bgcolor="white">
268<tr bgcolor="#70b0f0" class="table-header">
269  <td colspan="2" class="table-header">
270    <table border="0" cellpadding="0" cellspacing="0" width="100%">
271      <tr valign="top">
272        <td align="left"><span class="table-header">Function Details</span></td>
273        <td align="right" valign="top"
274         ><span class="options">[<a href="#section-FunctionDetails"
275         class="privatelink" onclick="toggle_private();"
276         >hide private</a>]</span></td>
277      </tr>
278    </table>
279  </td>
280</tr>
281</table>
282<a name="timbre_value"></a>
283<div>
284<table class="details" border="1" cellpadding="3"
285       cellspacing="0" width="100%" bgcolor="white">
286<tr><td>
287  <table width="100%" cellpadding="0" cellspacing="0" border="0">
288  <tr valign="top"><td>
289  <h3 class="epydoc"><span class="sig"><span class="sig-name">timbre_value</span>(<span class="sig-arg">index</span>)</span>
290  </h3>
291  </td><td align="right" valign="top"
292    ><span class="codelink"><a href="echonest.sorting-pysrc.html#timbre_value">source&nbsp;code</a></span>&nbsp;
293    </td>
294  </tr></table>
295  
296  Returns a function that returns the value of <code class="link">timbre</code>[<em>index</em>]
297of its input <a href="echonest.audio.AudioQuantum-class.html" class="link">AudioQuantum</a>. Sorts by the values of the <em>index</em>-th
298value in the timbre vector.
299  <dl class="fields">
300  </dl>
301</td></tr></table>
302</div>
303<a name="pitch_value"></a>
304<div>
305<table class="details" border="1" cellpadding="3"
306       cellspacing="0" width="100%" bgcolor="white">
307<tr><td>
308  <table width="100%" cellpadding="0" cellspacing="0" border="0">
309  <tr valign="top"><td>
310  <h3 class="epydoc"><span class="sig"><span class="sig-name">pitch_value</span>(<span class="sig-arg">index</span>)</span>
311  </h3>
312  </td><td align="right" valign="top"
313    ><span class="codelink"><a href="echonest.sorting-pysrc.html#pitch_value">source&nbsp;code</a></span>&nbsp;
314    </td>
315  </tr></table>
316  
317  Returns a function that returns the value of <code class="link">pitch</code>[<em>index</em>]
318of its input <a href="echonest.audio.AudioQuantum-class.html" class="link">AudioQuantum</a>. Sorts by the values of the <em>index</em>-th
319value in the pitch vector.
320  <dl class="fields">
321  </dl>
322</td></tr></table>
323</div>
324<a name="pitch_distance_from"></a>
325<div>
326<table class="details" border="1" cellpadding="3"
327       cellspacing="0" width="100%" bgcolor="white">
328<tr><td>
329  <table width="100%" cellpadding="0" cellspacing="0" border="0">
330  <tr valign="top"><td>
331  <h3 class="epydoc"><span class="sig"><span class="sig-name">pitch_distance_from</span>(<span class="sig-arg">seg</span>)</span>
332  </h3>
333  </td><td align="right" valign="top"
334    ><span class="codelink"><a href="echonest.sorting-pysrc.html#pitch_distance_from">source&nbsp;code</a></span>&nbsp;
335    </td>
336  </tr></table>
337  
338  Returns a function that returns the sum of the squared differences
339between the <code class="link">pitch</code> vector of its input <a href="echonest.audio.AudioQuantum-class.html" class="link">AudioQuantum</a> and the <code class="link">pitch</code>
340vector of the reference parameter <em>seg</em>. Sorts by the pitch distance
341from the reference <a href="echonest.audio.AudioSegment-class.html" class="link">AudioSegment</a>.
342  <dl class="fields">
343  </dl>
344</td></tr></table>
345</div>
346<a name="timbre_distance_from"></a>
347<div>
348<table class="details" border="1" cellpadding="3"
349       cellspacing="0" width="100%" bgcolor="white">
350<tr><td>
351  <table width="100%" cellpadding="0" cellspacing="0" border="0">
352  <tr valign="top"><td>
353  <h3 class="epydoc"><span class="sig"><span class="sig-name">timbre_distance_from</span>(<span class="sig-arg">seg</span>)</span>
354  </h3>
355  </td><td align="right" valign="top"
356    ><span class="codelink"><a href="echonest.sorting-pysrc.html#timbre_distance_from">source&nbsp;code</a></span>&nbsp;
357    </td>
358  </tr></table>
359  
360  Returns a function that returns the sum of the squared differences
361between the <code class="link">pitch</code> vector of its input <a href="echonest.audio.AudioQuantum-class.html" class="link">AudioQuantum</a> and the <code class="link">pitch</code>
362vector of the reference parameter <em>seg</em>. Sorts by the pitch distance
363from the reference <a href="echonest.audio.AudioSegment-class.html" class="link">AudioSegment</a>.
364  <dl class="fields">
365  </dl>
366</td></tr></table>
367</div>
368<a name="noisiness"></a>
369<div>
370<table class="details" border="1" cellpadding="3"
371       cellspacing="0" width="100%" bgcolor="white">
372<tr><td>
373  <table width="100%" cellpadding="0" cellspacing="0" border="0">
374  <tr valign="top"><td>
375  <h3 class="epydoc"><span class="sig"><span class="sig-name">noisiness</span>(<span class="sig-arg">x</span>)</span>
376  </h3>
377  </td><td align="right" valign="top"
378    ><span class="codelink"><a href="echonest.sorting-pysrc.html#noisiness">source&nbsp;code</a></span>&nbsp;
379    </td>
380  </tr></table>
381  
382  Returns the sum of the twelve pitch vectors' elements. This is a very
383fast way of judging the relative noisiness of a segment.
384  <dl class="fields">
385  </dl>
386</td></tr></table>
387</div>
388<a name="_diff_squared"></a>
389<div class="private">
390<table class="details" border="1" cellpadding="3"
391       cellspacing="0" width="100%" bgcolor="white">
392<tr><td>
393  <table width="100%" cellpadding="0" cellspacing="0" border="0">
394  <tr valign="top"><td>
395  <h3 class="epydoc"><span class="sig"><span class="sig-name">_diff_squared</span>(<span class="sig-arg">a</span>,
396        <span class="sig-arg">b</span>)</span>
397  </h3>
398  </td><td align="right" valign="top"
399    ><span class="codelink"><a href="echonest.sorting-pysrc.html#_diff_squared">source&nbsp;code</a></span>&nbsp;
400    </td>
401  </tr></table>
402  
403  Local helper function. The square of the difference between a and b.
404  <dl class="fields">
405  </dl>
406</td></tr></table>
407</div>
408<br />
409<!-- ==================== NAVIGATION BAR ==================== -->
410<table class="navbar" border="0" width="100%" cellpadding="0"
411       bgcolor="#a0c0ff" cellspacing="0">
412  <tr valign="middle">
413
414  <!-- Tree link -->
415      <th>&nbsp;&nbsp;&nbsp;<a
416        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
417
418  <!-- Index link -->
419      <th>&nbsp;&nbsp;&nbsp;<a
420        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
421
422  <!-- Help link -->
423      <th>&nbsp;&nbsp;&nbsp;<a
424        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
425
426  <!-- Project homepage -->
427      <th class="navbar" align="right" width="100%">
428        <table border="0" cellpadding="0" cellspacing="0">
429          <tr><th class="navbar" align="center"
430            ><a class="navbar" target="_top" href="http://code.google.com/p/echo-nest-remix/">Project Homepage</a></th>
431          </tr></table></th>
432  </tr>
433</table>
434<table border="0" cellpadding="0" cellspacing="0" width="100%%">
435  <tr>
436    <td align="left" class="footer">
437    Generated by Epydoc 3.0.1 on Wed Sep  1 16:08:57 2010
438    </td>
439    <td align="right" class="footer">
440      <a target="mainFrame" href="http://epydoc.sourceforge.net"
441        >http://epydoc.sourceforge.net</a>
442    </td>
443  </tr>
444</table>
445
446<script type="text/javascript">
447  <!--
448  // Private objects are initially displayed (because if
449  // javascript is turned off then we want them to be
450  // visible); but by default, we want to hide them.  So hide
451  // them unless we have a cookie that says to show them.
452  checkCookie();
453  // -->
454</script>
455</body>
456</html>