PureData Programming. Part 1
A little bit of additions and terminology
In the previous article, we met with basic mathematical operators and refreshed the principles of digital sound organization in our memory. I also pointed out that the essence of connections in PureData is the transmission of messages, signals and pulses. It is worth clarifying one point: in fact, momentum is a special case of communication. The transfer of momentum means the transfer of a unit, to be sure, connect [bang] and numberBox and see what happens. According to generally accepted terminology used in the literature and reference on libraries, numerical messages are called scalars , and signals are called vectors .
Perhaps I will also stick to it. Let's get started.
Signals and Signal Objects
Signals are data intended for output to audio devices. As you might guess, signal objects are tools for generating and processing signals.
In PureData, signal objects are defined by the postfix [~], for example, [osc ~], [phazor ~], [+ ~]. Also in the code, the inputs and outputs that receive and send signals, and the corresponding connections are highlighted. The signal output cannot be connected to scalars and, with rare exceptions, vice versa. Let's get to know these objects better.
The simplest synthesizer and the first GUI
An object that is very often used in patches, and without which not a single generator can do - [osc ~] . At the left input, it takes on a frequency value. Despite the fact that it is highlighted, it is quite possible to pass a number here. However, now we will not hear sound, for this you need to send a signal to the sound card. The output is set by the [dac ~] object . Make the sound quieter because it will be loud enough. Left input - left channel, right, respectively - right. We got the simplest synthesizer.
Now fasten simple math here. First, we attach the volume control. Based on the formula y = A * sin (x), we can conclude that amplitude changes can be achieved using the multiplication operation. To do this, just multiply the signal by a certain number. To do this, use the object [* ~] . All arithmetic operations for waves can be obtained by adding the postfix "~" to the symbol of the scalar operator . Now connect the oscillator to the multiplication object and add numberBox, restricting it to the interval [0, 1], this can be done through the properties. Send the result of multiplication to the output and block the patch. And, holding the shift, drag the mouse into the numberBox'e.
It works, but uncomfortable. Therefore, we will find an alternative.
Create the objects [vslider] and [knob]. Beauty? Beauty. Having a fader and potentiometer is much more practical than a box of numbers. We restrict them through the “properties” in [0, 1]. And try to connect instead of nuberBox'a first one object, then another.
As you can see, there is no big difference, and what to use depends only on your taste and desire.
In the next lesson, we will focus on additive synthesis and manipulate envelopes.