| 1 | |
| 2 | <refentry id="sflooper"> |
| 3 | <indexterm id="Indexsflooper"><primary>sflooper</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Generators:Sample Playback</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>sflooper</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>sflooper</refname> |
| 11 | <refpurpose> |
| 12 | Plays a SoundFont2 (SF2) sample preset, generating a stereo sound, with user-defined |
| 13 | time-varying crossfade looping. |
| 14 | </refpurpose> |
| 15 | </refnamediv> |
| 16 | |
| 17 | <refsect1> |
| 18 | <title>Description</title> |
| 19 | <para> |
| 20 | Plays a SoundFont2 (SF2) sample preset, generating a stereo sound, similarly to <emphasis>sfplay</emphasis>. Unlike that opcode, though, |
| 21 | it ignores the looping points set in the SF2 file and substitutes them for a user-defined crossfade loop. It is |
| 22 | a cross between <link linkend="sfplay"><citetitle>sfplay</citetitle></link> and |
| 23 | <link linkend="flooper2"><citetitle>flooper2</citetitle></link>. |
| 24 | In order to understand the usage of these opcodes, the user must have some knowledge of the SF2 format, so a brief description of this format can be found in the <link linkend="SiggenSample"><citetitle>SoundFont2 File Format</citetitle></link> section. |
| 25 | </para> |
| 26 | </refsect1> |
| 27 | |
| 28 | <refsect1> |
| 29 | <title>Syntax</title> |
| 30 | <synopsis>ar1, ar2 <command>sflooper</command> ivel, inotenum, kamp, kpitch, ipreindex, kloopstart, kloopend, kcrossfade \ |
| 31 | [, istart, imode, ifenv, iskip, iflag] </synopsis> |
| 32 | </refsect1> |
| 33 | |
| 34 | <refsect1> |
| 35 | <title>Initialization</title> |
| 36 | <para> |
| 37 | <emphasis>ivel</emphasis> -- velocity value |
| 38 | </para> |
| 39 | |
| 40 | <para> |
| 41 | <emphasis>inotenum</emphasis> -- MIDI note number value |
| 42 | </para> |
| 43 | |
| 44 | <para> |
| 45 | <emphasis>ipreindex</emphasis> -- preset index |
| 46 | </para> |
| 47 | |
| 48 | <para> |
| 49 | <emphasis>istart </emphasis> -- playback start pos in seconds |
| 50 | </para> |
| 51 | <para> |
| 52 | <emphasis>imode </emphasis> -- loop modes: 0 forward, 1 backward, 2 back-and-forth [def: 0] |
| 53 | </para> |
| 54 | <para> |
| 55 | <emphasis>ifenv </emphasis> -- if non-zero, crossfade envelope shape table number. The default, 0, sets |
| 56 | the crossfade to linear. |
| 57 | </para> |
| 58 | <para> |
| 59 | <emphasis>iskip </emphasis> -- if 1, the opcode initialisation is skipped, for tied notes, performance |
| 60 | continues from the position in the loop where the previous note stopped. The default, 0, does not skip |
| 61 | initialisation |
| 62 | </para> |
| 63 | <para> |
| 64 | <emphasis>iflag</emphasis> -- flag regarding the behavior of <emphasis>kpitch</emphasis> and <emphasis>inotenum</emphasis> |
| 65 | </para> |
| 66 | |
| 67 | </refsect1> |
| 68 | |
| 69 | <refsect1> |
| 70 | <title>Performance</title> |
| 71 | |
| 72 | <para> |
| 73 | <emphasis>kamp</emphasis> -- amplitude scaling </para> |
| 74 | <para> |
| 75 | <emphasis>kpitch</emphasis> -- pitch control (transposition ratio, negative values are not allowed) or frequency multiplier, depending by iflag. When iflag = 0, kpitch is a multiplier of a the default frequency, assigned by SF2 preset to the inotenum value. When iflag = 1, kpitch is the absolute frequency of the output sound, in Hz. Default is 0. |
| 76 | When iflag = 0, inotenum sets the frequency of the output according to the MIDI note number used, and kpitch is used as a multiplier. When iflag = 1, the frequency of the output, is set directly by kpitch. This allows the user to use any kind of micro-tuning based scales. However, this method is designed to work correctly only with presets tuned to the default equal temperament. Attempts to use this method with a preset already having non-standard tunings, or with drum-kit-based presets, could give unexpected results. |
| 77 | </para> |
| 78 | <para> |
| 79 | <emphasis>kloopstart</emphasis> -- loop start point (secs). Note that although k-rate, loop parameters |
| 80 | such as this are only updated once per loop cycle. If loop start is set beyond the end of the sample, no looping |
| 81 | will result. |
| 82 | </para> |
| 83 | <para> |
| 84 | <emphasis>kloopend</emphasis> -- loop end point (secs), updated once per loop cycle. |
| 85 | </para> |
| 86 | <para> |
| 87 | <emphasis>kcrossfade </emphasis> -- crossfade length (secs), updated once per loop cycle and limited to |
| 88 | loop length.</para> |
| 89 | </refsect1> |
| 90 | |
| 91 | <refsect1> |
| 92 | <para> |
| 93 | <emphasis>sflooper</emphasis> plays a preset, generating a stereo sound. |
| 94 | </para> |
| 95 | |
| 96 | <para> |
| 97 | These opcodes only support the sample structure of SF2 files. The modulator structure of the SoundFont2 format is not supported in Csound. Any modulation or processing to the sample data is left to the Csound user, bypassing all restrictions forced by the SF2 standard. |
| 98 | </para> |
| 99 | <para> |
| 100 | Note: The looping points are set on the root key of every sample that is part of the preset of the soundfont. |
| 101 | For instance, a soundfont can have a single sample for the whole keyboard. In that case, sflooper will work like flooper and flooper2, because as the sample is transposed, played back at different rates, the loop will get short or longer. |
| 102 | If however the soundfont has a sample for each key, than there will be no transposition and the loop will stay the same length (unless you change kpitch). |
| 103 | </para> |
| 104 | </refsect1> |
| 105 | |
| 106 | <refsect1> |
| 107 | <title>Examples</title> |
| 108 | <para> |
| 109 | Here is an example of the sflooper opcode. It uses the file <ulink url="examples/sflooper.csd"><citetitle>sflooper.csd</citetitle></ulink>. |
| 110 | <example> |
| 111 | <title>Example of the sflooper opcode.</title> |
| 112 | <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> |
| 113 | <xi:include href="examples-xml/sflooper.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 114 | </example> |
| 115 | </para> |
| 116 | </refsect1> |
| 117 | |
| 118 | <refsect1> |
| 119 | <title>See also</title> |
| 120 | <para><link linkend="SiggenSample"><citetitle>Soundfonts</citetitle></link></para> |
| 121 | <para> More information on soundfonts is in the Floss Manuals: <ulink url="https://flossmanual.csound.com/midi/reading-midi-files"><citetitle>https://flossmanual.csound.com/midi/reading-midi-files</citetitle></ulink></para> |
| 122 | <para> For other information on soundfonts look in the Wikipedia: <ulink url="http://en.wikipedia.org/wiki/Soundfont"><citetitle>http://en.wikipedia.org/wiki/Soundfont</citetitle></ulink></para> |
| 123 | </refsect1> |
| 124 | |
| 125 | <refsect1> |
| 126 | <title>Credits</title> |
| 127 | <para> |
| 128 | <simplelist> |
| 129 | <member>Author: &namevictor;</member> |
| 130 | <member>August 2007</member> |
| 131 | </simplelist> |
| 132 | </para> |
| 133 | |
| 134 | <para>New in Csound Version 5.07</para> |
| 135 | </refsect1> |
| 136 | </refentry> |