[Pipet Devel] Overflow and real-time audio processing

Jean-Marc Valin jean-marc.valin at hermes.usherb.ca
Fri Jun 23 01:30:17 EDT 2000


Hello all,

I just thought this might be interesting to some of you, as a demo of what
Overflow can do. I just "wrote" an Overflow program (.n) that performs real-time
audio processing. It reads the soundcard input, normalized the volume (lowers
louder sounds, amplifies lower sounds), and sends the result back to the
soundcard output. It takes less than 5% CPU on my Athlon 500 at 44.1kHz/stereo
(I use chunks of ~10 ms). Note, you need a full-duplex soundcard and the latest
version in CVS to try it. Any electric guitar player here would like to help me
write distortions and other effects?

Comments are welcome.

	Jean-Marc

-- 
Jean-Marc Valin
Universite de Sherbrooke - Genie Electrique
valj01 at gel.usherb.ca
-------------- next part --------------
<?xml version="1.0"?>
<Document>
  <Network type="subnet" name="MAIN">
    <Node name="node1" type="Sound" x="-248.000000" y="124.000000">
      <Parameter name="DEVICE" type="string" value="/dev/dsp"/>
      <Parameter name="RATE" type="int" value="44100"/>
      <Parameter name="STEREO" type="int" value="1"/>
      <Parameter name="MODE" type="string" value="RW"/>
      <Parameter name="BUFFER" type="int" value="4000"/>
    </Node>
    <Node name="node3" type="Discard" x="-14.000000" y="121.000000"/>
    <Node name="node2" type="LOOP" x="-98.000000" y="121.000000"/>
    <Link from="node2" output="OUTPUT" to="node3" input="INPUT"/>
    <Link from="node1" output="OUTPUT" to="node2" input="SND_IN"/>
    <Link from="node1" output="OUTPUT" to="node2" input="SND_OUT"/>
    <NetOutput name="OUTPUT" node="node3" terminal="OUTPUT"/>
  </Network>
  <Network type="iterator" name="LOOP">
    <Node name="node1" type="AudioStream" x="-173.000000" y="118.000000">
      <Parameter name="LENGTH" type="int" value="1024"/>
      <Parameter name="ADVANCE" type="int" value="1024"/>
      <Parameter name="ENCODING" type="string" value="LIN16"/>
      <Parameter name="STREAM_TYPE" type="string" value="fd"/>
    </Node>
    <Node name="node3" type="NOP" x="740.000000" y="124.000000"/>
    <Node name="node4" type="NotDone" x="-62.000000" y="43.000000"/>
    <Node name="node6" type="FDSaveFrame" x="633.000000" y="122.000000">
      <Parameter name="LEAD_IN" type="int" value="1"/>
    </Node>
    <Node name="node7" type="EFFECTS" x="186.000000" y="99.000000"/>
    <Node name="node2" type="MergeChannels" x="408.000000" y="120.000000">
      <Parameter name="INPUTLENGTH" type="int" value="512"/>
      <Parameter name="OUTPUTLENGTH" type="int" value="1024"/>
    </Node>
    <Node name="node5" type="SeparChannels" x="-26.000000" y="123.000000">
      <Parameter name="INPUTLENGTH" type="int" value="1024"/>
      <Parameter name="OUTPUTLENGTH" type="int" value="512"/>
    </Node>
    <Node name="node8" type="EFFECTS" x="192.000000" y="150.000000"/>
    <Link from="node1" output="OUTPUT" to="node4" input="INPUT"/>
    <Link from="node6" output="OUTPUT" to="node3" input="INPUT"/>
    <Link from="node1" output="OUTPUT" to="node5" input="INPUT"/>
    <Link from="node2" output="OUTPUT" to="node6" input="OBJECT"/>
    <Link from="node7" output="OUTPUT" to="node2" input="LEFT"/>
    <Link from="node5" output="LEFT" to="node7" input="INPUT"/>
    <Link from="node8" output="OUTPUT" to="node2" input="RIGHT"/>
    <Link from="node5" output="RIGHT" to="node8" input="INPUT"/>
    <NetInput name="SND_IN" node="node1" terminal="INPUT"/>
    <NetOutput name="OUTPUT" node="node3" terminal="OUTPUT"/>
    <NetCondition name="CONDITION" node="node4" terminal="OUTPUT"/>
    <NetInput name="SND_OUT" node="node6" terminal="FD"/>
  </Network>
  <Network type="subnet" name="EFFECTS">
    <Node name="node2" type="NOP" x="-1375.000000" y="95.000000"/>
    <Node name="node3" type="NOP" x="-320.000000" y="105.000000"/>
    <Node name="node5" type="Amplitude" x="-1070.000000" y="219.000000">
      <Parameter name="INPUTLENGTH" type="int" value="1024"/>
      <Parameter name="OUTPUTLENGTH" type="int" value="1"/>
    </Node>
    <Node name="node6" type="Div" x="-693.000000" y="218.000000">
      <Parameter name="LENGTH" type="int" value="1"/>
    </Node>
    <Node name="node7" type="ConstantVector" x="-840.000000" y="288.000000">
      <Parameter name="VALUE" type="string" value="&lt;Vector 80000&gt;"/>
    </Node>
    <Node name="node8" type="CGain" x="-551.000000" y="105.000000">
      <Parameter name="LENGTH" type="int" value="1024"/>
    </Node>
    <Node name="node9" type="Overlap" x="-1249.000000" y="96.000000">
      <Parameter name="INPUTLENGTH" type="int" value="512"/>
      <Parameter name="OUTPUTLENGTH" type="int" value="1024"/>
    </Node>
    <Node name="node10" type="OverlapAndAdd" x="-429.000000" y="104.000000">
      <Parameter name="INPUTLENGTH" type="int" value="1024"/>
      <Parameter name="OUTPUTLENGTH" type="int" value="512"/>
    </Node>
    <Node name="node11" type="Window" x="-1143.000000" y="96.000000">
      <Parameter name="LENGTH" type="int" value="1024"/>
      <Parameter name="WINDOW" type="string" value="HANNING"/>
    </Node>
    <Node name="node12" type="TimeFilter" x="-850.000000" y="226.000000">
      <Parameter name="LENGTH" type="int" value="1"/>
      <Parameter name="FIR" type="string" value="&lt;Vector .1 .1 .1 .1 .1 .1 .1 .1 .1 .1&gt;"/>
      <Parameter name="IIR" type="string" value="&lt;Vector 1&gt;"/>
      <Parameter name="LOOKAHEAD" type="int" value="5"/>
    </Node>
    <Node name="node1" type="Add" x="-928.000000" y="226.000000">
      <Parameter name="LENGTH" type="int" value="1"/>
    </Node>
    <Node name="node4" type="ConstantVector" x="-1078.000000" y="283.000000">
      <Parameter name="VALUE" type="string" value="&lt;Vector 10000&gt;"/>
    </Node>
    <Link from="node7" output="OUTPUT" to="node6" input="NUM"/>
    <Link from="node6" output="OUTPUT" to="node8" input="GAIN"/>
    <Link from="node2" output="OUTPUT" to="node9" input="INPUT"/>
    <Link from="node10" output="OUTPUT" to="node3" input="INPUT"/>
    <Link from="node8" output="OUTPUT" to="node10" input="INPUT"/>
    <Link from="node9" output="OUTPUT" to="node11" input="INPUT"/>
    <Link from="node12" output="OUTPUT" to="node6" input="DEN"/>
    <Link from="node11" output="OUTPUT" to="node5" input="INPUT"/>
    <Link from="node11" output="OUTPUT" to="node8" input="INPUT"/>
    <Link from="node1" output="OUTPUT" to="node12" input="INPUT"/>
    <Link from="node5" output="OUTPUT" to="node1" input="INPUT1"/>
    <Link from="node4" output="OUTPUT" to="node1" input="INPUT2"/>
    <NetInput name="INPUT" node="node2" terminal="INPUT"/>
    <NetOutput name="OUTPUT" node="node3" terminal="OUTPUT"/>
  </Network>
</Document>


More information about the Pipet-Devel mailing list