|
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:OscilloscopeSpectrum Analyzer Signal Generator
|
Applications:Frequency responseDistortion measurementSpeech and musicMicrophone calibrationLoudspeaker testMusical instrument tuningAnimal soundEvoked potentialsRotating machineryAutomotiveProduct testContact us about
|
|
Changes Script Random ValuesChanges : ?( min, max), ?x= n, ?s= n Changes script commands can use random values in place of most values. (The exceptions are Voice number, Buffer number, and Oscillator number, which must have explicit constant values.) The format for using a random value is ?( min, max), where min and max are limit values. For example, to set a random Pan Position for Voice 2 that is between Center (0) and full Left (-64), you would use: P2=?(0,-64) The order of the limits does not matter. Either or both may be signed. Note that you may not use a random value, expression, or Oscillator as either of the limits. However, you may use User Variables for either or both limits, which have been set previously using any valid expression (including random values or Oscillators). Example: UA=?(10,20) UB=$1(-30,+30) P2=?(UA,UB) Controlling Probabilities: The specified random limits may exceed what can actually be accepted by a given command, because the command will apply its own limits to the random value. For example, commands that set a state to Off or On will limit all values to 0 or 1. Likewise, assigning the random value to a binary User Variable U0-U9 will limit it to 0 or 1. You can use this fact to control the probability of each state. The random values have a uniform distribution, so if you use ?(0,1) the On and Off states will have approximately equal probability. If you set a higher upper limit, the probability of the On state are increased proportionally. For example, ?(0,3) will cause On states about 75% of the time. (There are 4 possible values, and 3 of them are above zero.) Conversely, you can use a negative lower limit to increase the proportion of Off states. Negative random values will be truncated to zero after they are obtained, so ?(-2,1) will cause Off states about 75% of the time. (Again, there are 4 possible values, and only one is above zero.) You can simplify this by just plugging in the percentage of Off and On states, with the Off limit made negative. For example, ?(-40,60) will be Off about 40% of the time and On about 60% of the time. Those percentages are not exact, since there are 41 values that are 0 or less which (will be limited to 0), and only 60 that are 1 or above (which will be limited to 1). The mathematically correct approach would be to reduce the absolute value of the negative limit by one to account for the zero, hence ?(-39,40). But this is unlikely to matter for most uses... after all, it is a random value, so you might need thousands of repetitions before there would be a statistically valid difference. Repeatable Random Values: The normal random number generator is a "true" random generator and is essentially not repeatable. It uses a conventional pseudo-random generator followed by a scrambling process based upon the rapidly-changing least-significant bits of the elapsed time. If you use true random values to control a DaqMusic performance, for example, you can't be assured of ever hearing the same performance twice. This might be a good thing, or it might not... you might hear something you really want to be able to repeat, or to exchange with others. The random number generator can be switched to a "false" mode that only uses the conventional pseudo-random method. In this mode, the sequence of random values will be identical for every performance that uses the same "seed" value. (See below.) ?x=0 switches off the true random generator, and ?x=1 switches it back on. As a mnemonic, note that 1 means "True" and 0 means "False" in conventional binary (Boolean) logic. ?x=x toggles the current state. You can also use ?x= n where n is any expression, including random values. Such random values will be generated using the current True/False state before the command is processed. Note that these are commands that control the random generator; don't try to use them in place of a normal ?( min, max) random value. When the generator is in False mode, it uses a "seed" that controls the sequence of pseudo-random values. If you change the seed, you get a different sequence... and hence a different performance. ?s= n sets a new seed value, where n is any expression. Typically you would set this to a chosen constant at the start of the Changes script, followed by ?x=0 to set pseudo-random mode. You would only need to run these commands once. (Since a Changes script normally repeats after it runs its last command, put the rest of the script into an infinite loop. Then only that part will be repeated.) Seed values may range from -2^31 to +2^31-1 (-2147483648 to +2147483647), but it may be more convenient to use hexadecimal notation by preceding the hex value with 'h'. The hexadecimal range is thus h1 (equivalent to h00000001) to hFFFFFFFF. Regardless of format, an entered value of 0 will be converted to 1. The default seed value is 3947211523 or hEB45AB03. The current seed value is changed every time a pseudo-random value is generated, but not for True random values. You can thus interrupt a pseudo-random sequence by temporarily switching to True to generate as many values as you wish, and when you switch back the pseudo-random sequence will resume where it left off. Tip: If you want to explore different initial seed values to hear the effects on the performance, you could manually enter an arbitrary new seed by editing the n value in the ?s= n command before every run. But a much better way is to set the seed from a True random value before switching to False mode. At the start of the script, use ?s=?(-3G,+3G) The +/-3G values set the random limits to the maximum range, because 3G (3 * 10^9) is bigger than 2^31 and is thus limited automatically to the maximum supported positive or negative value. If you give this command once at the start of the script, and then use an infinite loop for the rest, you'll get a new seed for every run. Or, you can create a loop that will play enough of the performance for you to evaluate the effects of the seed, and change the seed at the start of each loop pass. Don't forget to switch back to True mode before you set the new seed, if you want truly random seeds. If your goal with the random seed search is to find a particular value you can use later, without the random search, you will need to know that value so you can enter it directly with the ?s= n command. You can use the Output Display option for this. Instead of using the True random value to set the seed directly, use it to set an integer User Variable instead, as in UA=?(-3G,+3G) Then use ?s=UA to set the seed, and oL=UA to see the value as a normal integer, or oLh=UA to see it in hexadecimal format. If you want to see the current seed at a certain point in the script, use oLh=s. You can hit Pause to momentarily halt the performance when you hear something you want to keep. Then you can highlight the Output Display text and use CTRL+C to copy it to the Windows clipboard, and later use CTRL+V to paste it into your script. Or, if you want to survey a lot of seeds quickly, you can paste into the Daqarta Notes Editor or a separate text editor of your choice (such as Windows Notepad), perhaps with a brief comment or rating, then unPause and go on to the next seed. See also Changes Script Overview, Changes Script Editor, MIDI Voice Setup Dialogs, Pitch-to-MIDI dialog, Pitch Track Toolbox - Overview |
|||
GO:
Questions? Comments? Contact us!We respond to ALL inquiries, typically within 24 hrs.INTERSTELLAR RESEARCH: Over 25 Years of Innovative Instrumentation © Copyright 2007 - 2011 by Interstellar Research All rights reserved |