Sophie

Sophie

distrib > Mandriva > 8.0 > i586 > media > main > by-pkgid > 6a3ae4e037535c68bd8a5fcce387b3cb > files > 672

kdemultimedia-2.1.1-5mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML
><HEAD
><TITLE
>Tutorial</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.61
"><LINK
REL="HOME"
TITLE="The aRts Handbook"
HREF="index.html"><LINK
REL="UP"
TITLE="aRts-builder"
HREF="artsbuilder.html"><LINK
REL="PREVIOUS"
TITLE="aRts-builder"
HREF="artsbuilder.html"><LINK
REL="NEXT"
TITLE="Examples"
HREF="artsbuilder-examples.html"><META
HTTP-EQUIV="Content-Style-Type"
CONTENT="text/css"><LINK
REL="stylesheet"
HREF="common/kde-common.css"
TYPE="text/css"><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=iso-8859-1"><META
HTTP-EQUIV="Content-Language"
CONTENT="en"><LINK
REL="stylesheet"
HREF="common/kde-localised.css"
TYPE="text/css"
TITLE="KDE-English"><LINK
REL="stylesheet"
HREF="common/kde-default.css"
TYPE="text/css"
TITLE="KDE-Default"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#AA0000"
VLINK="#AA0055"
ALINK="#AA0000"
STYLE="font-family: sans-serif;"
><DIV
CLASS="logoheader"
><A
HREF="http://www.kde.org/"
><IMG
SRC="common/logotp3.png"
BORDER="0"
ALT="The K Desktop Environment"
HEIGHT="62"
WIDTH="229"></A
></DIV
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The <SPAN
CLASS="APPLICATION"
>aRts</SPAN
> Handbook</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="artsbuilder.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 3. <SPAN
CLASS="APPLICATION"
>aRts-builder</SPAN
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="artsbuilder-examples.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="ARTSBUILDER-TUTORIAL"
>3.2. Tutorial</A
></H1
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="STEP-1"
>3.2.1. Step 1</A
></H2
><P
>Start artsbuilder.</P
><P
>You need a Synth_AMAN_PLAY-module to hear the output you
are creating. So create a Synth_AMAN_PLAY-module by selecting
<SPAN
CLASS="GUIMENU"
>Modules</SPAN
>-&gt;<SPAN
CLASS="GUISUBMENU"
>Synthesis</SPAN
>-&gt;<SPAN
CLASS="GUISUBMENU"
>SoundIO</SPAN
>-&gt;<SPAN
CLASS="GUISUBMENU"
>Synth_AMAN_PLAY</SPAN
>
and clicking on the empty module space. Put it below
the fifth line or so, because we'll add some stuff above.</P
><P
>The module will have a parameter "title" (leftmost port), and
"autoRestoreID" (besides the leftmost port) for finding it. To fill these
out, doubleclick on these ports, select constant value and type "tutorial" in
the edit box. Click okay to apply.</P
><P
>Hit File/Execute structure. You will hear absolutely nothing. The play
module needs some input yet... ;) If you have listened to the silence
for a while, click okay and go to Step 2</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="STEP-2"
>3.2.2. Step 2</A
></H2
><P
>Create a Synth_WAVE_SIN module (from
<SPAN
CLASS="GUIMENU"
>Modules</SPAN
>-&gt;<SPAN
CLASS="GUIMENUITEM"
>Synthesis</SPAN
>-&gt;<SPAN
CLASS="GUIMENUITEM"
>Waveforms</SPAN
>)
and put it above the Synth_AMAN_PLAY module. (Leave one line
space in between). As you see, it produces some output, but requires a "pos"
as input. First lets put the output to the speakers. Click on the "out" port
of the Synth_WAVE_SIN and then on the "left" port of
Synth_AMAN_PLAY. Voila, you have connected two modules.</P
><P
>All oscillators in aRts don't require a frequency as input, but a position
in the wave. The position should be between 0 and 1, which maps for a
standard Synth_WAVE_SIN object to the range 0..2*pi. To generate
oscillating values from a frequency, a Synth_FREQUENCY modules is used.</P
><P
>Create a Synth_FREQUENCY module (from
<SPAN
CLASS="GUIMENU"
>Modules</SPAN
>+<SPAN
CLASS="GUIMENU"
>Synthesis</SPAN
>+<SPAN
CLASS="GUIMENU"
>Oscillation &#38; Modulation</SPAN
>)
and connect it's "pos" output to the "pos" input of your
Synth_WAVE_SIN. Specify the frequency port of the FREQUENCY
generator as constant value 440.</P
><P
>Hit File/Execute structure. You will hear a sinus wave at 440 Hz on one
of your speakers. If you have listened to it for a while, click okay and go
to Step 3.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="STEP-3"
>3.2.3. Step 3</A
></H2
><P
>Ok, it would be nicer if you would hear the sin wave on both speakers.
Connect the right port of Synth_PLAY to the outvalue of the 
Synth_WAVE_SIN as well.</P
><P
>Create a Synth_SEQUENCE object (from
<SPAN
CLASS="GUIMENU"
>Modules</SPAN
>-&gt;<SPAN
CLASS="GUISUBMENU"
>Synthesis</SPAN
>-&gt;<SPAN
CLASS="GUISUBMENU"
>Midi &#38; Sequencing</SPAN
>).
It should be at the top of the screen. If you need more room you can move
the other modules by selecting them (to select multiple modules use Shift),
and dragging them around.</P
><P
>Now connect the frequency output of Synth_SEQUENCE to the
frequency input of the Synth_FREQUENCY module. Then specify the
sequence speed as constant value 0.13 (the speed is the leftmost port).</P
><P
>Now go to the rightmost port (sequence) of Synth_SEQUENCE and type in
as constant value A-3;C-4;E-4;C-4; this specifies a sequence. More to
that in the Module Reference.</P
><P
>Note: Synth_SEQUENCE really <I
CLASS="EMPHASIS"
>needs</I
> a sequence
and the speed. Without that you'll perhaps get core dumps.</P
><P
>Hit File/Execute structure. You will hear a nice sequence playing.
If you have enjoyed the feeling, click okay and go to Step 4.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="STEP-4"
>3.2.4. Step 4</A
></H2
><P
>Create a Synth_PSCALE module (from
<SPAN
CLASS="GUIMENU"
>Modules</SPAN
>-&gt;<SPAN
CLASS="GUISUBMENU"
>Synthesis</SPAN
>-&gt;<SPAN
CLASS="GUISUBMENU"
>Envelopes</SPAN
>). Disconnect the outvalue of the SIN wave by doubleclicking it
and choosing "not connected". Connect</P
><P
><UL
><LI
><P
>The SIN outvalue to the PSCALE invalue</P
></LI
><LI
><P
>The PSCALE outvalue to the AMAN_PLAY left</P
></LI
><LI
><P
>The PSCALE outvalue to the AMAN_PLAY right</P
></LI
><LI
><P
>The SEQUENCE pos to the PSCALE pos</P
></LI
></UL
></P
><P
>Finally, set the PSCALE top to some value, for instance 0.1.</P
><P
>How that works now: The Synth_SEQUENCE gives additional
information about the position of the note it is playing right now, while 0
means just started and 1 means finished. The Synth_PSCALE module will
scale the audio stream that is directed through it from a volume 0 (silent)
to 1 (original loudness) back to 0 (silent). According to the position. The
position where the peak should occur can be given as pos. 0.1 means that
after 10% of the note has been played, the volume has reached its
maximum, and starts decaying afterwards.</P
><P
>Hit File/Execute structure. You will hear the sequence with scaled notes.
If you have enjoyed the feeling, click okay and go to Step 5.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="STEP-5-STARTING-TO-BEAM-DATA-AROUND"
>3.2.5. Step 5: Starting to beam data around ;)</A
></H2
><P
>Start another artsbuilder</P
><P
>Put a Synth_AMAN_PLAY into it, configure it to a sane
name. Put a Synth_BUS_DOWNLINK into it and 
<UL
><LI
><P
>set Synth_BUS_DOWNLINK bus to audio (that is just a name, call it
fred if you like)</P
></LI
><LI
><P
>connect Synth_BUS_DOWNLINK left to Synth_AMAN_PLAY left</P
></LI
><LI
><P
>connect Synth_BUS_DOWNLINK right to Synth_AMAN_PLAY right</P
></LI
></UL
></P
><P
>Start executing the structure. As expected, you hear nothing, ... not yet</P
><P
>Go back to the structure with the Synth_WAVE_SIN stuff and
replace the Synth_AMAN_PLAY module by an
Synth_BUS_UPLINK, and configure the name to audio (or fred if
you like). Deleting modules works with selecting them and choosing edit/delete
from menu (or pressing the del key).</P
><P
>Hit <SPAN
CLASS="GUIMENU"
>File</SPAN
>+<SPAN
CLASS="GUILABEL"
>Execute structure</SPAN
>. You will hear the
sequence with scaled notes, transported over the bus.</P
><P
>If you want to find out why something like this can actually be useful,
click okay (in the artsbuilder that is executing the Synth_SEQUENCE
stuff, you can leave the other one running) and go to Step 6.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="STEP-6-BEAMING-FOR-ADVANCED-USERS"
>3.2.6. Step 6: Beaming for advanced users</A
></H2
><P
>Choose File/Rename structure from the menu of the artsbuilder which
contains the Synth_SEQUENCE stuff, and call it tutorial. Hit okay.</P
><P
>Choose File/Save</P
><P
>Start yet another artsbuilder and choose File/Load, and load the
tutorial again.</P
><P
>Now you can hit File/Execute structure in both artsbuilders having that
structure. You'll now hear two times the same thing. Depending on the time
when you start it it will sound more or less nice.</P
><P
>Another thing that is good to do at this point in time is: start noatun,
and play some mp3. Start artscontrol. Go to <SPAN
CLASS="GUIMENU"
>View</SPAN
>-&gt;<SPAN
CLASS="GUIMENUITEM"
>View audio manager</SPAN
>. What you will see
is noatun and your "tutorial" playback structure playing something. The nice
thing you can do is this: doubleclick on noatun. You'll now get a list of
destinations. And see? You can assign noatun to send it's output via the audio
bus your tutorial playback structure provides.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="STEP-7-MIDI-SYNTHESIS"
>3.2.7. Step 7: Midi synthesis</A
></H2
><P
>Finally, now you should be able to turn your sin wave into an real
instrument. This only makes sense if you have something handy that
could send midi events to arts. I'll describe here how you can use
some external keyboard, but a midibus aware sequence like Brahms
will work as well.</P
><P
>First of all, clean up on your desktop until you only have one
artsbuilder with the sine wave structure running (not executing).
Then, three times go to <SPAN
CLASS="GUIMENU"
>Ports</SPAN
>-&gt;<SPAN
CLASS="GUISUBMENU"
>Create IN audio signal</SPAN
>, and three
times to <SPAN
CLASS="GUIMENU"
>Ports</SPAN
>-&gt;<SPAN
CLASS="GUISUBMENU"
>Create OUT audio signal</SPAN
>. Place the
ports somewhere.</P
><P
>Finally, go to <SPAN
CLASS="GUIMENU"
>Ports</SPAN
>+<SPAN
CLASS="GUILABEL"
>Change positions and names</SPAN
> and call
the ports frequency, velocity, pressed, left, right, done.</P
><P
>Finally, you can delete the Synth_SEQUENCE module, and rather connect
connect the frequency input port of the structure to the Synth_FREQUENCY
frequency port. Hm. But what do do about pos?</P
><P
>We don't have this, because with no algorithm in the world, you can
predict when the user will release the note he just pressed on the midi
keyboard. So we rather have a pressed parameter instead that just indicates
wether the user still holds down the key. (pressed = 1: key still hold down,
pressed = 0: key released)</P
><P
>That means the Synth_PSCALE object also must be replaced now. Plug in a Synth_ENVELOPE_ADSR instead (from
<SPAN
CLASS="GUIMENU"
>Modules</SPAN
>-&gt;<SPAN
CLASS="GUISUBMENU"
>Synthesis</SPAN
>-&gt;<SPAN
CLASS="GUISUBMENU"
>Envelopes</SPAN
>).
Connect
<UL
><LI
><P
>The pressed structure input to the ADSR active</P
></LI
><LI
><P
>The SIN outvalue to the ADSR invalue</P
></LI
><LI
><P
>The ADSR outvalue to the left structure output</P
></LI
><LI
><P
>The ADSR outvalue to the right structure output</P
></LI
></UL
>

Set the parameters attack to 0.1, decay to 0.2, sustain to 0.7, release to 0.1.</P
><P
>Another thing we need to think of is that the instrument structure somehow
should know when it is ready playing and then be cleaned up, because otherwise
it would be never stopped even if the note has been released. Fortunately,
the ADSR envelope knows when the will be nothing to hear anymore, since it
anyway scales the signal to zero at some point after the note has been
released.</P
><P
>This is indicated by setting the done output to 1. So connect this to
the done output of the structure. The structure will be removed as soon as
done goes up to 1.</P
><P
>Rename your structure to instrument_tutorial (from <SPAN
CLASS="GUIMENU"
>File</SPAN
>-&gt;<SPAN
CLASS="GUIMENUITEM"
>Rename structure</SPAN
>. Then,
save it using save as (the default name offered should be instrument_tutorial
now).</P
><P
>Start artscontrol, and go to <SPAN
CLASS="GUIMENU"
>View</SPAN
>-&gt;<SPAN
CLASS="GUIMENUITEM"
>Midi Manager</SPAN
>, and choose <SPAN
CLASS="GUIMENU"
>Add</SPAN
>-&gt;<SPAN
CLASS="GUIMENUITEM"
>aRts Synthesis Midi Output</SPAN
>.
Finally, you should be able to select your instrument (tutorial) here.</P
><P
>Open a terminal and type <TT
CLASS="LITERAL"
>midisend</TT
>. You'll
see that midisend and the instrument are listed now in the aRts midi manager.
After selecting both and hitting connect, we're finally done. Take your
keyboard and start playing (of course it should be connected to your computer).</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="SUGGESTIONS"
>3.2.8. Suggestions</A
></H2
><P
>You now should be able to work with arts. Here are a few tips what you could
try to improve with your structures now:
<UL
><LI
><P
>Try using other things than a SIN wave. When you plug in a TRI wave,
you will most likely think the sound is not too nice. But try appending
a SHELVE_CUTOFF filter right after the TRI wave to cut the frequencies
above a certain frequency (try something like 1000 Hz, or even better
two times the input frequency or input frequency+200Hz or something like
that).</P
></LI
><LI
><P
>Try using more than one oscillator. Synth_XFADE can be used to cross
fade (mix) two signals, Synth_ADD to add them.</P
></LI
><LI
><P
>Try setting the frequencies of the oscillators to not exactly the
same value, that gives nice oscillations.</P
></LI
><LI
><P
>Experiment with more than one envelope.</P
></LI
><LI
><P
>Try synthesizing instruments with different output left and right.</P
></LI
><LI
><P
>Try postprocessing the signal after it comes out the bus downlink.
You could for instance mix a delayed version of the signal to the
original to get an echo effect.</P
></LI
><LI
><P
>Try using the velocity setting (its the strength with which the note
has been pressed, you could also say volume). The special effect is always
when this not only modifies the volume of the resulting signal, but as
well the sound of the instrument (for instance the cutoff frequency).</P
></LI
><LI
><P
>...</P
></LI
></UL
></P
><P
>If you have created something great, please consider providing it
for the aRts web page. Or for inclusion into the next release.</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="artsbuilder.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="artsbuilder-examples.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><SPAN
CLASS="APPLICATION"
>aRts-builder</SPAN
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="artsbuilder.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Examples</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>