We are writing a synthesizer for a concert. PureData Field Tests
It’s extremely interesting to build synthesizers on PD, however, indoor experiments and couch parsing of MIDI messages are still seriously different from the “combat” conditions in which you have to perform. And after a failed demo on LinuxFest, I was seriously worried about live performance solutions. Usually, some more or less functional midi controller (such that it uses at least two channels that can be heard separately) is enough, however, it is quite expensive and you have to compensate for the GUI of the synthesizer itself and rely on the mouse and keyboard.
About a month ago I was invited to play in a curious St. Petersburg group, to the post of "electronic engineer". My task is to play synthesizer parts and their potential writing. The group was actively touring and it was necessary to prepare the solution quickly, and after listening to their material and talking with the members of the collective, I proceeded to search for a solution.
Formulation of the problem
A remark anticipating the question “why?”. The synthesizer, of course, is extremely simple and software that can do the same functions - the sea. However, here a manual example shows the basic principles that it is important for a newcomer to PD to repeat. This applies to both generators and converters. This is a base with which you can and should work, and simplicity and dampness will allow you to quickly disassemble the elements and serve, if not a base, then good additions to your own patches. Copy and experiment on health!
It is necessary to assemble a synthesizer, the configuration of which can change quickly and to hot, and it should also be undemanding to controllers. And, of course, the ability to play “massive” games, with a wide band of frequencies. The inspiration was a small modular company Korg, whose model, alas, is unknown to me.
After digging around, I divided the task into parts: signal generators by shape (saw [phasor ~] , sine [osc ~] , square (not in the library) , triangle (also not in the library) ). Phase modulation module, ring modulator, overload, as well as “white” and “pink” noise generators ( [noise ~] and [pink ~], respectively) and filters for them (band [bp ~] , low [lop ~] and upper [hip ~] frequencies), and, of course, a kind of stack that sequentially sends the parameters entered into it at the specified speed to the output (it’s convenient to keep some kind of rehearsal part like bass or drums).
So, in principle, that’s all. It remains only to transfer this entire economy to PD and begin experiments.
To build backgrounds with markers in the GUI, we use the standard put-> canvas or Ctrl-Shift-C , I created such a separate one for each module and assembled it as a mosaic. And then we already place the above objects. I got this design:
Let's analyze separately:
It does not contain anything interesting. [adc ~] - input object from a microphone, line or other applications, in JACK it is displayed simply as an input. A sufficiently informative help about channels, etc., there is nothing to add. But then everything is much more interesting.
Sine wave generators and saws are already familiar to us, but the square and the triangle (here: square and triangle, respectively) had to be sculpted from what it was. The math is simple, high school graduation at best. To get a square from a saw, you can take two saws, sweep one of them (this is done by giving negative frequency values, that is, you need to change the sign at the initial frequency), phase shift by 0.5 (the phase shift is applied to the right input and has a range of values from 0 to 1, i.e., the shift is indicated along the ordinate). And now we are adding this unfolded and shifted wave with the first generator, which we did not touch. As a result, we get a superposition in the form of a square wave operating in the range from 0 to 2. Then we displace the wave so that it appears in the region [-1; 1]. That is, we subtract 1. As a result, we will have something like this:
With a triangle, the approach is the same. The train of thought can be restored by the code:
But in general...
Instead of subtracting a fixed number, you can derive a certain variable, moving the diffuser gives very interesting sounds and glitches, which can sometimes be used in the corresponding music. But in this synthesizer I did not use it, I will definitely include it in the new version.
So, with the generators sorted out. We will deal with the converters. According to the principles of the ring and phase, it is better to visit Wikipedia, here I’ll just give the code as it is, since everything is based more on the principle of work than on the mathematical basis:
Perhaps this is the case (and the only one, unfortunately) when the Russian-language information on PD is really useful.
This subpatch contains only a counter and the [sel] object whose task is to send bangs to the outputs when a certain counter value is reached. In the red rectangle (directly in the interface), note offsets are set using the knobs, the square button is the start, next to the number box the delay in ms is indicated (i.e. the duration of each section). It will not be difficult to convert this number into topics, I think you can deal with this yourself. Well, the number coming to the input is the original frequency. Here you can bring midi events and thus get an arpeggiator. In general, this is the arpeggiator.
I decided not to write a large number of effects, and decided to limit myself to only distortion (and let the delay block not bother you, in fact it is not a delay, because there was no laziness to write it)
The principle of distortion is just as simple, there is some kind of strict restriction on the strength of the signal, all that is higher is mercilessly cut. This is achieved using the object [clip <range in y>] and the operation of multiplying by a number, which amplifies the signal, taking it beyond the allowed limits. For overdrive (where the slices are curved) there is an object [overdrive ~] .
The field trials of the concert were quite successful, the only thing that depresses me is the need to work a lot with the mouse and constantly look at the monitor. Firstly, you don’t particularly shake your head, and secondly, you can’t see comrades who perform conducting functions (yes, it’s so serious). And, as a result, in one of the compositions I missed the moment of abrupt ending, and I remained for a second to buzz alone. Moreover, when it is necessary to control simultaneously the dynamics and parameters of the transducers, one mouse is not enough. Therefore, in future versions, I decided to sacrifice the flexibility of the executable parts and transfer the parameters to the synthesizer using the usb keyboard and gamepad with DirectInput. In the next series, wait: "the controller of what is at hand" or "how to save on electronic music"
Waiting for your questions in the comments.