<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="bbcutm">
  <refmeta>
    <refentrytitle>bbcutm</refentrytitle>
  </refmeta>

  <refnamediv>
    <refname>bbcutm</refname>
    <refpurpose>
      Generates breakbeat-style cut-ups of a mono audio stream.
      <indexterm id="IndexBbcutm"><primary>bbcutm</primary></indexterm>
    </refpurpose>
  </refnamediv>
  
  <refsect1>
    <title>Description</title>
    <para>
      The BreakBeat Cutter automatically generates cut-ups of a source audio stream in the style of drum and bass/jungle breakbeat manipulations.  There are two versions, for mono (<emphasis>bbcutm</emphasis>) or stereo (<emphasis>bbcuts</emphasis>) sources.  Whilst originally based on breakbeat cutting, the opcode can be applied to any type of source audio.
    </para>

    <para>
      The prototypical cut sequence favoured over one bar with eighth note subdivisions would be

      <literallayout>
3+ 3R + 2
      </literallayout>
 
      where we take a 3 unit block from the source's start, repeat it, then 2 units from the 7th and 8th eighth notes of the source.
    </para>

    <para>
      We talk of rendering phrases (a sequence of cuts before reaching a new phrase at the beginning of a bar) and units (as subdivision th notes).
    </para>

    <para>
      The opcode comes most alive when multiple synchronised versions are used simultaneously.
    </para>
  </refsect1>

  <refsect1>
    <title>Syntax</title>
    <synopsis>a1 <command>bbcutm</command> asource, ibps, isubdiv, ibarlength, iphrasebars, inumrepeats [, istutterspeed] [, istutterchance] [, ienvchoice ]</synopsis>
  </refsect1>

  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>ibps</emphasis> -- Tempo to cut at, in beats per second.
    </para>

    <para>
      <emphasis>isubdiv</emphasis> -- Subdivisions unit, for a bar. So 8 is eighth notes (of a 4/4 bar).
    </para>

    <para>
      <emphasis>ibarlength</emphasis> -- How many beats per bar. Set to 4 for default 4/4 bar behaviour.
    </para>

    <para>
      <emphasis>iphrasebars</emphasis> -- The output cuts are generated in phrases, each phrase is up to iphrasebars long
    </para>

    <para>
      <emphasis>inumrepeats</emphasis> --  In normal use the algorithm would allow up to one additional repeat of a given cut at a time. This parameter allows that to be changed. Value 1 is normal- up to one extra repeat. 0 would avoid repeating, and you would always get back the original source except for enveloping and stuttering.
    </para>

    <para>
      <emphasis>istutterspeed</emphasis> -- (optional, default=1) The stutter can be an integer multiple of the subdivision speed. For instance, if subdiv is 8 (quavers) and stutterspeed is 2, then the stutter is in semiquavers (sixteenth notes= subdiv 16). The default is 1.
    </para>

    <para>
      <emphasis>istutterchance</emphasis> -- (optional, default=0) The tail of a phrase has this chance of becoming a single repeating one unit cell stutter (0.0 to 1.0). The default is 0.
    </para>

    <para>
      <emphasis>ienvchoice</emphasis> -- (optional, default=1) choose 1 for on (exponential envelope for cut grains) or 0 for off. Off will cause clicking, but may give good noisy results, especially for percussive sources. The default is 1, on.
    </para>
  </refsect1>

  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>asource</emphasis> -- The audio signal to be cut up. This version runs in real-time without knowledge of future audio.
    </para>
  </refsect1>

  <refsect1>
    <title>Examples</title>

    <para>
      Here is a simple example of the bbcutm opcode. It uses the files <ulink url="examples/bbcutm.orc"><citetitle>bbcutm.orc</citetitle></ulink>, <ulink url="examples/bbcutm.sco"><citetitle>bbcutm.sco</citetitle></ulink>, and <ulink url="examples/beats.wav"><citetitle>beats.wav</citetitle></ulink>.

      <example>
        <title>A simple example of the bbcutm opcode.</title>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/bbcutm.orc" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/bbcutm.sco" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>
      </example>
    </para>

    <para>
      Here are some more advanced examples...

      <example>
        <title>First steps- mono and stereo versions</title>
        <programlisting>
&lt;CsoundSynthesizer&gt;
&lt;CsInstruments&gt;
sr        =         44100
kr        =         4410
ksmps     =         10
nchnls    =         2
 
instr 1
    asource diskin "break7.wav",1,0,1   ; a source breakbeat sample, wraparound lest it stop!
 
    ; cuts in eighth notes per 4/4 bar, up to 4 bar phrases, up to 1
    ; repeat in total (standard use) rare stuttering at 16 note speed,
    ; no enveloping
    asig bbcutm asource, 2.6937, 8,4,4,1,   2,0.1,0
 
    outs        asig,asig
endin
 
instr 2 ;stereo version
   asource1,asource2 diskin "break7stereo.wav",1,0,1    ; a source breakbeat sample, wraparound lest it stop!
 
  ; cuts in eighth notes per 4/4 bar, up to 4 bar phrases, up to 1
  ; repeat in total (standard use) rare stuttering at 16 note speed,
  ; no enveloping
  asig1,asig2 bbcuts asource1, asource2, 2.6937, 8,4,4,1,   2,0.1,0
 
  outs  asig1,asig2
endin
 
&lt;/CsInstruments&gt;
&lt;CsScore&gt;
i1 0 10
i2 11 10
e
&lt;/CsScore&gt;
&lt;/CsoundSynthesizer&gt;
        </programlisting>
      </example>
    </para>

    <para>
      <example>
        <title>Multiple simultaneous synchronised breaks</title>
        <programlisting>
&lt;CsoundSynthesizer&gt;
&lt;CsInstruments&gt;
sr        =         44100
kr        =         4410
ksmps     =         10
nchnls    =         1
 
instr 1
  ibps    = 2.6937
  iplaybackspeed = ibps/p5
  asource diskin p4,iplaybackspeed,0,1
 
  asig bbcutm asource, 2.6937, p6,4,4,p7,   2,0.1,1
 
  out   asig
endin
 
&lt;/CsInstruments&gt;
&lt;CsScore&gt;
 
;   source      bps cut repeats
i1 0 10 "break1.wav" 2.3 8   2  //2.3 is the source original tempo
i1 0 10 "break2.wav" 2.4 8   3
i1 0 10 "break3.wav" 2.5 16  4
e
&lt;/CsScore&gt;
&lt;/CsoundSynthesizer&gt;
        </programlisting>
      </example>
    </para>

    <para>
      <example>
        <title>Cutting up any old audio- much more interesting noises than this should be possible!</title>
        <programlisting>
&lt;CsoundSynthesizer&gt;
&lt;CsInstruments&gt;
sr        =         44100
kr        =         4410
ksmps     =         10
nchnls    =         1
 
instr 1
  asource oscil 20000,70,1
  ; ain,bps,subdiv,barlength,phrasebars,numrepeats,
  ;stutterspeed,stutterchance,envelopingon
  asig bbcutm asource, 2, 32,1,1,2, 4,0.6,1
  outs  asig
endin
 
&lt;/CsInstruments&gt;
&lt;CsScore&gt;
f1 0 256 10 1
i1 0 10
e
&lt;/CsScore&gt;
&lt;/CsoundSynthesizer&gt;
        </programlisting>
      </example>
    </para>

    <para>
      <example>
        <title>Constant stuttering- faked, not possible since can only stutter in last half bar could make extra stuttering option parameter</title>
        <programlisting>
&lt;CsoundSynthesizer&gt;
&lt;CsInstruments&gt;
sr        =         44100
kr        =         4410
ksmps     =         10
nchnls    =         1
 
instr 1
  asource diskin "break7.wav",1,0,1
 
  ;16th note cuts- but cut size 2 over half a beat.
  ;each half beat will eiather survive intact or be turned into
  ;the first sixteenth played twice in succession
 
  asig bbcutm asource,2.6937,2,0.5,1,2, 2,1.0,0
  outs  asig
endin
 
&lt;/CsInstruments&gt;
&lt;CsScore&gt;
i1 0 30
e
&lt;/CsScore&gt;
&lt;/CsoundSynthesizer&gt;
        </programlisting>
      </example>
    </para>
  </refsect1>

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="bbcuts"><citetitle>bbcuts</citetitle></link>
    </para>
  </refsect1>

  <refsect1>
    <title>Credits</title>
    <para>
      <simplelist>
        <member>Author: Nick Collins</member>
        <member>London</member>
        <member>August 2001</member>
      </simplelist>
    </para>

    <para>New in version 4.13</para>
  </refsect1>
</refentry>
