Kyma Forum
  Tips & Techniques
  SR random walk

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   SR random walk
cristian_vogel
Member
posted 28 January 2013 15:10         Edit/Delete Message   Reply w/Quote
Any thoughts on an approach to building a Random Walk which updates at sample rate?


IP: Logged

SSC
Administrator
posted 28 January 2013 19:04         Edit/Delete Message   Reply w/Quote
Each new value of the random walk is its previous value plus a uniform random number, so something like this:

f(n) = f(n-1) + r

You can get this by feeding Noise(white) into a DelayWithFeedback with parameters set as:
Feedback: 1
Delay: 1 samp
Scale: !Deviation
DelayScale: 1
Interpolation; None

It will sound "low pass" because you are effectively "integrating" the white noise.

IP: Logged

cristian_vogel
Member
posted 29 January 2013 03:13         Edit/Delete Message   Reply w/Quote
Brownian noise. Great, thankyou!

[This message has been edited by cristian_vogel (edited 29 January 2013).]

IP: Logged

cristian_vogel
Member
posted 29 January 2013 09:04         Edit/Delete Message   Reply w/Quote

StochasticSynthesisXenOscSR.kym

 
Finally got a GENDYN implementation sounding about right! Nicolas Collins GENDYN for SuperCollider is for many the benchmark software model of Xenakis work. In his version, all the probability distributions are worked in from Xenakis' original specification. I havent done that, but in Kyma we can vary the interpolation, which makes a difference.

We are not sure if Xenakis was into the sound of the aliasing or limited by it. He certainly seemed to work with it.

Some fans of stochastic synthesis prefer this aliasing that inevtiably happens from such a noisy waveform - they tend to be noise music fans anyway...

96K sample rate will improve the aliasing situation. I also include a realtime resynthesis version , which at 96K has no aliasing, but unfortunately loses a lot of the sonic character.

Enjoy!


[This message has been edited by cristian_vogel (edited 29 January 2013).]

IP: Logged

jhinton
Member
posted 29 January 2013 10:49         Edit/Delete Message   Reply w/Quote
I think I understood about 3 words in your post. Do you have any background resources for the uninitiated? What is random walk?

IP: Logged

cristian_vogel
Member
posted 29 January 2013 11:03         Edit/Delete Message   Reply w/Quote
Sorry.

Its to do with the composer Iannis Xenakis. Take a look at the XenOsc in Kyma.

Some resources http://www.google.com/search?q=xenakis+stochastic+synthesis+collins

"XenOscillator

The waveform of the XenOscillator is determined by breakpoints that you supply in the XValues and YValues fields. Depending on the value of the Smoothing parameter, the waveform breakpoints are connected by stairsteps, straight lines, or smooth curves. The XValues and YValues fields are hot, so the waveform can change continuously as the oscillator is playing.

This oscillator was inspired by the chapter "New Proposals in Microsound Structure" in Iannis Xenakis' _Formalized Music: Thought and Mathematics in Compostion_ in which he proposes generating waveforms that are stochastic variations of sound pressure (for example, by using random number generators to continuously change the YValues of this Sound so that it never repeats exactly).
"

IP: Logged

SSC
Administrator
posted 29 January 2013 11:09         Edit/Delete Message   Reply w/Quote
A random walk is sometimes called a drunk walk. It's when you start at a point, take a random step in a random direction. Then from that point, take another step in another random direction.

In terms of numbers, you start with a number, then add a random amount to it (plus or minus) to take a random step.

IP: Logged

cristian_vogel
Member
posted 29 January 2013 11:25         Edit/Delete Message   Reply w/Quote
Yes. Its also called Brownian noise, related to Brownian motion.

By the way, I just updated the attachment in the post above with a newer version that seems to have fixed broken endpoints in the wave table, and also has a go at an 'n' breakpoint implementation using the replicator.


IP: Logged

jhinton
Member
posted 29 January 2013 12:49         Edit/Delete Message   Reply w/Quote
Very cool. Thanks so much for the explanation.

IP: Logged

cristian_vogel
Member
posted 30 January 2013 10:57         Edit/Delete Message   Reply w/Quote
@SSC: In my 'n' breakpoint version, I tried to feed the noise instances into SoundToGlobalControllers .. Is the broadcast EventValue lower than sample rate?

IP: Logged

SSC
Administrator
posted 30 January 2013 11:21         Edit/Delete Message   Reply w/Quote
EventValues change between samples at the control rate (not the sample rate).

IP: Logged

pete
Member
posted 30 January 2013 14:45         Edit/Delete Message   Reply w/Quote
Hi Cristian

To do what you want at sample rate it has to be done by knitting modules (not Capy talk). You need a single sample delay with feedback but the delay module won't do, as you need to get into the feedback path. A pair of feedback modules won't do it either because the delay will be more than one sample.

So you need to use a memory writer/reader pair. The MemoryWriter needs a capture duration of 1 samp, trigger of 1 and set to cyclic, and the reader can be a sample player with loop set, FromMemoryWriter ticked, and the sample name matching the RecordingName in the MemoryWriter.

Now you put your modules between the SamplePlayer and the MemoryWriter. Something like a mixer with an attenuated noise module also feeding the mixer. You may want to attenuate the mixer with a scale of 0.999 just to stop it from drifting into clipping. You can use a hot parameter but the value will have to be more than 0.99 and less than one, other wise you will just hear the noise as if it was on it's own.

You can then do more funky things in the middle, like adding a delay module with a 1 samp delay and multiplying and inverting, mixing and attenuating bit's of the signal path.

I hope this makes sense

Pete

IP: Logged

cristian_vogel
Member
posted 31 January 2013 07:40         Edit/Delete Message   Reply w/Quote
Now I'm a bit baffled. Maybe you could send a little example Pete?

What I am trying to do is update the breakpoints of a waveform using Random Walks at sample rate (the Brownian Noise).

Now I am not sure if a sound pasted into a parameter with no 'L' is being read at sample rate? If not, then I can't reach the precision I want to.

OSC has the same issues really. I have been making some very interesting Time Varying Noise sources using some Java libs for Processing, but sending arrays as streams over OSC at the rate of the program (which in Processing is anything from 1 ms to 25 fps) - means that updates and changes can be heard. Nevertheless interpolation on the Kyma side can really help smooth things out.

I recall a visit to CERN - one of the designers of the Atlas project told us they use sampling rates of 10GHZ and up!

IP: Logged

cristian_vogel
Member
posted 31 January 2013 09:53         Edit/Delete Message   Reply w/Quote
OK! I have it all working now. I can average and all sorts within the feedback loop, as you said above. Much better results for me! Thanks Pete.

IP: Logged

SSC
Administrator
posted 31 January 2013 10:22         Edit/Delete Message   Reply w/Quote
You could also use FeedbackLoopIn and FeedbackLoopOut (in place of the MemoryWriter and reader pair).

IP: Logged

pete
Member
posted 31 January 2013 16:23         Edit/Delete Message   Reply w/Quote
Hi Cristian

I think you've worked it out. What I was saying is that you don't paste anything into hot fields as hot fields are not sample rate (as you said). Any formula has to be constructed out of modules feeding other modules inputs, not hot fields. If you want to add you use a mixer, if you want to multiply you use a product module, if you want to subtract you use a minus module or another mixer with -1 as the scale to invert the sample rate signal. If you want random you use a noise module. The only thing that is at capytalk rate are the user interface controls.

Hi SSC
if he uses a FeedbackLoopIn and FeedbackLoopOut, will this not give a few samples delay? If say it was 4 samples then sample 1 5 9 and 13 etc will work independently to sample 2 6 10 14 as would 3 7 11 15 etc. This way you tend to get a cyclic effect every 4 samples as each of the 4 groups could walk in different directions with no coherence. This is based on capybara days where the feedback delay was related to the number of chips in your system. Has that now changed in the Paca so that you can have a single sample delay using FeedbackLoopIn and FeedbackLoopOut ?

Thanks

Pete

IP: Logged

pete
Member
posted 31 January 2013 16:42         Edit/Delete Message   Reply w/Quote
Hi Cristian

BTW if you want to do smoothing at sample rate yet keep the final values the same, you can use a delay module with the delay set to 1 samp, delay scale set to 1 , feedback set to !Smoo and scale or level (can't remember which it is) set to 1-!Smoo. Make sure it is set to comb , no interpolation and no smoothing of delay changes.

To make it work the value of !Smoo has to be very close to (but not equal to or greater than) one. Values like 0.999 work well. If you do reach value one , your smoother becomes a hold and the out put will be stuck where it is until you move the !Smoo value down a tiny bit again.

Hope this makes sense

Pete

IP: Logged

SSC
Administrator
posted 31 January 2013 17:57         Edit/Delete Message   Reply w/Quote
On the Paca(rana), FeedbackLoopIn (and Out) is a single-sample delay (does not introduce extra delays).

IP: Logged

cristian_vogel
Member
posted 01 February 2013 05:12         Edit/Delete Message   Reply w/Quote
Great.

A GENDY / XenOsc implementation needs to move an arbitrary ammount of breakpoints in the x and y directions , in the ideal , at Sample Rate.

Of course I have to paste sounds into the XenOsc, as they control the positions of the break points, so in the end I cannot figure out how to build a XenOsc using only sample rate operations (the MI Frequency Modulator input on the oscillators sounds like SR?)

I tried a multiplying waveshaper, looking up a fullramp with a smoothed noise source as the nonlinear input. Not the same thing.

Anyway, its been a very interesting little investigation.

Here are the papers I was reading for the software model, by Serra and Collins, and the pieces by Xenakis that gives the sonic idea.

S709 http://www.youtube.com/watch?v=Zmi2EVb7kQU

GENDY3 http://www.youtube.com/watch?v=3rrCNzcSh2Y

Stochastic Composition and Stochastic Timbre: GENDY3 by Iannis Xenakis http://www.jstor.org/discover/10.2307/833052?uid=3737864&uid=2129&uid=2&uid=70&uid=4&sid=21101602349343

and also Nicolas Collins paper on his SuperCollider implementation http://www.sussex.ac.uk/Users/nc81/research/stochasticsynthesis.pdf



IP: Logged

pete
Member
posted 02 February 2013 20:25         Edit/Delete Message   Reply w/Quote

PetesAlgaTone.kym

 
Hi SSC

The feedback pair with one sample delay. That is great news.

Hi Cristian

Purely by listening to the sound examples my guess is that the control doesn't need to be at sample rate. There is nothing in there that constitutes changes greater than 1 khz. But what I also noted is the cleanness (non aliasing) of the tones, so I'm guessing this is down to the algorithmically generate signals which would be at sample rate. The paper does have a lot of big words that I don't understand and it doesn't really tie down exactly what is happening inside the sound generator. So by using my ears I'm going to make a big guess.

Lets forget for one moment the brake points and look at the second order system. lets start by generating a sine wave and cos wave in algorithmic form at sample rate. This is calculating on the fly with no lookup table.

Look at this simple formula written in basic.

10 X=100 : Y=0: Freq = 0.05
20 X=X-(Y*Freq)
30 Y=Y+(X*Freq)
40 do something with X and Y like plot it on a graph or feed speakers
50 GOTO 20

Believe it or not this simple program will make X produce a sine wave and Y produce a cos wave. Varying Freq will change the frequency but this must be less than 1.

I've implemented this in Kyma in "sine wave formula" attached. The freq is controlled by a constant but that can be replaced with a sample rate signal.

I don't know the details of their algorythm but also included in the attached is "Petes AlgaTone". It is something I've been thinking about for a while. It algorythmicaly generates sound at sample rate.

It uses the input output charictaristic modules to deform the liniarity and although the controls are at capy rate the interpolation is all done at sample rate. See the X and Y nodes

Noise has been added and there are a few additional modules added to maintain stability. I don't know if this is anyting like what they were doing but it does give a large variety of sounds even without any control cirtutry added.

If you want to make sure that it doesn't resolve to silents you must keep energy at 1 or greater and "UnStable" should be kept at close to zero for lower pitch and complex sounds.

By seeing what I've done you may be able to adjust it into their formulars and you could do the control stuff in normal capy talk. I didn't use the feedback modules but if you are on a paca you could replace the memory writers and sample players with them.

I hope this makes sense and I hope you enjoy "Petes AlgaTone".

Pete

BTW if any one wants to transfer "Petes AlgaTone" to the tweaky be my guessed.


IP: Logged

cristian_vogel
Member
posted 03 February 2013 08:15         Edit/Delete Message   Reply w/Quote
Wonderful stuff Pete!

This oscillator rocks my world.

Thankyou so much. I'll post the results of this thread up at the Share soon. First, some Algatone Sunday fun..

[This message has been edited by cristian_vogel (edited 03 February 2013).]

IP: Logged

SSC
Administrator
posted 03 February 2013 15:00         Edit/Delete Message   Reply w/Quote
We made some examples in parallel with Pete's. (And yes, in the paper, he does say that the updates occur once per cycle, not at the sample rate).
http://www.symbolicsound.com/cgi-bin/bin/view/Share/Sounds#Synthesis_

Two different approaches:

First, a waveform in which each sample point takes a random walk, stepping to a new value on each new cycle (the cycle length is determined by the frequency you supply).

In most implementations of stochastic waveform synthesis, a small number of random breakpoints are generated and the remaining samples of the waveform are obtained by linearly interpolating between the breakpoints. In our approach, every sample point of the waveform is randomly generated. Once per cycle, each sample point takes a step of a random size in a random direction.

To more closely emulate the breakpoint approach, we've also included an example where the waveform is downsampled with a SampleAndHold (to create break points) and those points are integrated to create linear interpolation between the points.

In the second approach we used the XenOscil with 15 breakpoints, each of which takes a random walk.

IP: Logged

cristian_vogel
Member
posted 04 February 2013 09:23         Edit/Delete Message   Reply w/Quote
Thats what I was dreaming of. Amazing the different approaches to getting noisier in a formal way.

Carla, what is the reason you have such a calculated seed in one of the sounds?

"seed: ?VoiceNumber sqrt / ?NumberVoices / 3 sqrt"

[This message has been edited by cristian_vogel (edited 04 February 2013).]

IP: Logged

SSC
Administrator
posted 04 February 2013 10:53         Edit/Delete Message   Reply w/Quote
quote:
"seed: ?VoiceNumber sqrt / ?NumberVoices / 3 sqrt"

Just trying to make sure the seeds were not correlated

[This message has been edited by SSC (edited 04 February 2013).]

IP: Logged

SeanFlannery
Member
posted 07 February 2013 19:18         Edit/Delete Message   Reply w/Quote
Great topic all Thanks!

IP: Logged

CharlieNorton
Member
posted 10 June 2013 09:00         Edit/Delete Message   Reply w/Quote
Xen = Xenakis! Epic Thread! Learning much, will try it all.

Whole pile of thanks.

Charlie


IP: Logged

JulianLeviston
Member
posted 19 November 2013 02:15         Edit/Delete Message   Reply w/Quote
quote:
Originally posted by cristian_vogel:
Brownian noise. Great, thankyou!

Doing a drunk walk was actually one of the things I've been wanting to know how to do in Kyma for a few weeks now, so I used this method to create a Sound. I've uploaded it:
http://www.symbolicsound.com/cgi-bin/bin/view/Share/Sounds

Look under brownian motion / drunk walk.

Thanks all for how to do it

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply

Contact Us | Symbolic Sound Home

This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.


Ultimate Bulletin Board 5.45c