Hi all,I am using a random number generator to determine when the Arduino should emit a pulse.Random means that the frequency distribution of pulses in the output is approximately equal. There's as much 1Hz content in the output as there is 1000Hz content in the output: pulses happen once a second just as much as they do a thousand times a second.I want the frequency distribution to roll off evenly, with a flat NdB/octave slope. I would also like to be able to bandpass filter it, so that the pulses tend to happen at 500Hz but also happen quite frequently at other times as well. Is this possible?

I'm not sure what you intend the bandpass filter to do, but the rest of what you're describing is achievable by applying a transform to the uniform random number in your input domain to convert it into your output domain. Conceptually, if you were to plot the input and output values of that transform then the slope of the plot at a given output value would give you the probability density at that output value - if you see what I mean?

I only provide help via the forum - please do not contact me for private consultancy.

the probability of a given frequency appearing in the output filtered throughfloat z = exp(10/x)requires first realizing that both z and x give the period associated with a given pulse (actually, period - pulse duration, but assuming pulse duration is negligible for the moment)

thus z_frequency = 1 / ( exp(10/x) )

now the probability of any given value of x coming up is 1/1000

the probability of any value of z_freq coming up is also 1/1000however this is now a question of densitydoes z_freq mean that, for a given pulse, the output value z_freq is more likely to lie between some range z_freq_0 to z_freq_1 than it is for other ranges?

where dz/dx = 0, a change in x produces no change in ztherefore the probability of a given value z_freq appearing in the output is 1 if x happens to come up within a range where dz/dx=0 (and where z_freq(x) = that given value)

where dz/dx = 1, a change in x produces equal change in ztherefore the probability of a given value of z_freq appearing in the output is 1/1000 if x happens to come up within a range where dz/dx = 1

where dz/dx = infinity, a change in x produces an infinitely large change in ztherefore the probability of a given value of z_freq appearing in the output is 0 if x comes up where dz/dx = infinity

now how to get from there to a filter function? need to say, how does the probability of a frequency appearing in the output change as a function of x given some function z_freq()

well the only data point we have to go on of any substance is (1/1000, 1)backsolving 1/1000 = exp ( -C )ln(1/1000) = -6.907 --> C = 6.907

now we have to differentiate z_freqz_freq = 1 / ( exp(10/x) )

crap, I forgot how to do this

either way, we have a filter admittance function, I thinkadmittance = exp ( 6.907 * dz_freq/dt)

right, now say my admittance function should have a negative slope of 10dB/octavethat's 10dB / ( (freq_0 * 10) / freq_0 )or 10dB/10or crap, I just realized I have no idea how to convert that into a slope function... it must be nonlinear...

I'm not sure what you intend the bandpass filter to do, but the rest of what you're describing is achievable by applying a transform to the uniform random number in your input domain to convert it into your output domain. Conceptually, if you were to plot the input and output values of that transform then the slope of the plot at a given output value would give you the probability density at that output value - if you see what I mean?

Wait, is it really that simple? I just spent a page working out that it has to be fed through an exponent... no, I have no formal education in probability stuff. I just want to be able to tell my Arduino to stop putting out a pulse at N Hz rep rate and start putting it out such that the frequency distribution over some period of time fits that of pink noise (even output power per octave, filter slope of -10dB/octave) or of bandpass filtered pink noise.