PageRenderTime 687ms CodeModel.GetById 181ms app.highlight 257ms RepoModel.GetById 145ms app.codeStats 8ms

/apidocs/echonest.modify-pysrc.html

http://echo-nest-remix.googlecode.com/
HTML | 224 lines | 193 code | 10 blank | 21 comment | 0 complexity | 5d0985038673115b3df569b11ffcd55c 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.modify</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;modify
 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.modify-pysrc.html"
 54            target="_top">no&nbsp;frames</a>]</span></td></tr>
 55      </table>
 56    </td>
 57  </tr>
 58</table>
 59<h1 class="epydoc">Source Code for <a href="echonest.modify-module.html">Module echonest.modify</a></h1>
 60<pre class="py-src">
 61<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment">#!/usr/bin/env python</tt> </tt>
 62<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment"># encoding: utf-8</tt> </tt>
 63<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
 64<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-docstring">modify.py</tt> </tt>
 65<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
 66<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-docstring">Created by Ben Lacker on 2009-06-12.</tt> </tt>
 67<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
 68<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="Package echonest=echonest-module.html"><a title="echonest" class="py-name" href="#" onclick="return doclink('link-0', 'echonest', 'link-0');">echonest</a></tt><tt class="py-op">.</tt><tt id="link-1" class="py-name" targets="Module echonest.audio=echonest.audio-module.html,Variable pyechonest.artist.Artist.audio=pyechonest.artist.Artist-class.html#audio"><a title="echonest.audio
 69pyechonest.artist.Artist.audio" class="py-name" href="#" onclick="return doclink('link-1', 'audio', 'link-1');">audio</a></tt> <tt class="py-keyword">import</tt> <tt class="py-op">*</tt> </tt>
 70<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">numpy</tt> </tt>
 71<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">soundtouch</tt> </tt>
 72<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"> </tt>
 73<a name="Modify"></a><div id="Modify-def"><a name="L12"></a><tt class="py-lineno"> 12</tt> <a class="py-toggle" href="#" id="Modify-toggle" onclick="return toggle('Modify');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="echonest.modify.Modify-class.html">Modify</a><tt class="py-op">(</tt><tt class="py-base-class">soundtouch</tt><tt class="py-op">.</tt><tt class="py-base-class">SoundTouch</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
 74</div><div id="Modify-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Modify-expanded"><a name="Modify.__init__"></a><div id="Modify.__init__-def"><a name="L13"></a><tt class="py-lineno"> 13</tt> <a class="py-toggle" href="#" id="Modify.__init__-toggle" onclick="return toggle('Modify.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.modify.Modify-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">sampleRate</tt><tt class="py-op">=</tt><tt class="py-number">44100</tt><tt class="py-op">,</tt> <tt class="py-param">numChannels</tt><tt class="py-op">=</tt><tt class="py-number">1</tt><tt class="py-op">,</tt> <tt class="py-param">blockSize</tt> <tt class="py-op">=</tt> <tt class="py-number">10000</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
 75</div><div id="Modify.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Modify.__init__-expanded"><a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">setSampleRate</tt><tt class="py-op">(</tt><tt class="py-name">sampleRate</tt><tt class="py-op">)</tt> </tt>
 76<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">setChannels</tt><tt class="py-op">(</tt><tt class="py-name">numChannels</tt><tt class="py-op">)</tt> </tt>
 77<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sampleRate</tt> <tt class="py-op">=</tt> <tt class="py-name">sampleRate</tt> </tt>
 78<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">numChannels</tt> <tt class="py-op">=</tt> <tt class="py-name">numChannels</tt> </tt>
 79<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">blockSize</tt> <tt class="py-op">=</tt> <tt class="py-name">blockSize</tt> </tt>
 80</div><a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"> </tt>
 81<a name="Modify.doInBlocks"></a><div id="Modify.doInBlocks-def"><a name="L20"></a><tt class="py-lineno"> 20</tt> <a class="py-toggle" href="#" id="Modify.doInBlocks-toggle" onclick="return toggle('Modify.doInBlocks');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.modify.Modify-class.html#doInBlocks">doInBlocks</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">f</tt><tt class="py-op">,</tt> <tt class="py-param">in_data</tt><tt class="py-op">,</tt> <tt class="py-param">arg</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
 82</div><div id="Modify.doInBlocks-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Modify.doInBlocks-expanded"><a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line">        <tt class="py-comment"># For now, make everything mono. We'll deal with channels later</tt> </tt>
 83<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">in_data</tt><tt class="py-op">.</tt><tt class="py-name">ndim</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">1</tt><tt class="py-op">:</tt> </tt>
 84<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line">            <tt class="py-name">in_data</tt> <tt class="py-op">=</tt> <tt class="py-name">in_data</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">,</tt> <tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
 85<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line">        <tt class="py-name">collect</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
 86<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">in_data</tt><tt class="py-op">)</tt> <tt class="py-op">&gt;</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">blockSize</tt><tt class="py-op">:</tt> </tt>
 87<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">x</tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">in_data</tt><tt class="py-op">)</tt><tt class="py-op">/</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">blockSize</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
 88<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line">                <tt id="link-2" class="py-name" targets="Variable echonest.audio.AudioQuantumList.start=echonest.audio.AudioQuantumList-class.html#start"><a title="echonest.audio.AudioQuantumList.start" class="py-name" href="#" onclick="return doclink('link-2', 'start', 'link-2');">start</a></tt> <tt class="py-op">=</tt> <tt class="py-name">x</tt> <tt class="py-op">*</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">blockSize</tt> </tt>
 89<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line">                <tt class="py-name">data</tt> <tt class="py-op">=</tt> <tt class="py-name">in_data</tt><tt class="py-op">[</tt><tt id="link-3" class="py-name"><a title="echonest.audio.AudioQuantumList.start" class="py-name" href="#" onclick="return doclink('link-3', 'start', 'link-2');">start</a></tt><tt class="py-op">:</tt><tt id="link-4" class="py-name"><a title="echonest.audio.AudioQuantumList.start" class="py-name" href="#" onclick="return doclink('link-4', 'start', 'link-2');">start</a></tt> <tt class="py-op">+</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">blockSize</tt> <tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
 90<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line">                <tt class="py-name">collect</tt><tt class="py-op">.</tt><tt id="link-5" class="py-name" targets="Method echonest.audio.AudioData.append()=echonest.audio.AudioData-class.html#append"><a title="echonest.audio.AudioData.append" class="py-name" href="#" onclick="return doclink('link-5', 'append', 'link-5');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-6" class="py-name" targets="Method echonest.modify.Modify.processAudio()=echonest.modify.Modify-class.html#processAudio"><a title="echonest.modify.Modify.processAudio" class="py-name" href="#" onclick="return doclink('link-6', 'processAudio', 'link-6');">processAudio</a></tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">,</tt> <tt class="py-name">data</tt><tt class="py-op">,</tt> <tt class="py-name">arg</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
 91<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line">            <tt class="py-name">data</tt> <tt class="py-op">=</tt> <tt class="py-name">in_data</tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">*</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">in_data</tt><tt class="py-op">)</tt> <tt class="py-op">%</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">blockSize</tt><tt class="py-op">)</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
 92<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line">            <tt class="py-name">collect</tt><tt class="py-op">.</tt><tt id="link-7" class="py-name"><a title="echonest.audio.AudioData.append" class="py-name" href="#" onclick="return doclink('link-7', 'append', 'link-5');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-8" class="py-name"><a title="echonest.modify.Modify.processAudio" class="py-name" href="#" onclick="return doclink('link-8', 'processAudio', 'link-6');">processAudio</a></tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">,</tt> <tt class="py-name">data</tt><tt class="py-op">,</tt> <tt class="py-name">arg</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
 93<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
 94<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line">            <tt class="py-name">collect</tt><tt class="py-op">.</tt><tt id="link-9" class="py-name"><a title="echonest.audio.AudioData.append" class="py-name" href="#" onclick="return doclink('link-9', 'append', 'link-5');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-10" class="py-name"><a title="echonest.modify.Modify.processAudio" class="py-name" href="#" onclick="return doclink('link-10', 'processAudio', 'link-6');">processAudio</a></tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">,</tt> <tt class="py-name">in_data</tt><tt class="py-op">,</tt> <tt class="py-name">arg</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
 95<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt id="link-11" class="py-name" targets="Function echonest.audio.assemble()=echonest.audio-module.html#assemble"><a title="echonest.audio.assemble" class="py-name" href="#" onclick="return doclink('link-11', 'assemble', 'link-11');">assemble</a></tt><tt class="py-op">(</tt><tt class="py-name">collect</tt><tt class="py-op">,</tt> <tt class="py-name">numChannels</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">numChannels</tt><tt class="py-op">,</tt> <tt class="py-name">sampleRate</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sampleRate</tt><tt class="py-op">)</tt> </tt>
 96</div><a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line"> </tt>
 97<a name="Modify.processAudio"></a><div id="Modify.processAudio-def"><a name="L36"></a><tt class="py-lineno"> 36</tt> <a class="py-toggle" href="#" id="Modify.processAudio-toggle" onclick="return toggle('Modify.processAudio');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.modify.Modify-class.html#processAudio">processAudio</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">f</tt><tt class="py-op">,</tt> <tt class="py-param">data</tt><tt class="py-op">,</tt> <tt class="py-param">arg</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
 98</div><div id="Modify.processAudio-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Modify.processAudio-expanded"><a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line">        <tt class="py-name">f</tt><tt class="py-op">(</tt><tt class="py-name">arg</tt><tt class="py-op">)</tt> </tt>
 99<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">putSamples</tt><tt class="py-op">(</tt><tt class="py-name">data</tt><tt class="py-op">)</tt> </tt>
100<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line">        <tt class="py-name">out_data</tt> <tt class="py-op">=</tt> <tt class="py-name">numpy</tt><tt class="py-op">.</tt><tt class="py-name">array</tt><tt class="py-op">(</tt><tt class="py-name">numpy</tt><tt class="py-op">.</tt><tt class="py-name">zeros</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">data</tt><tt class="py-op">)</tt><tt class="py-op">*</tt><tt class="py-number">2</tt><tt class="py-op">,</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">dtype</tt><tt class="py-op">=</tt><tt class="py-name">numpy</tt><tt class="py-op">.</tt><tt class="py-name">float32</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
101<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line">        <tt class="py-name">out_samples</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">receiveSamples</tt><tt class="py-op">(</tt><tt class="py-name">out_data</tt><tt class="py-op">)</tt> </tt>
102<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line">        <tt class="py-name">new_ad</tt> <tt class="py-op">=</tt> <tt id="link-12" class="py-name" targets="Class echonest.audio.AudioData=echonest.audio.AudioData-class.html"><a title="echonest.audio.AudioData" class="py-name" href="#" onclick="return doclink('link-12', 'AudioData', 'link-12');">AudioData</a></tt><tt class="py-op">(</tt><tt class="py-name">ndarray</tt><tt class="py-op">=</tt><tt class="py-name">out_data</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-name">out_samples</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt class="py-name">shape</tt><tt class="py-op">=</tt><tt class="py-op">(</tt><tt class="py-name">out_samples</tt><tt class="py-op">,</tt> <tt class="py-op">)</tt><tt class="py-op">,</tt>  </tt>
103<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line">                    <tt class="py-name">sampleRate</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sampleRate</tt><tt class="py-op">,</tt> <tt class="py-name">numChannels</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">numChannels</tt><tt class="py-op">)</tt> </tt>
104<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">new_ad</tt> </tt>
105</div><a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line"> </tt>
106<a name="Modify.shiftRate"></a><div id="Modify.shiftRate-def"><a name="L45"></a><tt class="py-lineno"> 45</tt> <a class="py-toggle" href="#" id="Modify.shiftRate-toggle" onclick="return toggle('Modify.shiftRate');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.modify.Modify-class.html#shiftRate">shiftRate</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">audio_data</tt><tt class="py-op">,</tt> <tt class="py-param">ratio</tt><tt class="py-op">=</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
107</div><div id="Modify.shiftRate-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Modify.shiftRate-expanded"><a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">audio_data</tt><tt class="py-op">,</tt> <tt id="link-13" class="py-name"><a title="echonest.audio.AudioData" class="py-name" href="#" onclick="return doclink('link-13', 'AudioData', 'link-12');">AudioData</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
108<a name="L47"></a><tt class="py-lineno"> 47</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">'First argument must be an AudioData object.'</tt><tt class="py-op">)</tt> </tt>
109<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-op">(</tt><tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">ratio</tt><tt class="py-op">,</tt> <tt class="py-name">int</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">ratio</tt><tt class="py-op">,</tt> <tt class="py-name">float</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
110<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">'Ratio must be an int or float.'</tt><tt class="py-op">)</tt> </tt>
111<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-op">(</tt><tt class="py-name">ratio</tt> <tt class="py-op">&lt;</tt> <tt class="py-number">0</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-op">(</tt><tt class="py-name">ratio</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">10</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
112<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">'Ratio must be between 0 and 10.'</tt><tt class="py-op">)</tt> </tt>
113<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-14" class="py-name" targets="Method echonest.modify.Modify.doInBlocks()=echonest.modify.Modify-class.html#doInBlocks"><a title="echonest.modify.Modify.doInBlocks" class="py-name" href="#" onclick="return doclink('link-14', 'doInBlocks', 'link-14');">doInBlocks</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">setRate</tt><tt class="py-op">,</tt> <tt class="py-name">audio_data</tt><tt class="py-op">.</tt><tt class="py-name">data</tt><tt class="py-op">,</tt> <tt class="py-name">ratio</tt><tt class="py-op">)</tt> </tt>
114</div><a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line"> </tt>
115<a name="Modify.shiftTempo"></a><div id="Modify.shiftTempo-def"><a name="L54"></a><tt class="py-lineno"> 54</tt> <a class="py-toggle" href="#" id="Modify.shiftTempo-toggle" onclick="return toggle('Modify.shiftTempo');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.modify.Modify-class.html#shiftTempo">shiftTempo</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">audio_data</tt><tt class="py-op">,</tt> <tt class="py-param">ratio</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
116</div><div id="Modify.shiftTempo-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Modify.shiftTempo-expanded"><a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">audio_data</tt><tt class="py-op">,</tt> <tt id="link-15" class="py-name"><a title="echonest.audio.AudioData" class="py-name" href="#" onclick="return doclink('link-15', 'AudioData', 'link-12');">AudioData</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
117<a name="L56"></a><tt class="py-lineno"> 56</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">'First argument must be an AudioData object.'</tt><tt class="py-op">)</tt> </tt>
118<a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-op">(</tt><tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">ratio</tt><tt class="py-op">,</tt> <tt class="py-name">int</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">ratio</tt><tt class="py-op">,</tt> <tt class="py-name">float</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
119<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">'Ratio must be an int or float.'</tt><tt class="py-op">)</tt> </tt>
120<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-op">(</tt><tt class="py-name">ratio</tt> <tt class="py-op">&lt;</tt> <tt class="py-number">0</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-op">(</tt><tt class="py-name">ratio</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">10</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
121<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">'Ratio must be between 0 and 10.'</tt><tt class="py-op">)</tt> </tt>
122<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-16" class="py-name"><a title="echonest.modify.Modify.doInBlocks" class="py-name" href="#" onclick="return doclink('link-16', 'doInBlocks', 'link-14');">doInBlocks</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">setTempo</tt><tt class="py-op">,</tt> <tt class="py-name">audio_data</tt><tt class="py-op">.</tt><tt class="py-name">data</tt><tt class="py-op">,</tt> <tt class="py-name">ratio</tt><tt class="py-op">)</tt> </tt>
123</div><a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line"> </tt>
124<a name="Modify.shiftRateChange"></a><div id="Modify.shiftRateChange-def"><a name="L63"></a><tt class="py-lineno"> 63</tt> <a class="py-toggle" href="#" id="Modify.shiftRateChange-toggle" onclick="return toggle('Modify.shiftRateChange');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.modify.Modify-class.html#shiftRateChange">shiftRateChange</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">audio_data</tt><tt class="py-op">,</tt> <tt class="py-param">percent</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
125</div><div id="Modify.shiftRateChange-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Modify.shiftRateChange-expanded"><a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">audio_data</tt><tt class="py-op">,</tt> <tt id="link-17" class="py-name"><a title="echonest.audio.AudioData" class="py-name" href="#" onclick="return doclink('link-17', 'AudioData', 'link-12');">AudioData</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
126<a name="L65"></a><tt class="py-lineno"> 65</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">'First argument must be an AudioData object.'</tt><tt class="py-op">)</tt> </tt>
127<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-op">(</tt><tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">percent</tt><tt class="py-op">,</tt> <tt class="py-name">int</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">percent</tt><tt class="py-op">,</tt> <tt class="py-name">float</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
128<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">'Percent must be an int or float.'</tt><tt class="py-op">)</tt> </tt>
129<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-op">(</tt><tt class="py-name">percent</tt> <tt class="py-op">&lt;</tt> <tt class="py-op">-</tt><tt class="py-number">50</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-op">(</tt><tt class="py-name">percent</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">100</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
130<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">'Percent must be between -50 and 100.'</tt><tt class="py-op">)</tt> </tt>
131<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-18" class="py-name"><a title="echonest.modify.Modify.doInBlocks" class="py-name" href="#" onclick="return doclink('link-18', 'doInBlocks', 'link-14');">doInBlocks</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">setRateChange</tt><tt class="py-op">,</tt> <tt class="py-name">audio_data</tt><tt class="py-op">.</tt><tt class="py-name">data</tt><tt class="py-op">,</tt> <tt class="py-name">percent</tt><tt class="py-op">)</tt> </tt>
132</div><a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line"> </tt>
133<a name="Modify.shiftTempoChange"></a><div id="Modify.shiftTempoChange-def"><a name="L72"></a><tt class="py-lineno"> 72</tt> <a class="py-toggle" href="#" id="Modify.shiftTempoChange-toggle" onclick="return toggle('Modify.shiftTempoChange');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.modify.Modify-class.html#shiftTempoChange">shiftTempoChange</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">audio_data</tt><tt class="py-op">,</tt> <tt class="py-param">percent</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
134</div><div id="Modify.shiftTempoChange-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Modify.shiftTempoChange-expanded"><a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">audio_data</tt><tt class="py-op">,</tt> <tt id="link-19" class="py-name"><a title="echonest.audio.AudioData" class="py-name" href="#" onclick="return doclink('link-19', 'AudioData', 'link-12');">AudioData</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
135<a name="L74"></a><tt class="py-lineno"> 74</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">'First argument must be an AudioData object.'</tt><tt class="py-op">)</tt> </tt>
136<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-op">(</tt><tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">percent</tt><tt class="py-op">,</tt> <tt class="py-name">int</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">percent</tt><tt class="py-op">,</tt> <tt class="py-name">float</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
137<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">'Percent must be an int or float.'</tt><tt class="py-op">)</tt> </tt>
138<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-op">(</tt><tt class="py-name">percent</tt> <tt class="py-op">&lt;</tt> <tt class="py-op">-</tt><tt class="py-number">50</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-op">(</tt><tt class="py-name">percent</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">100</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
139<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">'Percent must be between -50 and 100.'</tt><tt class="py-op">)</tt> </tt>
140<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-20" class="py-name"><a title="echonest.modify.Modify.doInBlocks" class="py-name" href="#" onclick="return doclink('link-20', 'doInBlocks', 'link-14');">doInBlocks</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">setTempoChange</tt><tt class="py-op">,</tt> <tt class="py-name">audio_data</tt><tt class="py-op">.</tt><tt class="py-name">data</tt><tt class="py-op">,</tt> <tt class="py-name">percent</tt><tt class="py-op">)</tt> </tt>
141</div><a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line"> </tt>
142<a name="Modify.shiftPitchSemiTones"></a><div id="Modify.shiftPitchSemiTones-def"><a name="L81"></a><tt class="py-lineno"> 81</tt> <a class="py-toggle" href="#" id="Modify.shiftPitchSemiTones-toggle" onclick="return toggle('Modify.shiftPitchSemiTones');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.modify.Modify-class.html#shiftPitchSemiTones">shiftPitchSemiTones</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">audio_data</tt><tt class="py-op">,</tt> <tt class="py-param">semitones</tt><tt class="py-op">=</tt><tt class="py-number">0</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
143</div><div id="Modify.shiftPitchSemiTones-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Modify.shiftPitchSemiTones-expanded"><a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">audio_data</tt><tt class="py-op">,</tt> <tt id="link-21" class="py-name"><a title="echonest.audio.AudioData" class="py-name" href="#" onclick="return doclink('link-21', 'AudioData', 'link-12');">AudioData</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
144<a name="L83"></a><tt class="py-lineno"> 83</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">'First argument must be an AudioData object.'</tt><tt class="py-op">)</tt> </tt>
145<a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">semitones</tt><tt class="py-op">,</tt> <tt class="py-name">int</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
146<a name="L85"></a><tt class="py-lineno"> 85</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">'Second argument must be an integer.'</tt><tt class="py-op">)</tt> </tt>
147<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line">        <tt class="py-comment"># I think this is right, but maybe it has to be between -12 and 12?</tt> </tt>
148<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">abs</tt><tt class="py-op">(</tt><tt class="py-name">semitones</tt><tt class="py-op">)</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">60</tt><tt class="py-op">:</tt> </tt>
149<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">'Semitones argument must be an int between -60 and 60.'</tt><tt class="py-op">)</tt> </tt>
150<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-22" class="py-name"><a title="echonest.modify.Modify.doInBlocks" class="py-name" href="#" onclick="return doclink('link-22', 'doInBlocks', 'link-14');">doInBlocks</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">setPitchSemiTones</tt><tt class="py-op">,</tt> <tt class="py-name">audio_data</tt><tt class="py-op">.</tt><tt class="py-name">data</tt><tt class="py-op">,</tt> <tt class="py-name">semitones</tt><tt class="py-op">)</tt> </tt>
151</div><a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line"> </tt>
152<a name="Modify.shiftPitchOctaves"></a><div id="Modify.shiftPitchOctaves-def"><a name="L91"></a><tt class="py-lineno"> 91</tt> <a class="py-toggle" href="#" id="Modify.shiftPitchOctaves-toggle" onclick="return toggle('Modify.shiftPitchOctaves');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.modify.Modify-class.html#shiftPitchOctaves">shiftPitchOctaves</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">audio_data</tt><tt class="py-op">,</tt> <tt class="py-param">octaves</tt><tt class="py-op">=</tt><tt class="py-number">0</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
153</div><div id="Modify.shiftPitchOctaves-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Modify.shiftPitchOctaves-expanded"><a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">audio_data</tt><tt class="py-op">,</tt> <tt id="link-23" class="py-name"><a title="echonest.audio.AudioData" class="py-name" href="#" onclick="return doclink('link-23', 'AudioData', 'link-12');">AudioData</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
154<a name="L93"></a><tt class="py-lineno"> 93</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">'First argument must be an AudioData object.'</tt><tt class="py-op">)</tt> </tt>
155<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-op">(</tt><tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">octaves</tt><tt class="py-op">,</tt> <tt class="py-name">int</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">octaves</tt><tt class="py-op">,</tt> <tt class="py-name">float</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
156<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">'Octaves must be an int or float.'</tt><tt class="py-op">)</tt> </tt>
157<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">abs</tt><tt class="py-op">(</tt><tt class="py-name">octaves</tt><tt class="py-op">)</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">5</tt><tt class="py-op">:</tt> </tt>
158<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">'Octaves argument must be between -5 and 5.'</tt><tt class="py-op">)</tt> </tt>
159<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">        <tt class="py-comment"># what are the limits? Nothing in soundtouch documentation...</tt> </tt>
160<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-24" class="py-name"><a title="echonest.modify.Modify.doInBlocks" class="py-name" href="#" onclick="return doclink('link-24', 'doInBlocks', 'link-14');">doInBlocks</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">setPitchOctaves</tt><tt class="py-op">,</tt> <tt class="py-name">audio_data</tt><tt class="py-op">.</tt><tt class="py-name">data</tt><tt class="py-op">,</tt> <tt class="py-name">octaves</tt><tt class="py-op">)</tt> </tt>
161</div><a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line">     </tt>
162<a name="Modify.shiftPitch"></a><div id="Modify.shiftPitch-def"><a name="L101"></a><tt class="py-lineno">101</tt> <a class="py-toggle" href="#" id="Modify.shiftPitch-toggle" onclick="return toggle('Modify.shiftPitch');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="echonest.modify.Modify-class.html#shiftPitch">shiftPitch</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">audio_data</tt><tt class="py-op">,</tt> <tt class="py-param">ratio</tt><tt class="py-op">=</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
163</div><div id="Modify.shiftPitch-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Modify.shiftPitch-expanded"><a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">audio_data</tt><tt class="py-op">,</tt> <tt id="link-25" class="py-name"><a title="echonest.audio.AudioData" class="py-name" href="#" onclick="return doclink('link-25', 'AudioData', 'link-12');">AudioData</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
164<a name="L103"></a><tt class="py-lineno">103</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">'First argument must be an AudioData object.'</tt><tt class="py-op">)</tt> </tt>
165<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-op">(</tt><tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">ratio</tt><tt class="py-op">,</tt> <tt class="py-name">int</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">ratio</tt><tt class="py-op">,</tt> <tt class="py-name">float</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
166<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">'Ratio must be an int or float.'</tt><tt class="py-op">)</tt> </tt>
167<a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-op">(</tt><tt class="py-name">ratio</tt> <tt class="py-op">&lt;</tt> <tt class="py-number">0</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-op">(</tt><tt class="py-name">ratio</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">10</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
168<a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">'Ratio must be between 0 and 10.'</tt><tt class="py-op">)</tt> </tt>
169<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-26" class="py-name"><a title="echonest.modify.Modify.doInBlocks" class="py-name" href="#" onclick="return doclink('link-26', 'doInBlocks', 'link-14');">doInBlocks</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">setPitch</tt><tt class="py-op">,</tt> <tt class="py-name">audio_data</tt><tt class="py-op">.</tt><tt class="py-name">data</tt><tt class="py-op">,</tt> <tt class="py-name">ratio</tt><tt class="py-op">)</tt> </tt>
170</div></div><a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line"> </tt><script type="text/javascript">
171<!--
172expandto(location.href);
173// -->
174</script>
175</pre>
176<br />
177<!-- ==================== NAVIGATION BAR ==================== -->
178<table class="navbar" border="0" width="100%" cellpadding="0"
179       bgcolor="#a0c0ff" cellspacing="0">
180  <tr valign="middle">
181
182  <!-- Tree link -->
183      <th>&nbsp;&nbsp;&nbsp;<a
184        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
185
186  <!-- Index link -->
187      <th>&nbsp;&nbsp;&nbsp;<a
188        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
189
190  <!-- Help link -->
191      <th>&nbsp;&nbsp;&nbsp;<a
192        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
193
194  <!-- Project homepage -->
195      <th class="navbar" align="right" width="100%">
196        <table border="0" cellpadding="0" cellspacing="0">
197          <tr><th class="navbar" align="center"
198            ><a class="navbar" target="_top" href="http://code.google.com/p/echo-nest-remix/">Project Homepage</a></th>
199          </tr></table></th>
200  </tr>
201</table>
202<table border="0" cellpadding="0" cellspacing="0" width="100%%">
203  <tr>
204    <td align="left" class="footer">
205    Generated by Epydoc 3.0.1 on Wed Sep  1 16:09:00 2010
206    </td>
207    <td align="right" class="footer">
208      <a target="mainFrame" href="http://epydoc.sourceforge.net"
209        >http://epydoc.sourceforge.net</a>
210    </td>
211  </tr>
212</table>
213
214<script type="text/javascript">
215  <!--
216  // Private objects are initially displayed (because if
217  // javascript is turned off then we want them to be
218  // visible); but by default, we want to hide them.  So hide
219  // them unless we have a cookie that says to show them.
220  checkCookie();
221  // -->
222</script>
223</body>
224</html>