Thursday, September 8, 2016

SigGen Ver. 3.1 (Visual Basic 6)

Digital Signal Generator for Sound Cards. Sine, squared (variable duty cycle), triangular (variable symmetry), ramp, white and pink noise wave forms are included with continuous, burst, linear and logarithmic sweep generation modes. It is also possible to generate complex wave forms by synthesizing them on the screen with the mouse pointer or by reading an arbitrary function Y = F(X) from an external .txt file. Generatore di segnali, a due canali indipendenti, per la scheda audio. Genera forme d' onda sinusoidali, quadre, triangolari, a rampa, rumore bianco e rosa nei modi continuo, ad impulsi ed a spazzolamento di frequenza lineare e logaritmico. E' anche possibile generare complesse forme d' onda, disegnandole direttamente sullo schermo con il puntatore del mouse.

Siggen Ver. 3.1

Multiplexer compensation

MUX clearing procedure:
• Generating, on both channels, a sinusoidal signal of 1 kHz and of amplitude equal to 1 Neck, p by carrying out, on the generator, the settings:
Wave form Ch1 = Ch2 = Sine Wave form
Generator mode Ch1 = Ch2 Jan. mode = Run
Start Freq. Ch1 = Start Freq. Ch2 = 1000
Start Amp. Ch1 = Start Amp. Ch2 = 1

• With the 'help of an oscilloscope to measure the phase difference between the two channels and adjust the coefficient of MUX compensation so that this difference is annulled.
Press the [Apply] button, after each change of values, in order to assess the 'effect of the change.

If the 'oscilloscope allows measures used in X-Y, adjust the coefficient of MUX compensation so that the screen is drawn only one segment; the design of an ellipse indicates a residual phase error.

I can not exclude that for some sound card models the coefficient is unnecessary (e.g., for the Realtek HD Audio output should be Cm = 0 s) or should even be negative.

The [Apply] button using the coefficient calculated only in the current measurement session; [OK] button, use the coefficient in the current session and saves it in the INI file to be used in future sessions.

The calibration coefficient KCal

calibration procedure KCal:
• Generate a sinusoidal signal of 1 kHz and amplitude equal to 1 Neck, p performing on the generator settings:
   Sine wave form =
Generator mode = Run
Start Freq. = 1000
Start Amp. = 1

• Adjust the calibration coefficient to obtain, in output from the sound card, an AC voltage of 0707 V measured with true rms voltmeter.
Using an oscilloscope, you should measure 2 V peak-peak.
Press the [Apply] button, after each change of values, in order to assess the 'effect of the change.

If the selected sound card were to reverse the sign of the output voltage (like 'my Sound Blaster Live!) Use a negative calibration coefficient.

The [Apply] button using the coefficients set only in the current measurement session; [OK] button using the coefficients set in the current session and saves them in the INI file to be used in future sessions.

General notes

• In many of the instrument boxes setting values ​​can be written / edited directly: in this case, if the box were to take yellow, confirm the new value with the Enter button.

• Many of the controls are, like help text (ToolTip), which correlates to the primary or 'indication of the possibilities: e.g. the boxes of the [Frequency range] have framework, such as help text, the value of the period corresponding to the selected frequency and number of samples generated for each period (resolution of the d 'waveform); buttons [Square] and [Triang.] have the values ​​of "Duty cycle", the symmetry and the 'indication of how to change them.

• If the buffers filling time exceeds the allowed maximum of 400 ms, the signal generation hangs with box [Buffer filling time: colored] in red. In this case the stop signal generation and try again with a lower sampling frequency.

• Under [Amplitude range] in the [Start Amp:] and [Stop Amp:] have the values ​​written in red if the product KCal (see Technical information) for the currently set value is greater than 32767 or less than -32767 (the allowed limits the resolution to 16 bits) with consequent damages "clipping" of the d 'generated waveform.

• There are two ways of generating the signals, with and without the 'use of "callback", selected with the menu item [Settings], [the generator parameters].
The "callback" technique, although more efficient in terms of use of the CPU (and preferable, if possible resources), can be a source of problems on some PCs (generator that does not start, that quits unexpectedly, etc .. .) in this case, uncheck the [Generation via Callback] in the form of [siggen Settings].

Note to users of sources in VB6: if the "callback" should never be used would become possible to compile the program in "Native Code" instead of "P-Code" (see document q198607.pdf) decreasing, thus, the time required the filling of the buffers.

Notes on "Graphical wave form constructor

• To modify and use the form d 'wave summarized graphically must select the button [graphical wave form] of the [Wave form] framework.

• The nodes for the 'setting of the d' wave (red squares form) can be moved with the mouse cursor, hold down the left button.
The curve drawn in yellow is the one corresponding to the sampling instants and is derived, by interpolation, from that set (red curve).

• The true period of d 'generated waveform is equal to the integer multiple of' sampling interval of Ts (Ts = 1 / Fs Fs = sampling frequency) closer to the required value for the period; the true values ​​of the period, frequency and number of samples used are shown, such as help text, the [Wave Period] box.
For reasons of resolution and speed of calculation, the value of settable period is between 10 and 16000 times the sampling time Ts e.g., if Fs is 8000 Hz the 'permissible interval will be 1.25 ms to 2 s; If Fs is 48000 Hz l 'operational range will be from 0.2083 ms to 0333 s.
The [1 / F1] sets, in the [Wave Period], the value of the period corresponding to the frequency value present in the [Start Freq. F1].

• The box [Norm], when selected, requires the absolute maximum value of the interpolated curve to take on the value 1.
L 'amplitude of the curve drawn by the yellow signal, before being sent to' generator output, is multiplied by the value in the [Start Amp] box.

• The interpolated signals # 1 (left channel) and channel # 2 (right) are designed taking into account the request phase.

• The interpolated # 1 (left channel) signal is already corrected drawn from the multiplexer delay time (see technical note).

• From version 2.3 you can save / read, in .txt format, the position of the graph nodes for further processing by external applications (e.g., Excel, NotePad, etc ...). To access the menu Save / Read of 'graphical wave use the button with the' disk icon, right below the graph.

The file format is:

 X0, Y0
 Xi, Yi
 Xn, Yn

and it describes the graph of a period of d 'waveform as Y = F (X).
X must be distinct and in ascending order.
Xn is the 'x-coordinate of the first node of the next period and will, therefore, Y0 = Yn.

The period Xn - X0 of 'wave described in the file is, during reading, made to coincide with the period currently set in the [Wave Period], allowing it to use for the X, in the phase of construction of the graph, an arbitrary scale any .

It may be convenient, in the phase of construction of the graph, define more nodes in the sections where the curve F (X) has strong variations or discontinuities and less nodes in the sections where the curve is sufficiently straight (see example file Cardiac_R.txt) . The X values ​​will not be, therefore, equally spaced, and will therefore be necessary to use interpolation modes [P.W. Linear] or [Cubic Spline]; with l 'interpolation type [Fourier] the values ​​of X will, however, be redistributed so monospaced on' interval X0 -> Xn.

Technical information

• The values ​​sent to output channels are calibrated (using the multiplication coefficient KCal) to have a voltage output from the sound card (connector -> speakers) of 0.7071 Vrms in correspondence to the generation of a sinusoidal signal of 1 Vu, eg of 1 kHz; the cursor of the Wave out volume, on the Playback Panel, should be to the maximum and to balance the center.
Other sound card models, different from my Sound Blaster Live !, may require different calibration coefficients.
The calibration coefficient was found experimentally with the 'help of a Tektronix oscilloscope 468 and a multimeter Tektronix TX1 True RMS. The effective value of 0.7071 (1 / Sqr (2)) corresponds to a sinusoidal signal, the 1 V peak value; if read with an oscilloscope, this signal should have a peak-to-peak value of 2 V.
If your sound card used should reverse the sign of the output voltage (how does my Sound Blaster Live!), Use a negative calibration coefficient (check with an oscilloscope).
The calibration coefficient KCal can be changed through the menu [Settings / generator parameters].
Read the help files Calibrazione_KCal.rtf.

• With sound card SB Live! the passband (of the output channel to the speakers) at -3 dB goes from 1 Hz to 21.5 kHz; the output voltage, in the linear zone, is 6 Vpp.
I have, however, allowed the generation of much lower frequencies of 1 Hz because, if you read through the wave channel in the Recording panel, can start from 0 Hz (see AudioCardDSP project).

• With sound card SB Live !, the output signal from the channel # 2 (right) is delayed by about 1/48000 s compared to the channel # 1: evidently it is used only one D / A converter, alternately switched on the two channels.
This phenomenon, from version 2.1 onwards, it is offset by the 'use of CompMUX coefficient, editable in the recalled table from the [Settings / generator parameters]; I can not exclude that other sound card models the coefficient should be negative (or is even useless as, e.g., for the Realtek HD Audio output).
Read the help files Compensazione_MUX.rtf.

The compensation is made by adding a correction phase to the generated signals, except when it is used in the form d 'wave summarized graphically: in this case CompMux corrects the signal during the interpolation operations. The delay, however, does not appear on the signals sent to the Wave channel: in this case, set to zero the coefficient CompMUX.

• This project was developed using the "." as the decimal separator; although he tried to prevent possible problems due to 'use of "," I can not exclude that it remained some inconsistency.
In particular, could be a source of trouble reading, from SigGen.ini files (especially with Windows XP!), The calibration parameters (see the values ​​assigned in LeggiParametri routine and subsequently observed with the [Settings / generator parameters] menu).
In case of malfunction due to this problem, try changing the regional settings on your PC and give me news of the "bugs" found.

• This version can not work in "Run" mode for more than (about) 13 hours continuous.

Instrumentation used for development and calibration.
• Digital Storage Oscilloscope, Tektronix 468.
• True RMS Multimeter, Tektronix TX1.
• DSP for Audio Card, AudioCardDSP 3.0 F. Languasco.

• Theory and Application of Digital Signal Processing - L. Rabiner, B. Gold - Prentice-Hall Inc.
• Digital Signal Processing - W. Stanley - Reston Publishing Company Inc.
• Digital Time Series Analysis - R. Otnes, L. Enochson - John Wiley & Sons.
• Numerical Recipes in FORTRAN 77 - William H. Press.
• Electronic Measurements - Notes from the Turin Polytechnic courses.