| 1 | |
| 2 | <refentry id="sndloop"> |
| 3 | <indexterm id="Indexsndloop"><primary>sndloop</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Generators:Sample Playback</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>sndloop</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>sndloop</refname> |
| 11 | <refpurpose> |
| 12 | A sound looper with pitch control. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | This opcode records input audio and plays it back in a loop with user-defined |
| 20 | duration and crossfade time. It also allows the pitch of the loop to be controlled, |
| 21 | including reversed playback. |
| 22 | </para> |
| 23 | </refsect1> |
| 24 | |
| 25 | <refsect1> |
| 26 | <title>Syntax</title> |
| 27 | <synopsis>asig, krec <command>sndloop</command> ain, kpitch, ktrig, idur, ifad</synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Initialization</title> |
| 32 | <para> |
| 33 | <emphasis>idur </emphasis> -- loop duration in seconds |
| 34 | </para> |
| 35 | <para> |
| 36 | <emphasis>ifad </emphasis> -- crossfade duration in seconds |
| 37 | </para> |
| 38 | </refsect1> |
| 39 | |
| 40 | <refsect1> |
| 41 | <title>Performance</title> |
| 42 | <para> |
| 43 | <emphasis>asig</emphasis> -- output sig |
| 44 | </para> |
| 45 | |
| 46 | <para> |
| 47 | <emphasis>krec</emphasis> -- 'rec on' signal, 1 when recording, 0 otherwise |
| 48 | </para> |
| 49 | |
| 50 | <para> |
| 51 | <emphasis>kpitch</emphasis> -- pitch control (transposition ratio); negative values play the loop back in reverse |
| 52 | </para> |
| 53 | |
| 54 | <para> |
| 55 | <emphasis>ktrig</emphasis> -- trigger signal: when 0, processing is bypassed. When switched on (ktrig >= 1), |
| 56 | the opcode starts recording until the loop memory is full. It then plays |
| 57 | the looped sound until it is switched off again (ktrig = 0). Another recording |
| 58 | can start again with ktrig >= 1. |
| 59 | </para> |
| 60 | </refsect1> |
| 61 | |
| 62 | <refsect1> |
| 63 | <title>Examples</title> |
| 64 | <para> |
| 65 | Here is an example of the sndloop opcode. It uses the file <ulink url="examples/sndloop.csd"><citetitle>sndloop.csd</citetitle></ulink>. |
| 66 | <example> |
| 67 | <title>Example of the sndloop opcode.</title> |
| 68 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 69 | <xi:include href="examples-xml/sndloop.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 70 | </example> |
| 71 | </para> |
| 72 | <para> |
| 73 | The example above shows the basic operation of sndloop. Pitch can |
| 74 | be controlled at the k-rate, recording is started as soon as the |
| 75 | trigger value is >= 1. Recording can be restarted by making the trigger 0 and |
| 76 | then 1 again. |
| 77 | </para> |
| 78 | </refsect1> |
| 79 | |
| 80 | <refsect1> |
| 81 | <title>See also</title> |
| 82 | <para><link linkend="SiggenSample"><citetitle>Sample Playback</citetitle></link></para> |
| 83 | </refsect1> |
| 84 | |
| 85 | <refsect1> |
| 86 | <title>Credits</title> |
| 87 | <para> |
| 88 | <simplelist> |
| 89 | <member>Author: &namevictor;</member> |
| 90 | <member>April 2005 </member> |
| 91 | </simplelist> |
| 92 | </para> |
| 93 | <para>New in Version 5.00</para> |
| 94 | </refsect1> |
| 95 | </refentry> |