02-22-2012 07:32 AM
I have an app in vb.net VS 2005 & MeasurementStudio S 8.1.2 that measures the distortion from a loudspeaker and adjusts the stimulus to maintain x % THD.
So, I'm doing a frequency sweep (with amplitude changes) from say 20 - 200 Hz, measuring every 2Hz the THD and adjusting the amplitude for x % THD, using a USB-6212's analog output to drive a audio power amplifier and the analog inputs to acquire microphone signal. The input part works fine and the output part works but I get a "pop" from turning off the signal and turning it back on to update the output. The pop is from not being able to turn on or off at the sine wave's zero crossing.
Here is code snippet that updates the waveform at one frequency, inside a frequency sweeping loop
do
---Generate sine waveform using Analysis.SignalGeneration.BasicFunctionGenerator at frequency F and amplitude A
OutputTask.AOChannels.All.DacConnectReferenceToGround = True' this eliminated the turn off pop, nice fade out of signal
OutputTask.Stop()' have to stop the output to update the output
Writer.WriteWaveform(True, waveform)' waveform is generated using the MS BasicFunctionGenerator the "True" is autostart, makes no difference from using separate OutputTask.Start
OutputTask.AOChannels.All.DacConnectReferenceToGround = False' signal back on here, likely with transient from not being at zero crossing
---acquire input data from microphone, calculate THD, make amplitude adjustments if THD <> target
loop until THD = target %
----
02-24-2012 01:00 PM
hey p15218,
Could you clarify the question you have for us? This is a little confusing. Thanks!