|
|
Hi,
I finished a betaversion of my first usable Usine add-on: "AoN Random"
Please check it out and let me know what you think - most of you know a lot more about Usine, so feel free to suggest whatever you think is missing.
This is the interface:
Initial Beta Documentation:
AoN Random is an add-on to create pseudo-random sequences of control events with a lot of control over the result.
Pseudo random because it will create the same sequence for the same input numbers, which is often preferable over real randomness, since you can repeat a certain sequence.
It is based on some shaders I do for 3D-graphics, but I hope you will find it helpful for audio as well - I tried to adapt the underlying concept to be useful in this area.
Let's look at the controls:
Input:
Here you plug in the values that the noise is based upon - without this, nothing will happen.
Usually you will use some kind of timing information, in my tests I mostly used a MasterSync nodes "tot ppq" output which I multiplied to get a fitting range (Edit: in the latest version you can use the scale parameter for this). I highly recommend using an oscilloscope on the Output to visualize what's going on.
I decided to not build in timing tools inside of the node for now to not waste time on things already covered in Usine and because instead of time, you can also plug in the output of a sequencer, a LFO or any other generator that produces continuous streams of data. Just make sure the values span a large enough range (or multiply it with "Scale") since AoN Random in essence creates a random value per 1 unit of input, so a 0-1 input will not do much, a 0-10 or 0-100 input will be more interesting.
NEW
Random Seed:
This was first introduced in AoN_Random_Array, but I liked the feature and decided to integrate it in AoN_Random as well.
For each integer value of Random Seed, a completely different internal table of random values is created (9973 of them in fact).
So even for pretty long loops, you shouldn't need to change this in a performance. Still it can be convenient to change the value to instantly get a different sequence of values for instance, if you don't use time, but a sequencer as input and you want to try out different patterns for a fixed range of input values (for an alternative, see the Offset parameter below).
Since the internal sequence is generated based on this value only, you should get exactly the same results (for repeatability) when using the same settings.
The creation of the random number sequence can take a bit of CPU, so you shouldn't drive this at audio or even control rate. And you may never have to change it at all if you are happy with the other controls possibilities.
If performance is a concern, try changing the area you see with Offset instead.
- Random Seed changes the underlying noise values completely, so no smooth interpolation is possible. If you need that, I'd recommend fading between two AoN Random nodes with different Random Seeds and only change Random Seed when the influence of one of them is at zero (so the jump can't be heard).
NEW
Scale:
This parameter was also first part of AoN Random Array, but I think it makes working with AoN Random easier as well, so here it is.
A value of 1.0 (the default) will use your input values directly, smaller values will give you a zoomed in view on the noise where details are more stretched out, while larger values at one point will give you something that looks more like typical randomness, since you can no longer see the interpolation.
You could also say, that smaller values "slow down" the noise and larger Scale values speed it up (if you feed in time that is).
Offset:
This is basically a convenience input: It's value is added to the Input value on every level of the noise.
I realized in the meantime that it isn't really necessary, since Usine adds values automagically if you have several connections to the same input, but it's still convenient if you only want to have a static Offset to see a different noise area.
The idea is, that for instance you have a Master Sync node feeding into the main Input, and then something else to distort the very even flow plugged into Offset, like a LFO or another AoN Random node. This allows you to easily break up the initially relatively regular distance between the random values, giving you a more random feel.
See the included AoN Random Example.wkp for a - well - example :-)
Offset has no impact on performance.
Another, more basic use is, to use Offset as a way to have several noises fed by the same input but still have every one generate a different sequence, simply be offsetting each node by some (not too small: 0 - 9973 is the range that makes sense) number.
Octaves:
If set to 1, only a basic sequence of random numbers wil be created, basically one for each 1 unit of input. If set to 2, a second layer of randomness will be added, at half the intensity and half the size (this is the reason to call it "Octave"). This results it pseudo-fractal detail.
A very basic output of AoN Random with 1 Octave (Fade set to 0):
And with 3 Octaves:
This is not exactly the same area from the noise, so the features are not identical, but you can clearly see how the two additional octaves add "local" detail to the larger blocks of the first octave.
I've limited Octaves to 16, since IMO it makes not too much sense to go higher - if you should find this being a limitation for your use, please let me know.
The reason why I limited it is, that for each octave, the algorithm is recalculated, so for 16 octaves you have basically 16 times the CPU load. So only use as many octaves as you really need, otherwise you waste resources.
In most implementations, octaves are integers. But I always found this limiting and the sudden changes unwelcome in graphics as it would be in audio. Therefore, in AoN Random you have a floating point value to dial in octaves and they fade in and out smoothly. This also makes it possible to control the amount of detail in the noise with other controllers.
Noise Min & Noise Max:
Internally with one octave, the noise is always normalized into a range between -1 and 1. Now when you use more octaves, it is possible that some parts go out of this range and are therefore cut-off. With Noise Min and Noise Max you can open this range up a bit to get the full spectrum of the noise created.
But sure you can also use it as a creative tool: For instance, if you set Noise Min to 0.0, the lower part of the noise will be cut off completely leaving only some islands where you get parameter changes. If you would set Noise Min to 0.5, it would be even more extreme and only very sparsely you would get output. This is great if you want an every-now-and-then stutter rather than a continuous noise.
Here is an example of a noise similar to the 3 octave setting above, but Noise Min set to 0.0 to cut off everything below (the oscilloscope was adjusted as well to reflect the change):
So while this isn't the most important parameter, sometimes it will come in handy.
It has no influence on performance
Fade:
Now to the fun part :-)
Fade is a control that allows you to interpolate between the random numbers.
At a value of 0.0, no interpolation takes place, you get a "Sample and Hold", hard stepped result like in the examples above.
For values higher than zero, you get a slope between the steps.
If you set Fade to 0.5, you get 50% slope and 50% plateau, Fade at 1.0 will give you slopes only, which will produce linear ramps with no plateaus at all.
This first example shows AoN Random with 1 octave and a Fade-value of 0.5:
Then I turn Fade up to 1.0 - which results in "nothing but interpolation":
Finally, I turn Octaves to 3, now I get interpolated, detailed noise:
Fade should have a very very tiny impact on performance.
Noise Bias & Noise Gain:
Now this is all fine and dandy, but sometimes you may not want linear interpolation.
This is what Bias and Gain are for.
Maybe it's important to say, that this isn't exactly what the words Bias and Gain are used for in Audio usually, but in graphics this is a rather common use and I took the words from there.
So what is it?
Bias will move the values of the slope in a curved fashion more to the upper or to the lower end (so it only has a function if Slope is > 0).
Important to remember is, that the neutral value here (as for Gain) is 0.5!
At a value of 0.5, nothing will happen, like in all the above examples.
Below 0.5, the slope will be bent towards lower values, above 0.5 it will bend towards higher values - in essence forming shark-fin like curves.
A one-octave noise with Noise Bias at 0.15:
And the other way around, Noise Bias at 0.85:
Noise Gain is like two Noise Bias split in the middle and one inverted, creating mirror-like roundings at the bottom and top at the same time.
Again, the neutral value is 0.5. Below that, the slope will be rounded off at the bottom and the top outwards, giving you a rather smoothly interpolated result, especially at rather low values like in the following example:
Noise Bias back at 0.5 and Noise Gain at 0.05:
Now with values above 0.5, Noise Gain creates the opposite, a kind of inward-bent s-curve where you get an almost-plateau between the main noise values.
Here I used again Noise Bias at 0.5 and Noise Gain at 0.95:
All these values, Fade, Bias, Gain etc. can be mixed to create a broad variety of results, here I have 3 octaves, Fade at 0.5 and Bias and Gain at 0.05. I made the oscilloscope draw faster and the window wider so you can hopefully see the finer detail:
Bias and Gain are very light to calculate, so not much of an impact.
Output Min & Output Max:
We're mostly done now, but these two controls allow you to adapt the output to your needs conveniently.
They spread the internal values to a range of your choosing. So if you need control values between 0 and 1, you would set Output Min to 0.0 and Output Max to 1.0. For a range of -48 to 66, Output Min would be -48 and Output Max 66.
I guess you get the drift ;-)
Basically this spares you some extra nodes.
A nice use of these Min and Max values is, to connect their outputs with the min and max inputs of an oscillator or step module to automagically set the range to the same values as the AoN Random output.
See the latest examples for examples 
Min and Max has no impact on performance.
Okay, that's basically it.
You can download the updated add-ons below with some also updated basic examples.
Older projects you did may need you to adjust the outputs, since I added parameters.
I would recommend to extract them to your user folder keeping the AoN_Usine folder intact, so you can easily find the add-ons.
Updated 6.2.2011
http://www.screendream.de/AoN_Usine/AoN_Usine.7z
If you don't have 7zip, it's about time to get it ;-)
http://www.7-zip.org/
Cheers,
Thomas
Last edited by Thomas Helzle (2011-02-06 15:27:32)
Offline
Obsolete - the examples are now included in the main download above...
Last edited by Thomas Helzle (2011-02-04 22:01:47)
Offline
Hi,
i just tried it with an lfo module modified by your module and then redirected on the start and end loop of the sampler
Just great !
many others things to do with it!
Offline
yes !
it's an inspiring tool Thomas !
thanks a lot to share
Offline
Hello Thomas,
After quick tests.
First congratulation for the approach of your data generator. This is a real new approach of reaction of the data generated.
A way for build new hight level interface with one samples... certainly.
Your workspace propose a very large "loop" or endless variations.
Very nice !!
Offline
this module is great and can be very useful for many applications in usine. the data creates some very nice "terrains" which can definitely be applied to audio. nice work. I have queued the data stream into an array which provides a very nice way to store sequences and modulation data (and possible waveforms for oscillators?) which brings me to a suggestion which may be useful for this purpose. how about a button which triggers the generation of x amount of array elements worth of data and output the result as an array? anyway very nice work here. thanks for this module.
Offline
Thanks to share thomas!
Great tool for randomness.
And you've nearly done all the description for the wiki...Tell me when it should be created, i can do it if you want.
Offline
Thanks for the nice replies guys! 
Great you find it inspiring!
multiphone: The internal "loop" is 9973 entries long before it repeats, should be good for quite long usage and could basically be extended to whatever number is needed if somebody thinks it's not enough. This specific algorithm uses a static sequence of random numbers for speed reasons. (no longer true for the latest update, now the sequence is generated at runtime from your Random Seed value! So you can generate endless variations of different Sequences)
This is also why there is the Offset parameter: if you don't like a certain part of the sequence, just put in some larger offset (0.0 to 9973) to get to another area in the sequence. So it can be used like the random seed parameter in other implementations.
(because of the update, there's a Random Seed value now as well, but changing Random Seed takes CPU where Offset does not).
soundmind: I so far haven't understood the significance of arrays in Usine - the topic came up before. Could you point me to some examples where arrays are used in a way that shows their significance or explain what's special about them?
I am open to extend AoN Random but I would need to understand the "why" and "what" ;-)
ethnix73: Let it cook a bit longer before entering it in the wiki, but thanks for your offer!
Otherwise:
- Has anybody some questions that I didn't answer in the Prelimnary Docs?
- Is there anything important missing or are there things you think are not done in the "Usine" way?
- Would it be useful to have the inputs also as outputs. Some modules seem to replicate almost every input as an output, others don't and I'm too new to Usine to know where it would make sense. What would you suggest?
And maybe another note: this is the first of my modules I found fit for release as a beta since it was useful already. Some of my others need more cooking (for instance the fractal noise node I showed in the beginning of this thread). The audio generator is working, but so far the result wasn't that interesting. Since I never did that before, I need to learn a lot more :-)
Cheers and keep that feedback coming!
I also would love to hear the results if you do something interesting with it.
Further example patches or workspaces of how you use it are also very welcome - both for me and the community!
Thomas
Last edited by Thomas Helzle (2011-02-04 21:59:28)
Offline
Thomas Helzle wrote:
Could you point me to some examples where arrays are used in a way that shows their significance or explain what's special about them?
Well all of usines internal step sequencers are just arrays at their core. The possibilities are endless. for example, having an instant array of data from your module would allow to "store" data streams for later use. and once they are in the form of an array many other manipulations can be done because usine allows you to process entire arrays at once in various ways. currently the only way to store your modules data is to use a queue data in array module to "record" the stream. Finally, arrays can be used for anything from sequencing midi notes to modulating parameters. Hope this helps. thanks.
Offline
This looks great! 
Thanks!
Offline
Thanks bsork :-)
soundmind wrote:
Thomas Helzle wrote:
Could you point me to some examples where arrays are used in a way that shows their significance or explain what's special about them?
Well all of usines internal step sequencers are just arrays at their core. The possibilities are endless. for example, having an instant array of data from your module would allow to "store" data streams for later use. and once they are in the form of an array many other manipulations can be done because usine allows you to process entire arrays at once in various ways. currently the only way to store your modules data is to use a queue data in array module to "record" the stream. Finally, arrays can be used for anything from sequencing midi notes to modulating parameters. Hope this helps. thanks.
What size of arrays are we talking about? More like the 16 step standard sequencer or more something like 5000 values in a large array?
BTW: If you feed my node with a fixed sequence of input values, you will get out a fixed (= repeatable) sequence of random values, so you may not need to save the sequence somewhere?
Maybe what you are asking for is better done by a different node altogether?
Since it would create one-shot sequences of randomness in the form of an array with selectable size, right? So it wouldn't need a time input, but the sequence could be defined by a Random Seed parameter instead. And while it could use the algorithm I use for AoN Random, maybe there are better solutions for this...
A topic I haven't looked into yet is the creation of midi data. This is definitely something I would like to do, but I have to look into some of the script examples to see how this works in Usine. I only created some midi stuff in Processing so far with the help of some high-level libraries where I didn't have to deal with the details of midi.
Hm - I have to think more about this 
Cheers! And thanks for the feedback!
Thomas
Offline
I played some more with AoN Random and tried to use it for midi generation.
In this example Workspace I determine the played pitch and the volume with AoN Random, while the note itself is played by a simple sequencer line:
Included in the main download now:
Updated 4.2.2011
http://www.screendream.de/AoN_Usine/AoN_Usine.7z
This is an area where the octaves of AoN Random are helpful, since the sequence isn't randomly jumping around like normal "randomness", but rather you get major pitch changes from the first octave while the higher octaves "play around" that main pitch, so it sounds much more natural.
I used a Wusik Station Piano for this, but if you don't have that, just use any piano or keysound you like instead.
(BTW. Wusik extended their group buy again if you should be interested: http://www.wusik.com/ww/purchase - this is one massive package for little money...)
Cheers,
Thomas
Last edited by Thomas Helzle (2011-02-04 22:00:49)
Offline
cool back home , gonna test the last one!!. very exicted, looks sooooo cool
thanx so much thomas!
soundmind suggested the same i spoke about earlier.
in usine arrays have lot of application. ie all lines,step,points curve modules in /data can be fed by arrays, blocs of datas.
they are manly used as automations loopers.
your module seems the perfect tool to feed them, but instead of having to queue data in array (equivalent of the oscilloscope),
having a static array generation of size X (i would say from 1 to 4096 to limit cpu) that would be instantaneous could be very handy, with lot's of possibilities for usine.
i think about the same thing as soundmind : using your module to generate some cool automations arrays for
those modules, then we can eventually adapt them and store/recall them later using usine tools.(preset manager)
so could be great to generate via a new red array out node of specified size if not too complex, that would really kill.
im not sure but if you generate a big sequence internally of ie 40000 elt, the thing could be to extract ie 256 eltm(chosen size), from index (chosen offset) then it's quite modular for users to scrub a part (kind of seed), keeping your same pins with an extra size setting. to make it simpler, but you probably understood already, get the exact same thing as the oscilloscope screenshots, but as instant array generated by a button press, not each bloc, in addition to the current
(great but different use) single data over time out .
anyway, gonna rest the beast know, looks sooo coool!!
Last edited by 23fx23 (2011-01-30 01:30:07)
Offline
23fx23: thanks for your feedback.
This sounds indeed interesting and I'm willing to implement it, but I still wonder if it wouldn't be better to have a separate specific node for it?
My idea would be as follows, please correct me if this isn't what you would like:
AoN Random Array
The node is similar to AoN Random, but instead of an input, you would have a "Random Seed" value. For each integer Random Seed Value, you would get the exact same sequence, so that we still get the predictability/repeatability aspect and so that you are able to "store" the RS value when you get something you like.
The Output would consist of an array of optionally integers or floats (or both at the same time - shouldn't be too complex for a one-shot node that doesn't run continually).
Any other format?
And since you can't have external control over the speed, a "Scale" value could be provided that enables you to adapt the span of the sequence - like a "zoom" into the sequence.
What maximum Array size would you suggest? I guess something like 1024 would be sufficient? Or do you see a need for larger arrays?
I have to see how fast this is, if it's fast enough, each parameter change could trigger an automatic refresh - if it's too slow, it could be triggered by a button.
What's the best way to visualize arrays similar to what the oscilloscope does with a sequence?
Cheers,
Thomas
Offline
this sounds perfect. good thing for the 'static seed'. yeah for size1024 is probably enough in most cases. if it's easier as separate module (sorry i first thought node=pin)
then yeah that make sense, we are not supposed to use booth function togeteher and they will be optimized accored to their refresh. i thouht it was easier for you to use same module for maintenance, but you are more aware of the best way to do,
, in any cases it will be great and i will be happy:)
you can use simple 'array display or set' in /array to visualise or a step/line/ in /data. all have min/max to set according to the range. if they are feed by input they auto display and take the size of input.
keep's the great works, im tripping from 2h on the module it's awesome, great and clever features! love it!!!
Offline
Hello Thomas,
Thank you for your reply. I'm a little busy right now with an ongoing project, so sorry the delay of my reaction.
I wanted to first test the subject alone. I had the same idea about the inputs and outputs "Array ". Generation by a mode button is a good idea, but also a global speed factor are welcome because it's really interesting to reduce the flow of information outputs. The size of "Array out" of 1024 seems correct to me.
Offline
thomas,
thanks for taking interest in the suggestion. It will open up many new possibilities. I also think 1024 is sufficient. As far as making a new separate module, i say whatever is easiest for you. good luck and thanks for this great project.
Offline
i played with it all the night, very trippy.
Offline
Hi Guys,
It WORKS 

That was quite an interesting journey today. 
I have to do more tests, since I implemented some new stuff that needs some beating to find out if it's stable, but otherwise my idea worked nicely.
Some questions came up:
- I implemented the "Calculate Array" button with a callback (my first one
) is it normal that the calculation is only done when Usines Audio engine is running ("On")? Or do I have to do something different to also calculate the values with the engine Off?
- What is the best callback mode to use? ctAsynchronous, ctNormal or ctImmediate? The calculation creates a short CPU spike that would be good to not interfere with Audio - would Normal or Asynchronous be the better choice? What do you think?
Good news:
- Calculation is very fast, so ATM I have a limit to the arraysize of 2048 values.
- The idea with the Random Seed worked great, I think I will implement that in AoN Random as well instead of the fixed array I used before (old habit from the graphics world
). You can literally create billions of repeatable sequences now :-)
Now I need to find some cool uses for the arrays for testing 
Cheers and thanks for your inspiration!
Thomas
Last edited by Thomas Helzle (2011-02-04 22:03:40)
Offline
woa awesome, and fast!
not expert on sdk, maybe martin or senso could answer you about the callback speed..think it's related to scanning time/latency of changes input, but they are not the same than in scripts..dk
can't wait to play with the final release!
Offline
IMHO Usine is designed for live use so it is essential that modules can be manipulated in realtime without causing glitches. ctImmediate is the best choice wherever possible as there is then minimal latency between the callback and the resulting parameter change. However, the callback occurs in the audio thread so if your CPU spike is going to be high enough to cause audio glitches then I would play safe and go with ctNormal. I would rather parameter change latency than audio glitch.
Offline
23fx23, caco - thanks for the feedback.
Yeah, I guess we have to do a betatest and you guys tell me if the load is too much and causes problems.
On my 8 core 2008 MacPro with Windows 7 Pro 64 it's okay, but I'm not sure about live performance on a laptop.
ATM I changed the node to react in realtime to changes of parameters (which looks amazing, since you can see the array update while you drag sliders - very intuitive
) Maybe I should make that optional, so you can either have realtime updates or update only when you press the Calculate Array Button.
I guess that's the best solution anyway since it allows you to control precisely, when to update and take "snapshots".
The one thing that takes the most CPU is changing the random seed, the calculation of the array itself is pretty fast.
One more question regarding that:
Is it preferable performance wise to fill in a separate internal array and then copy that to the output or is it fine to use SetEvtArrayData in my noise-generating loop to write each value separately? Is there a lot of overhead?
I'll do those changes and test some more before I'll upload the new add-on.
Cheers!
Thomas
Offline
A new beta release is up:
Updated 6.2.2011
>>>>> AoN Usine <<<<< (why does the forum convert the Link name to small letters?)
This contains both "AoN Random" and "AoN Random Array" for your testing pleasure as well as some examples 
Documentation:
AoN Random Array is very similar to AoN Random, but its output is a static array of values, not a continuous stream of control data.
I will only talk about the new stuff here, please check out the docs for AoN Random above for the other controls.
As you can see, all the inputs are outputs now as well so you can easily use whatever you feed in further down the node tree.
Not sure what the "best practice" is here, but since it should not cost CPU cycles, I'm inclined to make all inputs available as outputs as well.
Mode & Calculate Array:
The Mode dropdown allows you to select if you want automatic, instantaneous updates if you change a value or only want updates to occur if you click on the "Calculate Array" button (or trigger the input, for instance with a clock).
For learning the ways of the node, I recommend the Automatic Mode, since it is very cool to directly see what the values do. If you find the recalculations too CPU hungry, use the Update on Click Mode. The later can also be used to create specific snapshots at certain times. It shouldn't use any CPU at all until clicking the button.
The button has no real function when the Automatic mode is used.
Random Seed:
see AoN Random.
Scale:
Since you can't change the timing you feed into AoN Random Array, I included this control to allow you to scale the output to your needs over the span of the Array. Start with something like 0.1, smaller values will give you a "zoomed in" view on the noise where details are more stretched out while larger values "zoom out" and at one point will give you something that looks more like typical randomness, since you can no longer see the interpolation.
This is a noise with Scale 0.08:
The same noise with Scale 0.35:
And the same again with Scale 1.0:
So a larger value here means, that you can "see more" of the noise = zoom out.
The following values are the same as with AoN Random, so the next new one is:
Array Size:
Well, I guess this is self explanatory: this is how many values you have in your array 
An array with 16 entries:
And an array with 128 entries:
Float Out & Integer Out:
For your convenience, I have two outputs where both export the same noise sequence, one as Float Array and one as rounded Integer Array. The first is good for parameter control, the second is best for something like midi.
I think that should be it - please let me know if you have any questions or suggestions!
And again: This is Beta Software, so anything may change, don't rely on it yet for serious use without thorough testing!
Please report any bugs you encounter!
Cheers,
Thomas
Last edited by Thomas Helzle (2011-02-06 15:29:17)
Offline
Hello Thomas,
Thanks for the "Array out"and all these changes. I'd like to test it but the link you indicate that asks for a password what to do?
Thanks in advance
Offline