08-11-2014 09:22 AM
... and yes, you can configure the DAC's voltage range after you configure it in the Task, but there is absolutely no reason (that I can think of) why you would want to do this. As I explained, the voltage range should be set for the DAC and whatever is connected to its output, which shouldn't be a "variable" (for example, you do not want to use this as a "volume control" -- if you want to vary the amplitude of the output sound, put a scaler in the loop between getting the value from the .wav file and sending the number to the DAC card, remembering you are dealing with 16-bit values and may "lose bits" by scaling.
BS
08-11-2014 09:50 AM
Do you think you could provide an example of "put a scalar in the loop between getting the value from the .wav file and sending the number to the DAC card"?
I feel like this got really complicated, really fast. My basic question: is there a way to use a "volume control" for an analog output signal that is read from a wav file.
08-11-2014 11:28 AM
Here is a very simple Volume Control for an array (.wav In) coming from reading I16 values from a .wav file. I represented "Volume" as a Knob control on my Front Panel, with values ranging from 0 to 10 (if you are a fan of the movie "This is Spinal Tap", you'll probably want to make the Volume Control go to 11), with the output converted to an I16 that you would send to your DAC.
I explicitly showed converting the integer input signal to Dbl, which is needed for the multiplication. If you omit it, it will "do it anyway" and show you this by putting a red "coercion dot" on the I16 input to the multiply function. This isn't an "error", but more a "warning" that data conversion is taking place. It becomes more important on the output end, as the conversion back to a 16-bit integer can "clip" the signal. For example, suppose your .wav value is 4000 (about 12% of full scale), and you set the volume to 10. The multiplication would give 40000, but the conversion would "max out" at 32767, so anything that large or larger would have the same output signal being generated.
08-11-2014 02:20 PM
Thank you for your patience. I am now just trying to make my program as simple as possible just to see if it works. I have done what you said but the "volume" button/knob is something I have never seen before. When I try to run it, the program stops and says there are 2 different dt values
08-11-2014 02:23 PM
08-11-2014 02:36 PM
I just did the default control (left click on input of subvi and did create --> control). Anyway, I did a normal double numerical control and the vi seems to work fine now. However, I can never get my daq to output the voltage. In NI MAX I can run a continuous task and it outputs it on my analog voltage output. However, I guess I am just really bad at using daqmx because I can not use the subvi's the correct way.
08-11-2014 02:47 PM
Read this excellent NI White Paper on DAQmx. Also you should do a Google Search on DAQmx White Paper and read some of the Basic papers. While you are at it, look for the "Introduction to LabVIEW" tutorials. It's a good idea (and cuts down on Responder Frustration) to know a little bit more than you do before tackling a project such as this ...
BS
P.S. -- when you read and understand more about DAQmx, you'll be able to fix your code, probably.