MAXConnect NI myDAQ to your PC with USB cable. Start MAX (Measurement & Automation Explorer) to view if the device is connected to your system, by running the system diagnostics. In MAX application, on the left colum, select Devices and Interfaces and then click on myDAQ icon. If Microsoft Windows detected the device, on the center colum you can view the Self-Test button highlighted, so you can click on it and if the device is working perfectly, you can see a Success popup and read: The device passed the self-test. So you can reduce or close MAX.

 

Start NI LabVIEW, select a blank VI and realize what you see on the next images. In the Front Panel you shoud place 2 Knob and 1 Waveform Graph. In the Block Diagram you shoud place 1 Simulate Signal and 1 DAQ Assistant.
In Block Diagram window connect all the blocks each other like you can see in the next figure.

front panel   block diagram

Rename one knob like Amplitude and select a range from 0 to 2 (myDAQ allows output signals from the AUDIO OUT in the range between -2 and 2 Volts, then the maximum range of the knob can be set between 0 and 4) and rename the other knob like Frequency, selecting the range from 20 to 16000 (id est from 20 Hz to 16 kHz, human audio range).
In the Block Diagram you should do a double click on Simulate Signal VI block to set sample rate to 44 kHz according Shannon theorem. Write this value in Timing section.

Simulate Signal

Configure DAQ Assistant like reported in the images below, to generate an analog signal from AUDIO OUT between -2 V and 2 V from a left audio channel, so you should choose audioOutputLeft.

DAQ Assistant settings DAQ Assistant settings

DAQ Assistant settings

Now connect myDAQ to your PC using audio cable that you can find in the myDAQ box: connect AUDIO OUT on the device and the microphone input on your computer.

myDAQ

Run your VI, but if you cannot hear sound from your PC speakers, surely you should have to configure Windows microphone mixer. So open Windows Control Panel and set Audio settings like reported in the images below. Now you can modulate the sine wave using the knobs and consequently the audio sound.

Audio settings  Audio settings

You can download this VI for LabVIEW version 2010 and subsequent from here: Generate_an_audio_sine_wave_with_myDAQ_[2010].vi
That's all!


Advertising

Advertising

Advertising

We use cookies

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.