mirror of
https://github.com/thestk/stk
synced 2026-01-13 21:11:53 +00:00
282 lines
14 KiB
HTML
282 lines
14 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
|
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF">
|
|
<CENTER>
|
|
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
|
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
|
<HR>
|
|
<!-- Generated by Doxygen 1.4.4 -->
|
|
<h1>Granulate Class Reference</h1><!-- doxytag: class="Granulate" --><!-- doxytag: inherits="Generator" --><code>#include <<a class="el" href="Granulate_8h-source.html">Granulate.h</a>></code>
|
|
<p>
|
|
<p>Inheritance diagram for Granulate:
|
|
<p><center><img src="classGranulate.png" usemap="#Granulate_map" border="0" alt=""></center>
|
|
<map name="Granulate_map">
|
|
<area href="classGenerator.html" alt="Generator" shape="rect" coords="0,56,69,80">
|
|
<area href="classStk.html" alt="Stk" shape="rect" coords="0,0,69,24">
|
|
</map>
|
|
<a href="classGranulate-members.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2>
|
|
STK granular synthesis class.
|
|
<p>
|
|
This class implements a real-time granular synthesis algorithm that operates on an input soundfile. Currently, only monophonic files are supported. Various functions are provided to allow control over voice and grain parameters.<p>
|
|
The functionality of this class is based on the program MacPod by Chris Rolfe and Damian Keller, though there are likely to be a number of differences in the actual implementation.<p>
|
|
by Gary Scavone, 2005.
|
|
<p>
|
|
<table border="0" cellpadding="0" cellspacing="0">
|
|
<tr><td></td></tr>
|
|
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a0"></a><!-- doxytag: member="Granulate::Granulate" ref="a0" args="(void)" -->
|
|
</td><td class="memItemRight" valign="bottom"><a class="el" href="classGranulate.html#a0">Granulate</a> (void)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Default constructor. <br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a1"></a><!-- doxytag: member="Granulate::Granulate" ref="a1" args="(unsigned int nVoices, std::string fileName, bool typeRaw=false)" -->
|
|
</td><td class="memItemRight" valign="bottom"><a class="el" href="classGranulate.html#a1">Granulate</a> (unsigned int nVoices, std::string fileName, bool typeRaw=false)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor taking input audio file and number of voices arguments. <br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a2"></a><!-- doxytag: member="Granulate::~Granulate" ref="a2" args="()" -->
|
|
</td><td class="memItemRight" valign="bottom"><a class="el" href="classGranulate.html#a2">~Granulate</a> ()</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Class destructor. <br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classGranulate.html#a3">openFile</a> (std::string fileName, bool typeRaw=false)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Load a monophonic soundfile to be "granulated". <a href="#a3"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classGranulate.html#a4">reset</a> ()</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Reset the file pointer and all existing grains to the file start. <a href="#a4"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classGranulate.html#a5">setVoices</a> (unsigned int nVoices=1)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set the number of simultaneous grain "voices" to use. <a href="#a5"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classGranulate.html#a6">setStretch</a> (unsigned int stretchFactor=1)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set the stretch factor used for grain playback (1 - 1000). <a href="#a6"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classGranulate.html#a7">setGrainParameters</a> (unsigned int duration=30, unsigned int rampPercent=50, int offset=0, unsigned int delay=0)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set global grain parameters used to determine individual grain settings. <a href="#a7"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classGranulate.html#a8">setRandomFactor</a> (StkFloat randomness=0.1)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">This factor is used when setting individual grain parameters (0.0 - 1.0). <a href="#a8"></a><br></td></tr>
|
|
</table>
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<a class="anchor" name="a3"></a><!-- doxytag: member="Granulate::openFile" ref="a3" args="(std::string fileName, bool typeRaw=false)" --><p>
|
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top">void Granulate::openFile </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="md" nowrap valign="top">std::string </td>
|
|
<td class="mdname" nowrap> <em>fileName</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="md" nowrap align="right"></td>
|
|
<td class="md"></td>
|
|
<td class="md" nowrap>bool </td>
|
|
<td class="mdname" nowrap> <em>typeRaw</em> = <code>false</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="md"></td>
|
|
<td class="md">) </td>
|
|
<td class="md" colspan="2"></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing="5" cellpadding="0" border="0">
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Load a monophonic soundfile to be "granulated".
|
|
<p>
|
|
An <a class="el" href="classStkError.html">StkError</a> will be thrown if the file is not found, its format is unknown or unsupported, or the file has more than one channel. </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="a4"></a><!-- doxytag: member="Granulate::reset" ref="a4" args="()" --><p>
|
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top">void Granulate::reset </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="mdname1" valign="top" nowrap> </td>
|
|
<td class="md" valign="top"> ) </td>
|
|
<td class="md" nowrap></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing="5" cellpadding="0" border="0">
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Reset the file pointer and all existing grains to the file start.
|
|
<p>
|
|
Multiple grains are offset from one another in time by grain duration / nVoices. </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="a5"></a><!-- doxytag: member="Granulate::setVoices" ref="a5" args="(unsigned int nVoices=1)" --><p>
|
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top">void Granulate::setVoices </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="md" nowrap valign="top">unsigned int </td>
|
|
<td class="mdname1" valign="top" nowrap> <em>nVoices</em> = <code>1</code> </td>
|
|
<td class="md" valign="top"> ) </td>
|
|
<td class="md" nowrap></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing="5" cellpadding="0" border="0">
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Set the number of simultaneous grain "voices" to use.
|
|
<p>
|
|
Multiple grains are offset from one another in time by grain duration / nVoices. For this reason, it is best to set the grain parameters before calling this function (during initialization). </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="a6"></a><!-- doxytag: member="Granulate::setStretch" ref="a6" args="(unsigned int stretchFactor=1)" --><p>
|
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top">void Granulate::setStretch </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="md" nowrap valign="top">unsigned int </td>
|
|
<td class="mdname1" valign="top" nowrap> <em>stretchFactor</em> = <code>1</code> </td>
|
|
<td class="md" valign="top"> ) </td>
|
|
<td class="md" nowrap></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing="5" cellpadding="0" border="0">
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Set the stretch factor used for grain playback (1 - 1000).
|
|
<p>
|
|
Granular synthesis allows for time-stetching without affecting the original pitch of a sound. A stretch factor of 4 will produce a resulting sound of length 4 times the orignal sound. The default parameter of 1 produces no stretching. </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="a7"></a><!-- doxytag: member="Granulate::setGrainParameters" ref="a7" args="(unsigned int duration=30, unsigned int rampPercent=50, int offset=0, unsigned int delay=0)" --><p>
|
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top">void Granulate::setGrainParameters </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="md" nowrap valign="top">unsigned int </td>
|
|
<td class="mdname" nowrap> <em>duration</em> = <code>30</code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="md" nowrap align="right"></td>
|
|
<td class="md"></td>
|
|
<td class="md" nowrap>unsigned int </td>
|
|
<td class="mdname" nowrap> <em>rampPercent</em> = <code>50</code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="md" nowrap align="right"></td>
|
|
<td class="md"></td>
|
|
<td class="md" nowrap>int </td>
|
|
<td class="mdname" nowrap> <em>offset</em> = <code>0</code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="md" nowrap align="right"></td>
|
|
<td class="md"></td>
|
|
<td class="md" nowrap>unsigned int </td>
|
|
<td class="mdname" nowrap> <em>delay</em> = <code>0</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="md"></td>
|
|
<td class="md">) </td>
|
|
<td class="md" colspan="2"></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing="5" cellpadding="0" border="0">
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Set global grain parameters used to determine individual grain settings.
|
|
<p>
|
|
Each grain is defined as having a length of <em>duration</em> milliseconds which must be greater than zero. For values of <em>rampPercent</em> (0 - 100) greater than zero, a linear envelope will be applied to each grain. If <em>rampPercent</em> = 100, the resultant grain "window" is triangular while <em>rampPercent</em> = 50 produces a trapezoidal window. In addition, each grain can have a time delay of length <em>delay</em> and a grain pointer increment of length <em>offset</em>, which can be negative, before the next ramp onset (in milliseconds). The actual values calculated for each grain will be randomized by a factor set using the <a class="el" href="classGranulate.html#a8">setRandomFactor()</a> function. </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="a8"></a><!-- doxytag: member="Granulate::setRandomFactor" ref="a8" args="(StkFloat randomness=0.1)" --><p>
|
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top">void Granulate::setRandomFactor </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="md" nowrap valign="top">StkFloat </td>
|
|
<td class="mdname1" valign="top" nowrap> <em>randomness</em> = <code>0.1</code> </td>
|
|
<td class="md" valign="top"> ) </td>
|
|
<td class="md" nowrap></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing="5" cellpadding="0" border="0">
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
This factor is used when setting individual grain parameters (0.0 - 1.0).
|
|
<p>
|
|
This random factor is applied when all grain state durations are calculated. If set to 0.0, no randomness occurs. When randomness = 1.0, a grain segment of length <em>duration</em> will be randomly augmented by up to +- <em>duration</em> seconds (i.e., a 30 millisecond length will be augmented by an extra length of up to +30 or -30 milliseconds). </td>
|
|
</tr>
|
|
</table>
|
|
<hr>The documentation for this class was generated from the following file:<ul>
|
|
<li><a class="el" href="Granulate_8h-source.html">Granulate.h</a></ul>
|
|
<HR>
|
|
|
|
<table>
|
|
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
|
<tr><td>©1995-2005 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
|
</table>
|
|
|
|
</BODY>
|
|
</HTML>
|