LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read all in buffer sound input

I'm using LV 8.6

 

I have some marian marc8 midi sound cards that I want to use for inuopt and ouput.  I'm having trouble fully understanding the capability of the sound input/output functions that come with LV.  i was going to test this with a fixed input signal but i thought i would ask the forum to save some time.  i've been up and down the forum and i can't find any p[osts on this subject.

 

1) if you config sound input to be N Hz, and the card can do that, do you get that exact rate. - I am used to using NI DAQ cards and some rates do not come exact so i want to confirm that the sampling rate that comes out of Sound Input Read is an actual value not just a copy of the number you enter into the config function.

 

2)  is there any way to just read all the pioints left in the buffer?  If I'm doing continuous acquisition, are values accumulating in the buffer between reads or is the read function waiting each time for data to accumulate and in between calls data is being lost?  Experimenting with the functions I'm getting worried that the latter is happening.  

 

I hope these questions are not easily answered in the manuals or code.  I looked at examples etc. and I still don't understand if these fucntion work like the DAQ functions.  It sounds like sound input is not double buffered but does that mean that it's not possible to take continuous data if you can call the read function fast enough?

 

thanks.

 

0 Kudos
Message 1 of 15
(5,476 Views)
Hi I am just now working with sound card input. Therefore I have made this very quick and dirty VI for personal evaluation. I have simply Stolen code from the "Acquire sound" express vi and the "continuous sound input.vi" example vi. Take a look at it. It may help you some. 


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 2 of 15
(5,464 Views)

thanks.  i guess i need to put a high freq sin wav in and check to see if there are jumps in it to test the continuous input. 

 

your test code is nice.  i like the function that pulls the name of the sound card etc.  where did you find this?  i have a lot of trouble finding labview examples that get to this depth.  especially for the sound card functions. on the boards i sawe a way to get this info but it was not using built in functions like you have.  can you let me know how you discovered the library function "lvsound2 and the funtions (like "SounDeviceInfo" contained within?

 

thanks again! let me know what you find out in your experiments.

 

-evren

0 Kudos
Message 3 of 15
(5,449 Views)

Hi Evren

Finding the undocumented sound functions was not so hard. I was poking around in the sound functions. Then I tested the "Acquire Sound" Express VI. If you insert this Express VI and double click on it you will see a familiar frontpanel. The configuration part for the "Acquire Sound" is located here

"\LabVIEW 8.6\vi.lib\sound2\_SoundAcquireConfig.llb>Configure SoundAcquire.vi" I am not a fan of Express VIs, but here I found many golden nuggets. I also found a Visa good link here http://forums.ni.com/ni/board/message?board.id=170&message.id=383016&query.id=504589#M383016. So now I have good software control for the sound card. I am working with a skin conductance system. I need 2 AD channels and a stereo sound output. By using a USB sound card I get 24 bit 96KHz  AD and DA for 99$. Not bad 🙂

Ps. I am using an AC voltage, and a 3 electrode system for the skin conductance measurement, so the sound card 20-20Khz bandwidth do not bother me at all

Message Edited by t06afre on 02-18-2009 12:49 PM


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 4 of 15
(5,432 Views)

Hi t06afre!

 

I'm very interested in the "Sound inpit quick and dirty.vi (39 KB)"

But i'm running on a LW 8.5 and cannot open it.

If you have the chance to 'recompile' to 8.5 i would very much appreciate it.

 

Many thanks!

0 Kudos
Message 5 of 15
(5,287 Views)
Here it is. I saved it to a previous version so more people can use it.
Vince M
Applications Engineer
0 Kudos
Message 6 of 15
(5,256 Views)

I will also add this

 

Message Edited by t06afre on 04-04-2009 12:18 PM


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 7 of 15
(5,233 Views)

t06afre et al,

 

Thanks you are the best! 🙂

 

I'm trying to modify it so you can change the input device after the VI runs and then when finished with the selection use another OK button to go to the main while loop.

 

Pls see enclosed modifyed vi.

 

However if i do not change the input device the new OK button works fine, but if i change the input device suddenly the is no response trying to klick on the new OK button?

 

When highlighting the Execution i can see that the program loops around the new OK button in th while loop as expected,but for some reason there is no response of the new OK button in the Front panel?

 

What could be wrong?

 

Many thanks!

0 Kudos
Message 8 of 15
(5,139 Views)
It is hard for me to say what needs to be done because I haven't followed the full process of what this VI accomplishes but it looks like the code that is not in a while loop may need to be in a sequence structure because everything in that code that does not have a data dependency executes before the first while loop is done. (aka before the user presses the first OK button.)
Vince M
Applications Engineer
0 Kudos
Message 9 of 15
(5,121 Views)

Hi Vince and happy easter 🙂

 

You might be right  but as you probably noticed my LW knowledge is limited but i'm very interested to learn.

 

I did some more experimenting and if i removed the main while loop (pls find enclosed vi) the Front panel works as expected (or at least as i would expect) and do not freeze any more when changing the Device input. 

 

However i would of course like to keep the preview main loop to test the soundcard.

 

As usual any input is very welcome!

0 Kudos
Message 10 of 15
(5,080 Views)