Sophie

Sophie

distrib > Mandriva > 2009.1 > x86_64 > by-pkgid > 2e5532088315f35e555b7b433cfe7599 > files > 27

ecasound-2.5.2-2mdv2009.1.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Ecasound Examples</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="author" lang="en" content="Kai Vehmanen" />
<link rel="stylesheet" type="text/css" href="style_ecasound.css" />
</head>
<body>

<hr />

<center><h2>Ecasound Examples - The Best Place to Get Started with Ecasound</h2></center>

<hr />

<p>Remember to also check out the 
<a href="http://eca.cx/ecasound/Documentation/tutorials.html">Ecasound Tutorials and Articles</a>
[<a href="tutorials.html">alt link</a>]
page, the 
<a href="http://eca.cx/ecasound/Documentation/ecasound_manpage.html">ecasound(1)</a>
[<a href="ecasound_manpage.html">alt link</a>]
manpage, and
the <a href="http://eca.cx/ecasound/Documentation/users_guide/html_uguide/users_guide.html">
Ecasound User&rsquo;s Guide</a>.</p>

<p>
The console mode user-interface, <i>ecasound</i>, is 
used in all the following examples. Other ecasound frontends 
may use a different syntax, but the basic principles are the 
still the same as long as ecasound is used as the backend
engine.
</p>

<p>
Version note: sections describing recently introduced features
have a note about the minimum required version.
</p>

<ul>
<li><a href="#fconversions">Format Conversions</a></li>
<li><a href="#rtplayback">Realtime Outputs (playing to a sound device)</a></li>
<li><a href="#rtrecording">Realtime Inputs (recording from a sound device)</a></li>
<li><a href="#rtjack">Use with JACK audio server</a></li>
<li><a href="#effects">Effect Processing</a></li>
<li><a href="#controllers">Using controller sources with effects</a></li>
<li><a href="#multitrack">Multitrack Recording</a></li>
<li><a href="#mixing">Mixing</a></li>
<li><a href="#cutcopypaste">Cut, Copy and Paste</a></li>
<li><a href="#audio_ops">Manipulating objects - looping, reversing, ...</a></li>
<li><a href="#multichannel">Multichannel Processing</a></li>
<li><a href="#srouting">Signal Routing through External Devices</a></li>
<li><a href="#presets">Presets and LADSPA Effect Plugins</a></li>
<li><a href="#midi-io">More with MIDI</a></li>
<li><a href="#tonegeneration">Tone generation</a></li>
<li><a href="#piping">Piping data from other processes</a></li>
<!-- <li></li> -->
</ul>

<hr />

<!-- ###  new section ### -->
<p class="examplecat">
<a name="fconversions"><b>Format Conversions</b></a>
</p>
<p>
These first two commands do the exact same thing, conver <i>somefile.wav</i> to
<i>somefile.cdr</i> (CDR is the CD-Audio track format). As no chains are 
specified, the <i>default</i> chain is created and used. 
</p>

<blockquote>
<pre class="codepre">1. ecasound -i:somefile.wav -o:somefile.cdr
2. ecasound -i somefile.wav -o somefile.cdr</pre>
</blockquote>

<p>
This is not a very useful example, but hopefully helps to understand 
the way chains work:
</p>

<blockquote>
<pre class="codepre">3. ecasound -a:1,2 -i somefile.wav -a:1 -o somefile.cdr -a:2 -o somefile.mp3</pre>
</blockquote>

<p>
First, two new chains <i>1</i> and <i>2</i> (you can also use strings: 
'-a:some_name_with_no_whitespaces,some_other_name') are created.
They are now the active chains. After this, input <i>somefile.wav</i> is
connected to both these chains. The rest follows the same scheme.
Chain '1' is set active and output <i>somefile.cdr</i> is
attached to it. In the same way, <i>somefile.mp3</i> is attached to
chain '2'.
</p>

<p>
The last example is similar to the first two, but now ecasound is 
started in interactive mode:
</p>

<blockquote>
<pre class="codepre">4. ecasound -c -i somefile.wav -o somefile.cdr</pre>
</blockquote>

<!-- ###  new section ### -->
<p class="examplecat">
<a name="fcresampling"><b>Format Conversions - Resampling</b></a>
</p>

<blockquote>
<pre class="codepre">1. ecasound -f:16,2,96000 -i resample,auto,foo44100.wav -o bar96k.wav
2. ecasound -f:16,2,44100 -i resample,auto,bar96k.wav -o foo44100.wav
3. ecasound -f:16,2,44100 -i resample-hq,48k,foo48k.wav -o bar.wav
4. ecasound -f:16,2,44100 -i resample,96k,third.raw -o foo44100.wav</pre>
</blockquote>

<p>
To do resampling, a special 'resample' input type must be used. 
In the first example above, the 44100Hz file <i>foo44100.wav</i> is 
resampled to 96kHz and the result is written to <i>bar96k.wav</i>.
In the second example the reverse is done, sample rate is converted
from 96khz to 44100Hz. In the last example, the from rate has to
be specified explicitly as raw audio files do not contain the 
necessary header information.
</p>

<p>
In the last example we do a 48000Hz to 44100Hz conversion using
the 'resample-hq' input type. If Ecasound was built with support
for the libsamplerate package, 'resample-hq' selects
the high-quality conversion mode. In this mode the conversion
process requires more CPU power, but the results are of
higher quality. Using libsamplerate also improves quality 
of the default 'resample' mode.
</p>

<!-- ###  new section ### -->
<p class="examplecat">
<a name="rtplayback"><b>Realtime Outputs (playing to a sound device)</b></a>
</p>

<p>
Following are examples of recording from, and playing back to,
ALSA sound device (Linux):
</p>

<blockquote>
<pre class="codepre">1. ecasound -i somefile.mp3 -o alsa
2. ecasound -i somefile.mp3 -o alsahw,0,0
3. ecasound -i somefile.mp3 -o alsaplugin,0,0
4. ecasound -i somefile.mp3 -o alsa,soundcard_name</pre>
</blockquote>

<p>
ALSA sound subsystem provides multiple ways to select which audio
device to use, and how it is accessed. A plain "alsa" will use the default 
ALSA sound device (depends on system configuration). Alternatively you can either 
specify "alsahw" (to indicate you want use the ALSA direct hardware interface), 
or "alsaplugin" (to utilize the ALSA plugin layer). Both accept card number and 
device number as parameters. Optionally also subdevice can be given. 
The plugin layer is able to handle some type conversions automatically. 
Yet another option is to specify the ALSA device name ('soundcard_name').
The device name must be defined in the ALSA configuration files (either in
~/.asoundrc or in the global settings file). 
</p>

<p>
Following are examples of recording from, and playing back to,
OSS sound device (Linux, BSDs and many other OS'es):
</p>

<blockquote>
<pre class="codepre">1. ecasound somefile.wav
2. ecasound -i somefile.wav
3. ecasound -i:somefile.wav
4. ecasound -i somefile.wav -o /dev/dsp</pre>
</blockquote>

<p>
If you haven't touched your <b>~/.ecasound/ecasoundrc</b> configuration file,
these should all do the same thing, output <i>somefile.wav</i> to
<i>/dev/dsp</i> using the <i>default</i> chain. If no inputs are 
specified, ecasound tries to use the first non-option argument on the
command line as a default input. If no chains are specified, the chain
'default' is created and set active. If no outputs are specified,
the default-output defined in <b>~/.ecasound/ecasoundrc</b> is used. 
This is normally <i>/dev/dsp</i>.
</p>

<p>
See also section on <a href="#rtjack">JACK</a> below.
</p>

<!-- ###  new section ### -->
<p class="examplecat">
<a name="rtrecording"><b>Realtime Inputs (recording from a sound device)</b></a>
</p>

<blockquote>
<pre class="codepre">1. ecasound -i /dev/dsp0 -o somefile.wav
2. ecasound -i alsa -o somefile.wav -c
3. ecasound -i alsahw,1,0 -o somefile.wav</pre>
</blockquote>

<p>
These are simple examples of recording. When recording, it may
be useful to run ecasound in interactive mode (-c).
</p>

<p>
See also section on <a href="#rtjack">JACK</a> below.
</p>

<!-- ###  new section ### -->
<p class="examplecat">
<a name="rtjack"><b>Use with JACK audio server</b></a>
</p>

<blockquote>
<pre class="codepre">1. ecasound -i foo.wav -o jack_alsa
2. ecasound -i foo.wav -o jack</pre>
</blockquote>

<p>
This will create a separate JACK output port for each channel
of foo.wav, and automatically connect these Ecasound ports to
the ALSA PCM output ports in the JACK server.  The second
example will create JACK output ports, but does not establish
any connections (you have to do this yourself with jack_connect,
qjackconnet, qjackctl, or other similar tool).
</p>

<blockquote>
<pre class="codepre">3. ecasound -c -i foo.wav -o jack_alsa -G:jack,eca_slave,recv</pre>
</blockquote>

<p>
Like in previous examples, but the ecasound client name (as shown
to other JACK clients) is set to "eca_slave", and ecasound is 
configured to react to incoming transport changes (play, stop,
seek, etc). By default ecasound both sends and reacts to 
transport events.
</p>

<!-- ###  new section ### -->
<p class="examplecat">
<a name="effects"><b>Effect Processing</b></a>
</p>

<p> 
Ecasound is an extremely versatile tool when it comes to effect
processing. After all, it was originally programmed for non-realtime
signal processing. Here are some of examples:
</p>

<blockquote>
<pre class="codepre">1. ecasound -i somefile.mp3 -o alsa -ea:120
2. ecasound -a:default -i somefile.mp3 -o alsa -ea:120</pre>
</blockquote>

<p>
These two perform the same thing: an mp3 input file is amplified to 120% 
(linear scale) and fed to ALSA default PCM sound device.
</p>

<blockquote>
<pre class="codepre">3.ecasound -i somefile.mp3 -o alsa -etr:40,0,55 -ea:120</pre>
</blockquote>

<p>
Like the previous examples, but now a reverb effect, with a delay of 40
milliseconds, with surround mode disabled and mix ratio of 55%, is added to 
the chain before the amplify effect. In other words the signal is first
processed with the reverb and then amplified. Any number of effects 
can be combined this way. Note that when a real-time input/output,
like the ALSA PCM device in above example, is part of the setup, one
must have enough CPU power to run the effect algorithms in real-time (at
the speed of the sound device). When this happens, ecasound will start
warning about buffer over- or underruns (often referred to as 'xruns'),
and the audio output may be garbled. An easy way to work aroud processing
power limitations is to split the processing into two steps: first apply
the effects and write output to a file, and then as a separate step
play the file to a sound device.
</p>

<blockquote>
<pre class="codepre">
4. ecasound -a:1,2 -i somefile.mp3 -o alsa \
        -a:1 -etr:40,0,55 -ea:120 \
        -a:2 -efl:400</pre>
</blockquote>

<p>
Ok, let's next do some parallel processing: two chains are created and 
the input and output files are connected to them. As a result, the input
signal is processed with two sets of effects, and then mixed back
together. You can create as many chains this way as you want.
</p>

<!-- ###  new section ### -->
<p class="examplecat">
<a name="controllers"><b>Using controller sources with effects</b></a>
</p>

<blockquote>
<pre class="codepre">1. ecasound -i somefile.wav -o alsa -ef3:800,1.5,0.9 -kos:1,400,4200,0.2,0 -kos:2,0.1,1.5,0.15,0
2. ecasound -i somefile.wav -o alsa -ef3:800,1.5,0.9 -km:1,400,4200,74,1 -km:2,0.1,1.5,71,1</pre>
</blockquote>

<p>
The first example uses two sine oscillators
('-kos:parameter,range_low,range_high,speed_in_Hz,initial_phase')
to control a resonant lowpass filter. The cutoff frequency varies
betweeen 400 and 4200 Hz, while resonance varies between 0.1 and 1.5.
The initial phase is 0 (times pi). The second example uses MIDI continuous
controllers
('-km:parameter,range_low,range_high,controller_number,midi-channel')
as controller sources. The ranges are the same as in the
in first example. Controller numbers used are 74 (cutoff) and 71
(resonance). In other words you can use your synth's cutoff and
resonance knobs.
</p>

<p>
It's also possible to control controllers with other controllers 
using the '-kx' option. Normally when you add a controller,
you're controlling the last specified chain operator. 
'-kx' changes this. Let's take an example:
</p>

<blockquote>
<pre class="codepre">3. ecasound -i file.wav -o alsa -ea:100 -kos:1,0,100,0.5,0 -kx -kos:4,0.1,5,0.5,0</pre>
</blockquote>

<p>
Same as before, but now another 0.5Hz sine oscillator is controlling 
the frequency of the first oscillator.
</p>

<p>
Now let's add a MIDI-controller (CC) to the mix. In the following, a sine oscillator 
is assigned to the cutoff frequency, while other controller is controlling the resonance.
MIDI control change messages from controller 2 (range of 0-127) on channel 1 (range of 1-16
channels) are used to control the frequency of the sine oscillator (with MIDI control
value range of 0-127 mapped to oscillator frequencies 0.5-1.5kHz).
</p>

<blockquote>
<pre class="codepre">4. ecasound -i file.wav -o alsa -ef3:1000,1.0,1.0 -kos:1,500,2000,1,0 \
        -kos:2,0.2,1.0,0.5,0 \
        -kx -km:1,0.1,1.5,2,1</pre>
</blockquote>

<!-- ###  new section ### -->
<p class="examplecat">
<a name="multitrack"><b>Multitrack Recording</b></a>
</p>

<blockquote>
<pre class="codepre">1. ecasound -c -f:16,2,44100 \
        -a:1 -i monitor-track.wav -o alsa \
        -a:2 -i alsa -o new-track.wav</pre>
</blockquote>

<p>
It really is this simple. Then a default sample format
is set with '-f:bits,channels,sample_rate'. Now all that's left
is to specify two chains: one for monitoring and one for recording.
When using the above command, you need to have some way of monitoring 
the signal that is recorded. The preferred way is to utilize 
hw-monitoring of the audio device: unmute and adjust the line-in level 
with the mixer application (e.g. "alsamixer" or "alsamixergui").
If you want to use ecasound for digital monitoring, you have to add 
a separate chain for it:</p>

<blockquote>
<pre class="codepre">2. ecasound -c -b:256 \
        -a:1 -i monitor-track.wav \
        -a:2,3 -i alsa \
        -a:2 -o new-track.wav \
        -a:1,3 -o alsa</pre>
</blockquote>

<p> 
You can always do test recordings until you find the optimal volume
levels (using the soundcard mixer apps and adjusting source volume),
but ecasound offers a better way to do this. This is a bit ugly,
but what's most important, it works in text-mode:
</p>

<blockquote>
<pre class="codepre">3. ecasound -c -f:16,2,44100 -a:1 -i alsa -o alsa -ev</pre>
</blockquote>

<p>Basicly this just records from ALSA default PCM input, puts the signal through
an analyze ('-ev') operator and outputs to ALSA output. The secret
here is that you can get volume statistics with the <u>estatus</u> (or
<u>es</u>) command in interactive mode. Newer ecasound versions (1.8.5
and newer) provide a separate 'ecasignalview' application, which can
be used to monitor signal level in real-time.
</p>

<!-- ###  new section ### -->
<p class="examplecat">
<a name="mixing"><b>Mixing</b></a></p>

<p>
Here's a few real-life mixdown examples.
</p>

<blockquote>
<pre class="codepre">1. ecasound -c \
     -a:1 -i drums.wav \
     -a:2 -i synth-background.wav \
     -a:3 -i bass-guitar_take-2.ewf \
     -a:4 -i brass-house-lead.wav \
     -a:all -o alsa</pre>
</blockquote>

<p>
First of all, interactive-mode is selected with '-c' to allow
controlling of mixdown playback (starting, stopping, seeking and
so forth). The mixdown consists of four inputs (all stereo). Each 
input is routed to a dedicated chains (named '1'...'4'). The 
chains are mixed by routing them all to a single output 
device (the ALSA default PCM device).
</p>

<blockquote>
<pre class="codepre">2. ecasound -c -r \
     -a:1 -i drums.wav -ea:200 \
     -a:2 -i synth-background.wav -epp:40 -ea:120 \
     -a:3 -i bass-guitar_take-2.ewf -ea:75 \
     -a:4 -i brass-house-lead.wav -epp:60 -ea:50 \
     -a:1,2,3,4 -o loop,1 \
     -a:5,6 -i loop,1 \
     -a:5 -o alsa \
     -a:6 -o current-mix.wav</pre>
</blockquote>

<p>
This second example is more complex. The same inputs are used, but
this time effects (amplify '-ea:mix_percent' and panning '-epp:left_right_balance') 
are also used. Additionally we want to route the full mix to both the ALSA sound 
device and to a file. As a single chain can be connected to at most one input
and one output, use of a virtual loop device is needed in this example. The four 
input chains are first routed to a loop device 'loop,1' ('1' identifies the loop 
object instance). Then two new chains, '5' and '6', are defined. The loop
device is set as input to both of these chains (using the '-a:5,6 -i loop,1' 
syntax). As the final step, the ALSA device is set as the output for chain '5'
and the file 'current-mix.wav' as the output of chain '6'.
</p>

<!-- ###  new section ### -->
<p class="examplecat">
<a name="cutcopypaste"><b>Cut, Copy and Paste</b></a></p>

<p>
Here's a simple example where the first 60 seconds of bigfile.wav 
is written to part1.wav and the rest to part2.wav:
</p>

<blockquote>
<pre class="codepre">1.a) ecasound -i bigfile.wav -o part1.wav -t:60.0
  b) ecasound -i bigfile.wav -y:60.0 -o part2.wav</pre>
</blockquote>

<p>
If you want to combine these files back to one big file:
</p>

<blockquote>
<pre class="codepre">2. ecasound -i part2.wav -o part1.wav -y:500</pre>
</blockquote>

<p>
In the above second example, part2.wav is appended to part1.wav.
</p>

<!-- ###  new section ### -->
<p class="examplecat">
<a name="audio_ops"><b>Manipulating objects - looping, reversing, ...</b></a></p>

<p>
To continuously loop an audio file, you can use 'audioloop':
</p>

<blockquote>
<pre class="codepre">1. ecasound -i audioloop,drumloop.wav -o alsa</pre>
</blockquote>

<p>
To run the loop for 65.0secs, you can use '-t':
</p>

<blockquote>
<pre class="codepre">2. ecasound -i audioloop,drumloop.wav -o alsa -t:65.0</pre>
</blockquote>

<p>
To play an audio file in reserve:
</p>

<blockquote>
<pre class="codepre">3. ecasound -i reverse,drumloop.wav -o alsa</pre>
</blockquote>

<p>
The various operations can also be stacked. Let's first start
by selecting a 5sec second out of a bigger file and play 
that out to the ALSA device.
</p>

<blockquote>
<pre class="codepre">4. ecasound  -i select,5,10,audioclip.wav -o alsa</pre>
</blockquote>

<p>
Next let's play that segment in reverse:
</p>

<blockquote>
<pre class="codepre">5. ecasound  -i reverse,select,5,10,audioclip.wav -o alsa</pre>
</blockquote>

<p>
But you can still keep adding new operators. Let's now 
loop the reversed segment:
</p>

<blockquote>
<pre class="codepre">6. ecasound  -i audioloop,reverse,select,5,10,audioclip.wav -o alsa</pre>
</blockquote>

Another available operator is "playat", which can be used to play an audio
clip at a given moment in time (i.e. postpone the time it is
played). A simple example of playing "audioclip.wav" at position 20sec (i.e.
20secs of silences and then file is played out from start).

<blockquote>
<pre class="codepre">7. ecasound  -i playat,20.0,audioclip.wav -o alsa</pre>
</blockquote>

This operatoror can be combined with others as well. To select
a 10sec clip, starting at 25sec (i.e. 25-35sec of "audioclip.wav"), and 
play it at 180.5sec (with total length of 180.5+10.0=190.5sec):

<blockquote>
<pre class="codepre">8. ecasound  -i playat,180.5,select,25,10.0,audioclip.wav -o alsa</pre>
</blockquote>

<p>
Version note: 'audioloop', 'select' and 'playat' audio object types were
added to ecasound version 2.5.0.
</p>

<!-- ###  new section ### -->
<p class="examplecat">
<a name="multichannel"><b>Multichannel Processing</b></a></p>

<p>
Ecasound chains can transport multiple channels of audio. The channel
count of a chain is defined by the input and output connected
to it. Normally effects and other chain operators operate on
all channels of a chain. But it is also possible to operate on specific c
hannels only. Here's an example of how to split a four channel input
file into four separate one channel output files:
</p>

<blockquote>
<pre class="codepre">1. ecasound -a:1,2,3,4 -i 4-channel-file.wav \
 	    -a:1 -f:16,1,44100 -o mono-1.wav \
 	    -a:2 -f:16,1,44100 -o mono-2.wav -chcopy:2,1 \
 	    -a:3 -f:16,1,44100 -o mono-3.wav -chcopy:3,1 \
 	    -a:4 -f:16,1,44100 -o mono-4.wav -chcopy:4,1</pre>
</blockquote>

<p>
Note that all four channels of '4-channel-file.raw' are routed
to all the four chains '1' through '4'. At the output stage, 
all the output files are one channel (because of '-f:16,1,44100) and 
thus only the first channel of each chain is written to the output. To 
perform the correct routing, the '-chcopy' operator is used to copy 
source channel 'N' to first channel (which will be written to 
the output file). In chain '1' no channel copying is needed as the
first channel already has the necessary contents.
</p>

<p>
Version note: '-chcopy' was introduced in version 2.4.5. In earlier versions
'-erc' provides similar functionality.
</p>

<p> 
To amplify a specific channel, '-eac' can be used. Here's an 
example where 3rd channel of a 4ch file is amplified by 150% (linear
scale):
</p>

<blockquote>
<pre class="codepre">2. ecasound -i 4ch-infile.wav -ea:150,3 -o 4ch-outfile.wav</pre>
</blockquote>

<!-- ###  new section ### -->
<p class="examplecat">
<a name="srouting"><b>Signal Routing through External Devices</b></a></p>

<p>
Signal routing is done using similar setups as is used for multirack 
recording. The only difference is that the realtime input(s) and output(s) 
are externally connected (fed through an external effect processor 
for instance).
</p>

<blockquote>
<pre class="codepre">1. ecasound -c -f:16,2,44100 \
	      -a:1 -i source-track.wav -o alsa \
  	      -a:2 -i alsa -o processed-track.wav</pre>
</blockquote>

<!-- ###  new section ### -->
<p class="examplecat">
<a name="presets"><b>Presets and LADSPA Effect Plugins</b></a></p>

<p>
The following produces a 440Hz sine tone (e.g. for tuning purposes) and
plays it out with the default ALSA PCM device. For this to work, one
needs to have the LADSPA SDK needs installed (see 
<a href="http://www.ladspa.org">www.ladspa.org</a>).
</p>

<blockquote>
<pre class="codepre">1. ecasound -i null -o alsa -el:sine_fcac,440,1</pre>
</blockquote>

<p>
The next example produces a metrome signal with tempo of 120BPM:
</p>

<blockquote>
<pre class="codepre">2. ecasound -i:null -o:alsa -el:sine_fcac,880,1 -eemb:120,10 -efl:2000</pre>
</blockquote>

<p>
As the syntax might look a bit difficult for everyday use, the above is provided
also as an effect preset:
</p>

<blockquote>
<pre class="codepre">3. ecasound -i:null -o:alsa -pn:metronome,120</pre>
</blockquote>

<p>
To look at the definition of 'metronome', see the file 'effect_presets' that
comes with ecasound distribution (contains the the predefined effect presets). 
By default, location of this file is '/usr/share/ecasound/effect_presets'.
</p>

<!-- ###  new section ### -->
<p class="examplecat">
<a name="midi-io"><b>More MIDI examples</b></a></p>

<p>
The following is a simple example how an MIDI continuous controller (CC) is 
used to control an ecasound effect parameter (the cutoff frequency of 
the low-pass filter '-efl'):
</p>

<blockquote>
<pre class="codepre">1. ecasound -i somefile.wav -o alsa -efl:400 -km:1,400,4200,74,1</pre>
</blockquote>

<p>
The above example uses OSS rawmidi access, which is equivalent to adding '-Md:rawmidi,/dev/midi' 
to the command line. To do the same with ALSA, the syntax is as follows:</p>

<blockquote>
<pre class="codepre">2. ecasound -i somefile.wav -o alsa -efl:400 -km:1,400,4200,74,1 -Md:rawmidi,/dev/snd/midiC0D0
3. ecasound -i somefile.wav -o alsa -efl:400 -km:1,400,4200,74,1 -Md:alsaseq,80:1
4. ecasound -i somefile.wav -o alsa -efl:400 -km:1,400,4200,74,1 -Md:alsaseq,KMidimon</pre>
</blockquote>

<p>
The first one uses the ALSA rawmidi interface and opens an
ALSA device (card 0, device 0) for raw MIDI I/0. The second
example uses the ALSA sequencer API, which is more powerful as 
you can route MIDI packets not only to hardware interfaces, but
also to and from other applications supporting the sequencer API. 
"80,1" and "KMidimon" are sequencr ports to which ecasound should 
connect. You can use the "aconnect" (part of the alsa-utils package) tool 
to list all available sequencer ports.
</p>

<p>
Version note: For ALSA sequencer support, you need ecasound 2.4.3 or
newer.
</p>

<!-- ###  new section ### -->
<p class="examplecat">
<a name="tonegeneration"><b>Tone generation</b></a></p>

<p> 
Ecasound also provides a few tone generation primitives. These are 
mainly intended for testing, but can have other uses as well. For 
a more versatile set of tone generators, one can utilize the various
LADSPA plugins that produce tones. 
</p>

<p>
A sine tone of 880Hz, played out to the default ALSA
sound device:
</p>

<blockquote>
<pre class="codepre">1. ecasound -i tone,sine,880 -o alsa</pre>
</blockquote>

<p>
The above continuous to produce the tone indefinitely. It is
also possible to create a test tone of finite length. First,
a sine tone of 440Hz with length of exactly 22.25secs. Then 
a similar example, in which the length of the tone is given
in samples (88200 in this case):
</p>

<blockquote>
<pre class="codepre">2. ecasound -i tone,sine,440,22.25 -o alsa
3. ecasound -i tone,sine,880,88200sa -o alsa</pre>
</blockquote>

<p>
Version note: 'tone' audio object type was added to ecasound 
version 2.5.0.
</p>

<!-- ###  new section ### -->
<p class="examplecat">
<a name="piping"><b>Piping data from other processes</b></a></p>

<p>
Here is one example of how audio can be piped to ecasound:
</p>

<blockquote>
<pre class="codepre">1. mpg123 -s sometune.mp3 | ecasound -i:stdin -o alsa</pre>
</blockquote>

<p>
The above sends the output of mpg123 to standard output ('-s' option 
of mpg123) and reads it from standard input with ecasound ('-i:stdin' option), 
and plays it out through the default ALSA PCM device. Similarly, 'stdout'
can be used to pipe data out from ecasound.
</p>

<hr />
<p>Back to <a href="index.html">index</a>.</p>
<hr />

<!-- ###  end ### -->

<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />

<p>
<!-- W3C-START: ###### -->
      <a href="http://validator.w3.org/check/referer">
	      <img src="http://www.w3.org/Icons/valid-xhtml10"
          alt="Valid XHTML 1.0!" align="right" border="0" height="31" width="88" /></a>
	  <a href="http://jigsaw.w3.org/css-validator/check/referer">
          <img style="border:0;width:88px;height:31px;" src="http://jigsaw.w3.org/css-validator/images/vcss" 
          alt="Valid CSS!" align="right"/></a>
<!-- W3C-END: ###### -->
</p>

</body>
</html>