You need a Synth_AMAN_PLAY-module to hear the output you are creating. So create a Synth_AMAN_PLAY-module by selecting Modules->Synthesis->SoundIO->Synth_AMAN_PLAY and clicking on the empty module space. Put it below the fifth line or so, because we'll add some stuff above.
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 OK to apply.
Select 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 OK and go to Step 2
Create a Synth_WAVE_SIN module (from Modules->Synthesis->Waveforms) 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.
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.
Create a Synth_FREQUENCY module (from Modules+Synthesis+Oscillation & Modulation) 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.
Select 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 OK and go to Step 3.
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.
Create a Synth_SEQUENCE object (from Modules->Synthesis->Midi & Sequencing). 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.
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).
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.
Synth_SEQUENCE really needs a sequence and the speed. Without that you'll perhaps get core dumps.
Select File->Execute Structure. You will hear a nice sequence playing. If you have enjoyed the feeling, click OK and go to Step 4.
Create a Synth_PSCALE module (from Modules->Synthesis->Envelopes). Disconnect the outvalue of the SIN wave by doubleclicking it and choosing not connected. Connect
Finally, set the PSCALE top to some value, for instance 0.1.
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.
Select File->Execute Structure. You will hear a nice sequence playing. If you have enjoyed the feeling, click OK and go to Step 5.
Start another aRts-builder
Put a Synth_AMAN_PLAY into it, configure it to a sane name. Put a Synth_BUS_DOWNLINK into it and:
Start executing the structure. As expected, you hear nothing, ... not yet.
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 the menu (or pressing the Del key).
Hit File+Execute structure. You will hear the sequence with scaled notes, transported over the bus.
If you want to find out why something like this can actually be useful, click OK (in the aRts-builder that is executing the Synth_SEQUENCE stuff, you can leave the other one running) and go to Step 6.
Choose File->Rename structure from the menu of the artsbuilder which contains the Synth_SEQUENCE stuff, and call it tutorial. Hit OK.
Start yet another aRts-builder and choose File->Load, and load the tutorial again.
Now you can select File->Execute structurein both aRts-builders 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.
Another thing that is good to do at this point in time is: start Noatun, and play some mp3. Start artscontrol. Go to View->View audio manager. 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.
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.
First of all, clean up on your desktop until you only have one aRts-builder with the sine wave structure running (not executing). Then, three times go to Ports->Create IN audio signal, and three times to Ports->Create OUT audio signal. Place the ports somewhere.
Finally, go to Ports+Change positions and names and call the ports frequency, velocity, pressed, left, right, done.
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?
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)
That means the Synth_PSCALE object also must be replaced now. Plug in a Synth_ENVELOPE_ADSR instead (from Modules->Synthesis->Envelopes). Connect:
Set the parameters attack to 0.1, decay to 0.2, sustain to 0.7, release to 0.1.
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.
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.
Rename your structure to instrument_tutorial (from File->Rename structure. Then, save it using save as (the default name offered should be instrument_tutorial now).
Start artscontrol, and go to View->Midi Manager, and choose Add->aRts Synthesis Midi Output. Finally, you should be able to select your instrument (tutorial) here.
Open a terminal and type midisend. 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).
You now should be able to work with aRts. Here are a few tips what you could try to improve with your structures now:
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 frequenciesabove a certain frequency (try something like 1000 Hz, or even better two times the input frequency or input frequency+200Hz or something like that).
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).
If you have created something great, please consider providing it for the aRts web page. Or for inclusion into the next release.