From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with analogue output

Hi,
 
I'm trying to generate an analogue waveform that produces sound on a loudspeaker. The loudspeaker does produce a sound (i.e. the VI atleast outputs signals), and I've also checked the output using an oscilloscope. However, the sound I obtain using the VI is different to that obtained by using a function generator (device), for the same frequency and amplitude.
 
I suspect that it's something to do with the sampling rate, because the sound changes as I change the sampling rate. But I still can't figure out how to actually obtain the same sound as I did from using the function generator.
 
I'd be grateful if you could have a look at my VI (attached) and tell me why the two noises might be different.
 
Ruf.
0 Kudos
Message 1 of 5
(2,787 Views)
The output frequency is entirely dependent on the sample rate in your program. First, you remove all of the timing information from the sine waves you create by using the Get Waveform Components and not using the dt from the original waveform when you use the Build Waverom function. If you want to use waveform timing, instead of using the sample clock mode of DAQmx Timing, use the Use Waveform mode and wire the waveform into that.
0 Kudos
Message 2 of 5
(2,776 Views)

Thank you for the reply Dennis.

The reason why I used the Get Waveform Components was so that I can use the two waveforms to obtain a complex waveform. That was the only method I could think of actually forming the exp(i*w*t). Someone else suggested wiring sampling info into my Sine Waveform VIs to input the sampling rate into the waveforms. Do you reckon that will fix the problem?

I've attached a screen shot of my modified block diagram. Is this what you meant by your earlier post?

Cheers.

Ruf.

 

0 Kudos
Message 3 of 5
(2,757 Views)

No.

You don't understand how the get/build waveform functions work at all. There are three components, y, dt, and t0. When you used the generate sine function, the waveform output had a dt. this defines the frequency. You get the Y array but do not get the dt. When you use the build waveform, instead of using the dt from the original waveform, you create a new waveform with a default dt value of 1.



Message Edited by Dennis Knutson on 02-29-2008 07:31 AM

Message Edited by Dennis Knutson on 02-29-2008 07:31 AM
0 Kudos
Message 4 of 5
(2,739 Views)

Cheers for the help Dennis.

Sorry for being a complete idiot, you were right I didn't know anything about them, I was just trying out things and thought it gave me the waveform I needed. Well I've done as you suggested now. I've got a few questions about the VI which I've been trying to find out the whole day and haven't got anywhere yet :(.

It's very basic, I just want to know what the frequency of my analog output is. The formula which I've seen on NI Help is,

Output Frequency = [Update Rate × Frequency] / Sampling Frequency

I entered 50 Hz into the Frequency of the Sine Waveform VI, but I know that this is not that analog output frequency because this frequency varies depending on the sampling rate and the number of samples. So my question is, what is the actual analog frequency that goes to the loudspeakers if I specify particular sampling rate etc.

I've tried to use the above formula, but I'm not sure how I'd calculate the Update Rate, as to me it seems to be related to the Sampling Rate and the Output Frequency (from what I've found out on here). I would have thought that there was a simple answer some where.

0 Kudos
Message 5 of 5
(2,717 Views)