10-07-2020 07:14 PM
Hello all,
I am interested in designing a Labview VI to read the audio from mono two channels and subtract their amplitudes in real-time to make a rudimentary noise cancelling program.
I own an AUDIGY 5/Rx SoundBlaster Card that fits into my desktop computer PCI slot. I have successfully read audio from one channel at a time, however I have been unable to read from more than one channel at a time simultaneously. The card has two mono inputs and line-in input. Are there any reference designs that you know of that include reading the real-time audio from two channels of the same soundcard simultaneously?
I have been unsuccessful in finding anything or making a VI that is capable of reading multiple audio inputs at the same time. If desirable I can include my attempted VI program if its worth looking at.
If it is not possible to read from two inputs on the same card simultaneously (in real time) due to either motherboard constraints, LabView software constraints, or AUDIGY soundcard constraints, is it possible to read one audio input from a soundcard and a secondary audio input from the microphone jack input on the desktop computer/ motherboard? Is the easier way using two separate/individual soundcards? Or is there a solution that does not include using a secondary soundcard.
Attached is a picture of the design I have already tested successfully, however it is only for one input. I have also attached pictures of the two unsuccessful attempts at reading more than one channel from the same soundcard. I want this design to include the ability to read more than one input simultaneously and in real time.
I am open to any suggestions/advice/ideas you might have. thank you for your help
This is the successful one -reading only one channel
this one was unsuccessful at reading multiple channels from the same soundcard
this one was also unsuccessful at reading multiple channels from the same soundcard
10-07-2020 10:00 PM
That sounds like a lot of fun! Unfortunately, I haven't had enough experience with LabVIEW in that regard, but I hope someone here does. I'm very eager to learn about this kind of stuff, myself. 🙂
10-08-2020 11:14 AM
Welcome to the LabVIEW Forums.
Please attach the relevant VIs to your Post. If you are working in the context of a LabVIEW Project, then all of the VIs are probably in a folder with the Project File (.lvproj), and you can just compress this folder and attach the resulting .ZIP file.
Having VIs lets us see much more clearly what you are trying to do, and gives us something with which to "play around" and see if we can get something to work. Needless to say, if you "share" with us, we'll "share" our findings with you.
Bob Schor
10-08-2020 11:35 AM
None of the LabVIEW sound input VIs are reentrant, meaning only one copy can be run at a time. Even if you made them reentrant, there's a good chance the DLL they're calling also would be usable by only one thread at a time.
My best guess is that you'll have to go outside of LabVIEW's standard audio VIs for this. Either look into solutions provided by other languages running under LabVIEW via ActiveX, .NET, Python, etc. or you'll need to use alternate hardware (like figuring out how to route your sound capture to multichannel DAQ cards, for instance).
10-08-2020 12:42 PM
Without seeing actual code, as opposed to fuzzy pictures of code, I can't explain why the OP was unable to acquire sound in stereo. The LabVIEW Sound Input VIs are designed for two-channel acquisition. If you put two of these "stereo input" VIs (or, worse, Express VIs) together, then it is likely you will not get a satisfactory acquisition, but the functions themselves (properly configured, and working alone) should work just fine for Stereo recording.
Bob Schor
10-08-2020 02:26 PM
I'll definitely look into using activeX blocks, like python and c sharp. thanks for the advice
attached is a zip file containing the 3 labview VIs above. They are not part of larger labview project. Sorry for the delay in getting these posted.
Would it be conceivably possible to use the two mono inputs as a stereo input and then subsequently split the channels when they come in the after the audio read input block using a signal splitter block?
thank you for the fast replies and all your help
10-09-2020 08:07 AM
Wow. There's a lot you haven't told us, including that you are running on a Mac!
If you are acquiring sound information from two monaural sources (say, two microphones), one plugged into (say) the "left" channel of your (single) sound card, the other into the "right" channel, then you should be able to acquire them simultaneously by doing a single Acquire Sound function specifying a 2-channel input.
I dislike Express VIs, especially those that use the confusing and obscuring "Dynamic Data Wire" (the wire that looks like little black-and-white rectangles stuck together). Use the Configure and Read functions (as you did in Unsuccessful1), and just "do it once".
Can you clarify -- are you actually acquiring two monaural sounds simultaneously by plugging them into the Left and Right input channels of your Sound Card? If so, you only need a single "2-channel" Configure/Read VI to get both simultaneously.
Bob Schor
10-09-2020 05:56 PM
I noticed that in the last image, you have set each of the configurations to have 2 channels. Try setting them each to be 1 channel.
10-13-2020 02:04 PM - edited 10-13-2020 02:07 PM
Thank you all for the advice and help.
Bob, to clarify, I am using my mac laptop to post the question but a windows desktop computer (that is not mine) to run and test the VIs with a soundcard. My setup is quite unnecessarily complex (and stupid).
That is correct in what I want to do. essentially I have two channels that monaural that I want to use as totally separated inputs. To clarify, to set up a two channel input I changed the '1' to a '2' in the configuration block. attached is a picture of the said change and the VI file.
what would you advise using/doing to separate the two channels after they come in on the acquire sound? would you advise using a split channel block? If not what blocks would you advise using? -thank you
To answer your question: Yes, I am acquiring two sound inputs from two separate mono channels, however they are not strictly named 'left' and 'right', attached is a picture from the datasheet illustrating that. If the image is too blurry or not clear I have also attached the whole data sheet as a pdf, the figure and table I'm referring to is on page 3.
Also Paul, I did try that, and unfortunately, it still did not work. Thanks for the advice though.
10-14-2020 07:42 AM
Plug your two sound sources into your one sound card, one into "Left" (let's call this Channel 0) and one into "Right" (let's call this Channel 1). Configure your (single) Sound Input function to accept signals from 2 Channels. Acquire 2-channel sound. LabVIEW should give you a 1D Array of Waveforms -- this should be an Array of size 2, representing Channel 0 and Channel 1. Use Index Array to separate these into two monaural sound waveforms.
Problem solved.
Bob Schor