Example Code

Capture analog input and play back the sound continuously through your PC speakers

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • Data Acquisition (DAQ)

    Software

  • LabVIEW

    Driver

  • NI DAQmx

Code and Documents

Attachment

Overview

This example is based off the Capture analog input and play back the sound through your PC speakers which allows you to play the sound you acquire AFTER you acquire it. 

 

Description

This example highlights the configuration needed to play back the sound immediately after the acquisition starts.  Thus it plays back the sound as it acquires and displays it.

 

Requirement

LabVIEW 2011 SP1 or compatible

NI-DAQmx 9.5.5 or compatible

NI myDAQ

 

Steps

Run the VI, adjust the volume sliding bar to adjust the sound volume

 

2017-02-28_9-02-03.jpg

 

snippet 23382.png

 

NOTES:

  • The hardware is configured to acquire Continuous Samples on the right channel of the Audio In on the NI myDAQ. 
  • The sample rate MUST be the same as the playback rate, otherwise the sound will be played distorted.  The "Sound Output Write VI" will discard the dt from the waveform, forcing the samples to be played at the rate specified in the "Sound Output Configure VI". 
Systems Engineer
SISU

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.