07-13-2011 06:24 AM
Good Day:
I have an application where I need to access instruments at a remote location. Command/Control of the instruments is not a problem, but I also need to stream the audio present at the remote system's sound card thru the network connection. Any suggestions on how to accomplish this via LabWindows?
Thanks in advance for any replies.
-Ed
07-14-2011 06:22 PM
Hi edColeman,
Are you using LabWindows/CVI? If so, what version are you using?
Perry S.
07-14-2011 07:16 PM
Yes, I'm using labwindows CVI version 10...
-Ed
07-15-2011 05:55 PM
Hi edColeman,
What type of instrument are you communicating with? Can i have some details: model number, part number etc.? How are you communicating with it currently? Is it VISA communication? Can you communicate with it directly over TCP communication? Please let me know.
Regards,
Perry S.
07-15-2011 06:44 PM
Perry:
Thank you for your reply and your offer of help. My situation is this:
I plan to have a LabWindows application connected to an old RF receiver that is only controllable thru its RS232 port. In addition to controlling the receiver I would like to listen to and log the audio. Toward that end I have the audio output of the receiver routed into the sound card of the controlling computer. So far none of this is too difficult...the problem (at least as far as I am concerned) is that I need to be able to access this computer remotely thru my company's private network.
I don't think that the instrument control thru the network will be too much of an issue, what I'm struggling with is how to route the audio from the computer directly connected to the receiver back thru the network to the end user's computer.
I hope that explains my application clearly enough. Thanks again for your reply.
-Ed
07-18-2011 06:40 PM
Hi edColeman,
In CVI there are a few libraries that may be able to help you. There are the TCP library, the VISA library and the RS232 library that may have the functions that you would need. Please refer to the help files that accompany these functions. That would be a great starting point. Once you can connect to the machine via the network you should be able to get the data from it with no problem. The only issue that you will run into is the amount of data that you can read at the ports at one time. I hope that this helps.
Regards,
Perry S.
07-20-2011 10:01 AM
Hi Ed,
First, I was wondering, how do you get the audio from the sound card? Is it from a LabWindows program? I've never done that. Second, I was wondering how do you play the audio on the remote machine? Is that through a LabWindows program? I've never done that either.
But I was wondering if just a remote PC app would do the job. Like admins use to take over your PC from there desk and fix problems. I assume they have these that send the audio thru the net as well as the screen. Then on the radio's PC you just need a LabWindows program to control the radio and some other app to play sound from the sound card input to the local speaker. Then the remote PC app would magically transfer the screen and audio from the radio PC to the remote PC.
Otherwise, I can just say that to stream the audio thru the net, after the Radio's PC gets it off the sound card somehow, I would just set up two TCP servers on the remote PC, one for audio and one for the commands/control. When the remote PC client connects to the audio server the audio server would just start sending audio data to the client. The client would receive the data and put it in a big buffer to handle network speed variation. Let the buffer fill up to like a second or more worth of data before having anothe function/thread read the buffer data and give the data to the client PC's sound card. Big problem is that the client PC's sound card will alway's consume the data at a slightly different speed than the servers sound card produces it. Different clocks running at slightly different frequencies. So the client function that reads the audio buffer to give it to the sound card must play games. If the buffer is shrinking over time then it has to create extra samples to give to the sound card, just duplicating a sample every 100 samples or whatever. If the buffer is growing over time then it throws away a sample every 100 sample or whatever. So it's kind of a challenge to manage the buffer with the variable speed of the net transfering data and the two different rates of producing and consuming the audio data.
LabWindows has the TCP server create and client create functions so that's pretty easy. The harder part is that you probibly want to set the Radio's PC to a fixed IP address so that you can connect to it without worrying about domain names and such. Then the two TCP ports that the LabWindows uses for command and audio might need to be setup in all the routers to let you establish a connection. Your IT guy's can answer that.
PS. you can play around with this suff on one PC by using the RegisterTCPServerEx function and setting the local host address to "localhost", or "127.0.0.1" on one LabWindows project and using the corresponding ConnectToTCpServerEx with "NULL" as the server host name on another LabWindows project. This creates a virtual TCP connection on the same machine. This does not duplicate the different audio clock issue I talked about above.
07-21-2011 01:42 PM
cjm:
I don't currently have the program implemented, so I don't yet get the audio from the sound card. What I have done for recording audio files in other projects is to use the program "hdogg" (http://www.fridgesoft.de/harddiskogg.php) it is fairly old but functional. I've used this program's command line interface from within LabWindows to direct the computer's sound card input directly to MP3 files. I have to figure out how, instead of saving the audio to the hard drive - stream the audio to a network port. That was basically the root of my question. For my application, it looks as though simply using remote desktop to access the machine and sharing the remote audio will be the easiest solution.
Thanks for the reply.
-Ed