summaryrefslogtreecommitdiff
path: root/opcodes/sndloop.xml
blob: bc6242a86cae625b611b09fc2a29205ebd638ed2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<refentry id="sndloop">
<indexterm id="Indexsndloop"><primary>sndloop</primary></indexterm>
  <refentryinfo><title>Signal Generators:Sample Playback</title></refentryinfo>
  <refmeta>
    <refentrytitle>sndloop</refentrytitle>
  </refmeta>

  <refnamediv>
    <refname>sndloop</refname>
    <refpurpose>
      A sound looper with pitch control.
    </refpurpose>
  </refnamediv>

  <refsect1>
    <title>Description</title>
    <para>
   This opcode records input audio and plays it back in a loop with user-defined
   duration and crossfade time. It also allows the pitch of the loop to be controlled,
   including reversed playback.
    </para>
  </refsect1>

  <refsect1>
    <title>Syntax</title>
    <synopsis>asig, krec <command>sndloop</command> ain, kpitch, ktrig, idur, ifad</synopsis>
  </refsect1>

  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>idur </emphasis> -- loop duration in seconds
    </para>
        <para>
      <emphasis>ifad </emphasis> -- crossfade duration in seconds
    </para>
  </refsect1>

  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>asig</emphasis> -- output sig
    </para>

    <para>
      <emphasis>krec</emphasis> -- 'rec on' signal, 1 when recording, 0 otherwise
    </para>

    <para>
      <emphasis>kpitch</emphasis> -- pitch control (transposition ratio); negative values play the loop back in reverse
    </para>

    <para>
      <emphasis>ktrig</emphasis> -- trigger signal: when 0, processing is bypassed. When switched on (ktrig >= 1),
      the opcode starts recording until the loop memory is full. It then plays
      the looped sound until it is switched off again (ktrig = 0). Another recording
      can start again with ktrig >= 1.
    </para>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>
      <example>
        <title>Example</title>
        <programlisting>
asig      <emphasis role="opc">in</emphasis>                               <emphasis role="comment">; get the signal in</emphasis>
ktrig     <emphasis role="opc">line</emphasis>    0, 1, 1                  <emphasis role="comment">; trigger signal</emphasis>
aout,krec <emphasis role="opc">sndloop</emphasis> asig, 1, ktrig, 4, 0.05  <emphasis role="comment">; rec starts at 1 sec, for 4 secs 0.05 crossfade</emphasis>
          <emphasis role="opc">printk</emphasis>  1, krec                  <emphasis role="comment">; prints the recording signal</emphasis>
          <emphasis role="opc">out</emphasis>     aout</programlisting>
      </example>
    </para>

    <para>
      The example above shows the basic operation of sndloop. Pitch can
      be controlled at the k-rate, recording is started as soon as the
      trigger value is >= 1. Recording can be restarted by making the trigger 0 and
      then 1 again.
    </para>
  </refsect1>

  <refsect1>
    <title>Credits</title>
    <para>
      <simplelist>
        <member>Author: &namevictor;</member>
        <member>April 2005 </member>
      </simplelist>
    </para>
    <para>New in Version 5.00</para>
  </refsect1>
</refentry>