Hello fellow readers.
Somehow I had forgotten about the sound of the month for December (somehow I had forgotten about December at all). This is mainly the reason because I'm currently pretty busy working on a new flexible, efficient and stunningly-sounding DSP framework WAVE, comparable to MaxMSP (but without any GUI and with the aim to surpass wherever possible). I have already finished some basic modules like oscillators, vector operations, wavetable management, etc. Additionally, I programmed a granular synthesis object 'Granulator' where I improved some of my older algorithms. So here is the first sound example which you can download as usually in the downloads section.
The great thing is that you can easily use 120 or more voices in the GRANULATOR object without any significant increase in CPU rate. As mentioned above there is no GUI, so you can use conventional language-features. Here is the code that generated the sound you will find in the downloads section:
==================================================
Output out = new Output(2, 44100, devices.get(0));
Granulator gr = new Granulator("sounds/feuer1.wav", 10000.f, 120, 1,
Granulator.WINDOW_LANCZOS, false);
// set initial head options
for (int i = 0; i < gr.heads.length; i++) {
gr.heads[i].setDensity(100);
gr.heads[i].setLength(1);
gr.heads[i].setUseDelay(true);
gr.heads[i].setStereoPhaseDeviation(80);
gr.heads[i].setLengthDeviation(100);
gr.heads[i].setGrainRate(-1.9f);
gr.heads[i].setGrainRateDeviation(80);
gr.heads[i].setRate(1.0f);
gr.heads[i].setPosition(gr.getBufferSize() / 2 + 6 * i);
gr.heads[i].setMode(Granulator.MODE_RANDOM);
}
gr.leftOutput.connect(out.leftInlet);
gr.rightOutput.connect(out.rightInlet);
Scheduler.run();
==================================================
In the first line, we generate a new Output module. An output module serves as mediator between WAVE and the sound card. Be aware that unlike MaxMSP or PureData, WAVE can utilize different sound hardware at the same time. Then we create our Granulator object and simply name it 'gr' using the sample 'feuer.wav', a master gain of 10000, 120 (sic!) independent voices (aka 'heads' - following the image of a multi-head band reader), a ramp length of 1 ms, a Lanczos window (lookup in Wikipedia for windowing functions) and a boolean value that denotes the usage of random initial positions for each head (we don't use it here, because we will set initial position for each head explicitly). Then we use a common for-loop to set the parameters for each head:
density = 100% (with which probability is a grain used)
length = 1ms (overall grain length)
use_delays = true (using random delays)
stereo_phase_deviation = 80 (modulates the stereo phase randomly)
length_deviation = 100% (modulate the length to +/- 100% randomly)
grain_rate = -1.9 (this is a great new feature: you can play grains reverse whereas the head moves forward, or do it the other way: move the head in reverse direction and let the grain be played forward (what a friend of mine called the 'Memento'-mode - in comparison to the movie))
grain_rate_deviation = 80% (similar to other deviation values)
rate = 1.0 (simple forward playback at normal speed here)
additionally we set the initial positions with a distance of 6*i and set the mode of operation to random walk
Then we connect both output ports of the granulator to the input ports on our Output object and run the Scheduler.
That's all, no additional processing on the sound, except for some fading at the beginning and end.