Data AcQuisition And Real-Time AnalysisScope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
Contact us about
Macros: Level, LevelPct
This control adjusts the amplitude of the Stream. The total waveform amplitude for a channel (Left or Right) will be the sum of its four Streams. That total waveform is converted to an analog signal by the sound card DAC, then sent to the mixer volume controls before going to the output stage.
The Level controls thus adjust the digital size of the signal, while the volume controls adjust the analog size.
In general, you must insure that the total of all active stream Levels for each (Left or Right) output does not exceed 100 percent. If an instantaneous peak of the composite waveform tries to exceed the positive or negative limit of the output DAC, it will be "clipped" to that limit. However, there are certain situations where it is perfectly reasonable to have multiple Levels at 100 percent, such as with non-coincident tone bursts where the instantaneous total never reaches the clipping limit.
The Level control is typically used only to insure that signal peaks do not exceed 100%, or to set the relative levels between Streams. If you have only a single stream active on a given channel, set its Level to 100%. With 2 streams, set each to no more than 50% unless you are sure they will never overlap in time.
You can enter negative values for Level, which will flip the polarity of the wave. This usually has no audible effect by itself, but allows you to subtract one Stream from another. For regular waves like Sine, a negative Level is the same as setting the main Phase to 180 degrees. But there is no Phase control for for noise-type waves, and for Play files Phase has a different effect, so this feature can be very handy.
If you want one stream to be a certain percentage larger or smaller than another, you can set the Levels using the default percent mode. Or, toggle the '%' button to 'dB' to set levels relative to 0 dB = 100%. The actual Level setting is unchanged by this button, only the display and control operation. So if you set -1.00 dB, for instance, you can toggle back to find that this is equivalent to 89.12509%.
Suppose you want to create a sine wave, which should smoothly vary between its positive and negative peaks. Internally, it is computed as a series of digital values, one for each output sample period. It isn't an ideal smooth, continuous wave, but on a standard 16-bit sound card there are 65536 possible steps, which allows an excellent approximation.
But as you reduce Level below 100%, the computed values are reduced accordingly. At 50% Level (equivalent to -6 dB) you are only using 32768 of those steps, equivalent to a 15-bit card. If you boost the volume you can match the original loudness, but the rendition will be "chunkier" due to the reduced number of steps.
That translates into increased distortion or "grit" in the sound, although in this case it wouldn't be audible under most conditions. But suppose you keep reducing Level and boosting volume: When you get to 0.003% (-90 dB) you effectively only have a 1-bit card, meaning that the output consists of just 2 levels; the sine wave has become a square wave!
If you want to experiment to see how audible this effect is, there is a simple way to do it without playing with Level and volume. Leave Level at 100% and use the Bits control of the main Signal Generator dialog to reduce the effective bits. Use a sine wave at around 400 Hz, which will put the worst distortion at 1200 Hz where your hearing is most sensitive. How low can you set Bits before you hear a change? How low before you can see a change in the waveform trace? Before you can see a change in the magnitude Spectrum trace (ALT+S)? In the Y-log power spectrum (ALT+Y)?
So, how does the main dB control change volume without incurring this problem? The answer is that it uses the attenuators in the Mixer section of the sound card. These act upon the waveform after it has already been converted to analog form. This preserves whatever resolution was in the original digital version, but just reduces the total size (voltage) of the signal. However, the attenuators work on the overall output of a given (Left or Right) channel, so they are of no use in changing the relative contributions of the streams within a channel.
L.2.LevelPct=dB or L.2.LevelPct=1 sets the Left Stream 2 Level mode to dB, while L.2.LevelPct=% or L.2.LevelPct=0 sets %. L.2.LevelPct=x toggles the current mode to the opposite state. It is a good idea to always set a known state with LevelPct before giving a Level command.
In % mode, L.2.Level=50 directly sets Left Stream 2 Level to 50%. L.2.Level=-50 sets -50%. Alternatively, L.2.Level=>1 increments and L.2.Level=>-1 decrements the current Level by 1%. Only steps of +/- 1% are allowed with this format.
In dB mode, L.2.Level=6 directly sets Left Stream 2 Level to -6dB. The sign of the value you supply is always assumed to be negative, so L.2.Level=-6 also sets -6 dB. L.2.Level=>1 increases and L.2.Level=>-1 decreases the current Level by 1 dB. (Increasing Level means "less-negative dB" here.)
Questions? Comments? Contact us!We respond to ALL inquiries, typically within 24 hrs.
Over 35 Years of Innovative Instrumentation
© Copyright 2007 - 2021 by Interstellar Research
All rights reserved