Daqarta
Data AcQuisition And Real-Time Analysis
Scope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
The following is from the Daqarta Help system:

Features:

Oscilloscope

Spectrum Analyzer

Signal Generator
(Absolutely FREE!)

Spectrogram

True RMS Voltmeter

Sound Level Meter

Frequency Counter

Period Counter

Event Counter

Spectral Event Counter

Waveform Averager

Histogram

Post-Stimulus Time
Histogram (PSTH)

Macro System

Multi-Trace Arrays

Trigger Controls

Auto-Calibration

Spectral Peak Track

Direct-to-Disk Recording

Accessibility

Applications:

Frequency response

Distortion measurement

Speech and music

Microphone calibration

Loudspeaker test

Musical instrument tuning

Animal sound

Evoked potentials

Rotating machinery

Vehicle pass-by noise

Product test

Contact us about
your application!

Random Macro Values


Macro: RandLimits

Macros can provide random values for test parameters, or random delays before the start of a test. These can be used, for example, to minimize subject guessing on behavioral tests, or to reduce unintended consequences of a simple linear-step mechanical or electrical test sequence.

Most numerical Daqarta controls or variables can be assigned a random value within a given range that you specify ahead of time. For example, RandLimits="100,1000" specifies that the range will be from 100 to 1000. ( Note that the quotes are required.) The total range must be between -32767.9999 and +32767.9999.

To apply a random value to a control or variable, use >r in the macro command instead of a specific value. A random value will be generated that is uniformly distributed over the preset range. It will appear to the control just as if you had entered it as a normal constant value.

For example, L.0.ToneFreq=>r sets the Left Stream 0 Tone Frequency to a random value within the specified range. As with a constant entry, this will be subject to the current frequency entry Step Mode setting, so the actual frequency can be constrained to specific steps within the range, if desired.

The random generator used for this process is similar to those used in Noise Waves. It is technically "pseudo-random", in that it creates what appear to be totally random values, but the exact sequence of values eventually repeats if invoked enough times. However, the complete cycle is 9.22 * 10^18 values, so even if you used 48000 values per second the sequence would not repeat for over 6 million years.

Because the random generator is pseudo-random, it has the sometimes-useful property that it can repeat the same sequence of values exactly on each future session, as long as the same macros are used in the same order.

But many times you will want completely random values from session to session. To insure this, you should randomize the generator before you use it the first time in a session. You do this with RandLimits=R. This uses several unpredictable values (such as the number of CPU cycles since the system was started) to scramble the seed array in the random sequence generator.

Note that this does not make the values "more random". The normal random process is similar to reading "perfectly" random values from a very long list; randomizing just picks a different point in the list to start reading from. In particular, it is usually pointless to randomize more than once per session.

But what if you want different random values in each session, yet still want the option of repeating that session exactly? One way to do that is to create your own quasi-randomizer macro to use instead of RandLimits=R. You can run the standard sequence ahead by a variable number of values, so that you are "reading from some other part of the list".

Just create a macro that does nothing more than assign a random value, such as Var0=>r, and call that macro in a loop. (You could use a Daqarta control variable instead of a macro variable like Var0, but it would be noticeably slower because any active control dialog would be redrawn on every pass. Macro variables don't cause dialogs to be redrawn; a loop of 100000 random values sent to a macro variable takes well under a second on a modern system.)

Ideally, the number of loop passes should be at least some multiple of the number of random values you use in the session, so that each session is absolutely unique. Record the number of loop passes you use, preferably in a Field or Notes, and use that same value any time you want to repeat the session.

When you use a random value, it is usually a good idea to save the actual value to a Field that will be saved with the test results. To do this, you must first set the desired Field to monitor the target control, before you set the control with the random value.

Note that the use of macros to enter random values is not, in general, the best way to produce randomly-varying Generator properties of an ongoing signal. The reason is that Generator control changes cause it to be restarted so that the waveform will immediately have the properties indicated by the settings. This typically causes an audible click in the output signal. Instead, consider using one or more of the Generator noise sources as stream modulators to change the desired parameters.

However, under certain circumstances you may wish to use random macros while blocking Generator restarts using GenUpdate.


GO:

Questions? Comments? Contact us!

We respond to ALL inquiries, typically within 24 hrs.
INTERSTELLAR RESEARCH:
Over 25 Years of Innovative Instrumentation
© Copyright 2007 - 2008 by Interstellar Research
All rights reserved