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

# Sound Card Phase (PM) / Slope / Width (PWM) Modulation

Macro: PMdlg

This button in the Modulation section of a Stream brings up the Phase Modulation dialog. It is shown depressed when PM is activated for this Stream. The actual PM toggle button is at the top of the opened dialog.

This same dialog can be switched from Phase Modulation to Slope modulation from the Ramp Wave dialog, or to Pulse Width Modulation (PWM) from the Pulse Wave dialog.

Phase Modulation Overview

Consider a simple sine wave, which we could generate by looking at the tip of the minute hand of an old-fashioned circular clock, and measuring its height above a line that passes from 9 to 3 through the central axis.

A second clock is "in phase" if it is set to the same time. Assuming both clocks are identical in operation, the minute hands will always read the same no matter how many hours elapse. If we now set the second clock slightly ahead or behind, its minute hand will always maintain the same angular relation to the minute hand of the first clock.

If the sine waves generated by these two clocks could be sped up and turned into sound waves, we would find that since they both rotate at the same rate, they both have exactly the same frequency or pitch. This is true even when one is ahead or behind the other. As it turns out, our ears can't tell anything about the absolute phase ("time") of an ongoing sine wave tone.

Now consider what happens when we are in the act of changing the time setting of a running clock. If we are moving it ahead of its original setting, then the hand must move faster than its normal rate to get to the new setting. When it gets there, it must slow back down to its normal rate as we stop turning the adjuster. With sound waves, that would correspond to a momentary pitch increase followed by a decrease... and our ears are very good at detecting pitch changes.

The phase modulator simply automates these changes and applies them continuously, like setting the time back and forth repeatedly. The modulation frequency is the rate at which the adjuster knob is turned back and forth, and the modulation depth is how far it is turned.

To demonstrate this effect, first make sure the Trigger is active and set to Gen Sync, which should show 'L.0 Freq'. Set Generator to use both Left and Right channels, and initially set both channels to produce identical sine waves at the same main Frequency and Phase. (The default 440 Hz at 0 Phase is fine.) The Left and Right traces should superimpose exactly... toggle the Right display off momentarily to check that the Left trace is indeed beneath it, then toggle Right back on.

Now bring up the Right Stream dialog and click on the PM button to get the Phase Modulation dialog. Set Mod Depth to 50% and Mod Freq to 0.5 Hz, and toggle Phase Mod on. You will see the Right trace sliding back and forth on the screen, but its apparent frequency remains that same as the Left channel... there are no stretched or compressed regions as happens with FM.

Ramp Slope Modulation

When you set the main wave to Ramp, the Modulation Type control in the Ramp Wave dialog gives you the option to change from 'Phase Mod' to 'Slope Mod'.

Slope modulation changes the tilt of the ramp under control of the modulator source, giving sounds reminiscent of brass-type musical instruments. Typically, you would set the basic ramp Rise to 50% to allow for equal slope changes in each direction.

This modulation works in a similar way whether you have a smooth ramp or a staircase. With stairs, the steps stay at the same height, but their width is reduced as the slope becomes steeper.

Pulse Width Modulation

The Width Units controls in the Pulse Wave dialog allow you to select the units used for the width controls. If you select 'Percent' or 'Degrees', the PM option becomes Pulse Width Modulation (PWM). With 'Samples' or 'Seconds' it stays at Phase Modulation (PM).

To understand what PWM does, consider a simple monophasic (unipolar) pulse wave that has a 50% duty cycle; the output goes high for half of the cycle, then goes low for the other half. With PWM active, the pulse width changes in proportion to the modulation, increasing when the modulating signal is positive and decreasing when it is negative.

One useful feature of PWM is that the average value of a unipolar pulse train is proportional to the duty cycle. Unipolar pulses can be averaged via a simple RC filter to get a DC value that is proportional to the modulator waveform, as long as its frequency is much lower than the filter cutoff. This allows an AC-coupled sound card to produce controllable DC or very low frequencies. See the "Low Frequency or Continuous DC Output" topic under DC Pulse Output Converters.

Macro Notes:

If the Stream dialog is open, PMdlg=1 opens the PM/Slope/PWM dialog, PMdlg=0 closes it, and PMdlg=x toggles between open and closed.

Note that you do not need to open the dialog to change any of its controls directly via macro command.

GO: