Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Random, but not as we know it

For general discussion related FlowStone

Random, but not as we know it

Postby HughBanton » Tue Oct 23, 2018 4:45 pm

Maths wizard help needed. Can anyone tell me how to generate random-number poly streams with what I think is called 'Normal Distribution''?

I know there are some excellent examples of white-noise and pink-noise available, but I need to generate pseudo-random numbers that lean towards a specific range, ideally so that I can specify a mean centre value and a distribution range.

For example, rather than a linear range of numbers from 0.0 to 1.0, I might want the majority centred around 0.7 - the centre value - and with the random numbers sitting between, say, 0.55 and 0.85 - the distribution range.

Possible in DSP? I've found plenty of scary maths stuff on this subject online but haven't a clue how to implement any of it!
User avatar
HughBanton
 
Posts: 265
Joined: Sat Apr 12, 2008 3:10 pm
Location: Evesham, Worcestershire

Re: Random, but not as we know it

Postby tulamide » Tue Oct 23, 2018 6:57 pm

Normal, aka Gaussian Distribution with its typical bell-like shape involves "higher" math. Exponential and root functions, that I don't think are easy to resolve in Flowstone's DSP (but feel free to prove me wrong).

Formula and further info:
https://www.dspguide.com/ch2/5.htm

EDIT: Oh, just read that you already found material.

EDIT 2: However, if you go to the next page of where I linked to, it gets interesting. It shows that using a simple random function 12 times in a row and adding each result, leads to a distribution very close to Gaussian. It will of course be offset /in the presented case the mean is 6.0 and the standard distribution 1, so you would need to multiply and offset it afterwards as you need it.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Random, but not as we know it

Postby HughBanton » Tue Oct 23, 2018 7:50 pm

tulamide wrote:It shows that using a simple random function 12 times in a row and adding each result, leads to a distribution very close to Gaussian.


Yes, that is most interesting. Presented like this it's easy to see how this happens in nature (and therefore in acoustic musical instruments no doubt!), I had no idea.

I guess all I would need to do is accumulate 12 consecutive random number samples (so my 1st result would = 1thru 12 accumulated, my 2nd = 2 thru 13, my 3rd = 3 thru 14 etc. etc). I'll give it some thought.

Cheers

H
User avatar
HughBanton
 
Posts: 265
Joined: Sat Apr 12, 2008 3:10 pm
Location: Evesham, Worcestershire

Re: Random, but not as we know it

Postby martinvicanek » Tue Oct 23, 2018 8:37 pm

if you do it that way, subsequent random numbers will be highly correlated, i.e. lowpassed. See, the distribution (gaussian, boxlike, or whatever) is just one feature of a random sequence, other features may be important as well. It depends on your application. How many random numbers do you need: one per sample or less (or even more)?
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Normal Distribution

Postby martinvicanek » Wed Oct 24, 2018 4:26 am

Here is a Gaussian white noise generator (now fully optimized). It delivers one random number per sample, with a Gaussian distribution (DC = 0, RMS = 1).
Attachments
gaussNoiseOpti.fsm
(7.67 KiB) Downloaded 876 times
gaussNoise.fsm
(9.53 KiB) Downloaded 882 times
Last edited by martinvicanek on Thu Oct 25, 2018 8:59 pm, edited 1 time in total.
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: Random, but not as we know it

Postby HughBanton » Wed Oct 24, 2018 10:13 pm

Thanks ever so much for this Martin, I will try out some experiments with it before the week is out.

So, what is driving my particular interest in this at the moment ..

I've pretty much perfected my additive organ generator, as far as it currently goes anyway. I've been busy recording music with it during the summer (- excuse my semi-silence here -) product to follow I hope. I've been extensively adding subtle general noise modulation, both FM & AM, and without doubt this greatly heightens the realism of the waveforms and makes them sound quite 'sample-like'. (But without the drawbacks of sampling .. particularly the one where you have to spend hours recording in a damp church and then spend more hours editing & looping :cry: I'm not a fan ...)

However winter beckons and now I'm back into 'research mode', particularly regarding the random noise thing, which seems to me to be the key element that diferentiates between all 'electronic' sounds and 'acoustic' sounds - not just organs of course. But exactly how to correctly apply it?

Two things have recently struck me; the first is that excessive application of linear white noise or even filtered noise quickly leads to too much pitch modulation & jitter, so I'm assuming that concentrating the random number range (eliminating most of the 'big numbers') will improve that. A real (acoustic) instrument can be over-blown, over-hit etc, and forced to sound tonally very fierce & modulated and yet the pitch can remain steady.

Second recent discovery can best be exemplified by considering a violin (rather than a flute), wherein the string is repeatedly caught by the bow's friction and then slips back along it : hence the string's basic oscilation goes stick-scrape-stick-scrape-stick etc. etc. Note that each 'scrape' will be subly different from any other one. But the point is it's assymetrical, the scrape only acts during one section of the waveform, not continuously. I've discoverd that with pipe simulations, if the noise ('wind', in this case) is applied to a limited section of the waveform only it seems to lead to better realism. But early days. A simplistic explanation will be, presumably, that as a pipe oscillates the wind sheet at the mouth oscillates in & out of the tube; when it's 'in' it's subjected to the tube resonance and when it's 'out' it's not. So assymetrical again.

Well, some food for thought. Anyone been down this road?

Thanks again Martin, you're a hero.
User avatar
HughBanton
 
Posts: 265
Joined: Sat Apr 12, 2008 3:10 pm
Location: Evesham, Worcestershire


Return to General

Who is online

Users browsing this forum: Google [Bot] and 159 guests