<< Chapter < Page | Chapter >> Page > |
PFont fonte;
/*The font have been previously createdin the data folder*/
fonte = loadFont("HoeflerText-Black-48.vlw");textFont(fonte, 12);
fill(10, 20, 250, 80);textAlign(RIGHT);
text("pippo pippo non lo sa", 10, 14, 35, 70);textFont(fonte, 24);
fill(200, 0, 0, 100);text("ppnls", 25, 5, 50, 90); |
Processing allows a tight control of the
spatial occupation of characters and of the distance betweencontiguous characters (see
[link] ). The function
textWidth()
computes the horizontal extension of a character or a
string. It can be used, together with the exact coordinatespassed to
text()
, to control the
kerning and
the
tracking between characters. The
textSize()
allows to
redefine the size of characters. The
textLeading()
re-defines the distance in pixels
between adjacent text lines. This distance is measured betweenthe
baselines of the strings of
characters. Letters such as "p" or "q" extend below thebaseline for a number of pixels that can be obtained with the
textDescent()
. Instead, the
textAscent()
gives back the maximum extension
above the baseline (typically, the height of the letter"d").
Untill version beta 112,
Processing gave the possibility to program several audiofunctionalities by means of some core primitives. In those older
versions only two basic primitives are available to playback andload
.wav
files. In more recent versions, Processing
delegate sound management and processing functionalities to
external
libraries . The most used libraries are
Ess ,
Sonia , and
Minim . Only
the latter is included in the base installation of Processing. Essand Sonia need an explicit installation process. Recently, a
well-structured and documented Java library called
Beads has also been
introduced. It is well suited to the construction ofaudio-processing algorithms based on chains of base objects.
As in the case of images, in order to process and playback sounds the source files have to be stored in the
data
folder of the current sketch.
The library
Sonia is the most complex one. With its functions, one can do
sample
playback , realtime Fourier-based spectral analysis,
.wav
file saving. In order to use the Sonia library,
the programmer has to download the
.zip
file from
Sonia . Once
decompressed, the directory
Sonia_?_?
has to be
copied into the directory
Processing/libraries
. Finally, the command
import
has to be inserted into the code by selecting
it from the menu item
Sketch / Import Library /
Sonia_?_?
.
In this section, we first use then analyze an application for theexploration of timbres, similar in conception to the Color Chooser of [link] , and here called Sound Chooser. For the moment, let us think about a sound timbre inanalogy with color in images. For example, the various instruments of the orchestra have different and characterizing timbres (colors). Later on, wewill define the physical and perceptual aspects of timbre more accurately. In the Sound Chooser applet, four sounds withdifferent timbres can be played by clicking onto one of the marked radii. Each radius corresponds to a musical instrument(timbre/color). By changing position along the radius it is possible to hear how the brightness is changed. Moreprecisely, as long as we proceed toward the centre, the sounds gets poorer.
Notification Switch
Would you like to follow the 'Media processing in processing' conversation and receive update notifications?