LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I transfer a sound file via TCP?

I have a .wav file that I'm trying transfer via TCP.  Using LV 8.5, I modified the "Sound File to Output.vi" example to send the data across a TCP connection to a client vi.  But, I've encountered numerous errors along the way with trying to convert the sound data which is a  1-D array of waveform double.  I've attached my server and client VI, but essentially, what I tried to do is break down the array into the y and dt components, send those over the TCP connection, rebuild the waveform client-side, and then play the waveform.  Is there something I'm missing?  Do I need the timestamp information as well and send that over too?  Please let me know how this can be accomplished.  Thanks!
Download All
0 Kudos
Message 1 of 35
(5,147 Views)
The first thing you need to do is change your constant of 100 to 4. The next thing you need to do is to put some reasonable timeout value on the TCP/IP functions, rather than the default of 25 seconds. Also, using the Play Waveform Express VI will result in choppy sound. You should use the sound functions on the client side.
0 Kudos
Message 2 of 35
(5,132 Views)
What do you mean by "use the sound functions on the client side"?
0 Kudos
Message 3 of 35
(5,128 Views)
Use the same type of sound functions that you're using for the server code.
0 Kudos
Message 4 of 35
(5,126 Views)
So after I transfer the data over, put it back into a waveform and then send that to a "Sound Output Write.vi"?
 
If this is the case, then do I need the time stamp information within the 1-D double waveform?  How do I get that out of the array?
0 Kudos
Message 5 of 35
(5,121 Views)
It doesn't matter. In fact, the dt parameter doesn't matter either. The only thing the Sound Output Write uses is the 1D array of data, so that's the only part you actually need to send.
0 Kudos
Message 6 of 35
(5,104 Views)
Really?  Then why does the read sound.vi output such a more complex data type then (1-D array double waveform)?
0 Kudos
Message 7 of 35
(5,101 Views)
So that you can plot it just like you're doing. Smiley Wink

If you open the Sound Output Write you will see that only the 1D array is being extracted and passed on into a DLL.
0 Kudos
Message 8 of 35
(5,099 Views)
One thing to clarify: While the Sound Output Write does not need the dt information, the dt information wouold be required when you use the Configure VI in order to set up the rate.  However, you only need to send that parameter once. Thus, it would seem to me that you want to change your client code so that it checks to see if it receives a special command or something to indicate the start of a new song that may have been sampled at a different rate. If this is the case, then you can reconfigure the sound output. Otherwise, all that you're listening for is just song data that you send along to the Sound Output Write.
0 Kudos
Message 9 of 35
(5,090 Views)
I see, well I've successfully sent over the y data, and it hooks up to the sound output write.vs fine except for there's a small red dot where the wire connects to the subvi block.  What does that indicate?
 
Also, it requires a task ID.  Should I send over the same task ID from the server or just create a new task ID client side?
0 Kudos
Message 10 of 35
(5,078 Views)