09-01-2010 11:34 AM
Hi all,
Been stuck at trying to figure out how to write/output at specific locations in an analog out buffer (seems like a simple task). I've set up a very simple test VI to play a sound file made up of consecutive 0.1s chunks of 500Hz and 5000Hz. The daqmx write offset option should be able to point to where the writing should take place so as to play just the 500Hz or 5000Hz tone.
The ultimate aim is to be able to control two analog outputs. Since the two outputs cannot be controlled independently in Labview hardware, our main VI will produce a trigger that will specify the offset locations to write from. We'll have a stereo wave file such that if we want to produce a sound in one analog out channel, the other channel will just play zeros in the 2nd column of the wave file (play nothing). The offset pointer will allow us to do the reverse (sound in one channel, zeros in another) when the wavefile is played from another offset.
Appreciate any help and comments on how exactly to place the daqmx write offset property. I'm using the PCIe 6251 board that should be able to set this offset property when task is running.
Thanks.
FA
09-03-2010 05:05 PM
Hi FA,
I wanted to take a step back and discuss your application from a high level. Can you clarify why you are unable to control two outputs simultaneously? There is only one analog output timing engine on the 6251for hardware timing; however, you do not have any timing configured in your VI hence you are performing software timed output. If you proceed with software timing, then there should be no issues outputting two both channels. If you decide to use a hardware timed output, then you can output different signals on two channels but at the same rate. The 6251 is a member of the M Series family. Information about its output is described in the analog output section of this manual and is worth a review. An alternative to writing to a buffer position may be creating a case structure that is selected by your trigger or a control on the front panel.
09-06-2010 12:57 PM
Hi h_Baker,
Happy Labor Day!
Really appreciate the help, but I think it wasn’t clear what I was hoping to do. I’ll be more concrete now. I have a VI that samples the singing of two birds independently. It’s done very quickly with input buffer of 5ms. I would then give each bird a white noise jam depending on whether its pitch within the 5ms buffer was below or above a threshold. The VI works fine on 1 bird and my task is now to scale it up to monitor two birds in parallel within one VI.
The issue I’m encountering is to output noise jam in one analog out channel for example for bird 1, while the other output channel for bird 2 does not do anything. But I understand that labview’s hardware cannot do this. The other channel for bird 2 cannot remain ‘silent’, but must instead play a waveform of zeros to create silence in the other channel, so that the other bird does not hear anything. Another issue is that the while loop to monitor the bird’s song and to produce a Boolean true for my counter is very quick (5ms), so my tasks to produce the white noise jam are placed outside the while loop (I tried placing the task inside; the VI runs but will just freeze and not do anything not even sample the inputs).
I’ve been trying to solve this problem for weeks without much success, and would appreciate your help. I tried implementing your case selector idea for a task (“white noise jam”) with two analog output channels. The idea is that I have 3 different stereo sound files. One stereo file has all zeros (all silence) as default when no bird is to be jammed. The second file has column 1 with white noise and column 2 with zeros (silence). When bird 1 should get jammed, I will use this waveform so that AO0 will play the white noise, while AO1 plays zeros. The third file is reversed: has zeros (silence) in column 1 for AO0, and white noise in column 2 for AO1, and should be played when bird 2 should get jammed.
I’m attaching the VI for any advice. The while loop has lots of stuff to monitor the song, but if you do a ctrl+f for COMMENT, I’ve placed comments where necessary to solve this output issue. The problem I am having is that the correct jamming on the correct channels depends on the initial value of variable “trigger”. If I set it to 1 when I start the VI, all jamming output from both bird’s singing will be to AO0, and if I set if to 2 when I stat the VI, all the outputs will instead be from AO1. I am not sure what’s going on. I suspect it’s due to the fact that my jamming task is outside the while loop and the initialization affects the output channel set?
Thanks.
FA
09-09-2010 01:25 PM - edited 09-09-2010 01:28 PM
How did you configure the "white noise jam" task?
Ali M
Applications Engineer
National Instruments
09-13-2010 12:45 PM
Continuous sampling at 44.1k Hz with buffer 4.41k samples. It uses the external clock ctr01internal output, rising edge. I used NI-Max to configure all these instead of doing it in the VI (this itself may be a problem?).
FA
09-14-2010 07:35 PM - edited 09-14-2010 07:38 PM
Hello FA,
It was more to understand what information was being used by the VI. I would recommend evaluating the VI in smaller segments. As earlier suggested by Heather, have you been able to output data to the correct hardware channels e.g. using the simple example provided? or array constants? If so, please review the ouput segment and work with a single channel using array constants for your data or even a single case first, observe the data (by using probes or indicators); then add more accordingly to narrow down the issue
Best regards,
Ali M
Applications Engineer
National Instruments