hi
Did anybody try to transfer voice over the internet? If somebody have some good source code of working with sound, could you please share?
Thanx.
Posted on 2003-07-28 08:37:31 by masnick[CCCP]
If you are fine with using a library use Speex :)

http://www.speex.org/
http://www.speex.org/projects.html
Posted on 2003-07-28 08:44:21 by bazik
Thanx, i'll look at that.
Posted on 2003-07-28 10:42:54 by masnick[CCCP]
Does anybody know what is the best solution of transfering sound over internet? For example the one they use in NetMeeting, Yahoo Messenger. Do they just send chunks of sound or they send stream. And how do they do it?
Posted on 2003-07-28 11:08:08 by masnick[CCCP]
I solved this problem.
Just get chunks of sound using Wave APIs then use ACM APIs (Microsoft Audio Compression Manager) to compress those chunks, and just use simple winsock connection to transfer it to another end over internet, where it gets uncompressed and sended to sound card.
One of the best compressors to use is GSM or TrueSpeech.
Posted on 2003-07-28 18:46:20 by masnick[CCCP]
Im interested in your project. Sounds fun. Keep us (or me) informed if you dont mind :alright:

:NaN:
Posted on 2003-07-28 23:40:20 by NaN
If somebody worked with ACM, i need some help, since there are some problems with buffer when you decompress. And thanx again to Bazik for that link. I think that's the compression i'm going to use, since it has all needed features: compression and decompression samples, VAD (Voice Activity Detection to save bandwidth). I hope it will work perfectly.
Posted on 2003-07-29 08:17:05 by masnick[CCCP]
"]
If somebody worked with ACM, i need some help, since there are some problems with buffer when you decompress.


I think miracle and/or Maverick did some work with that.

"]
And thanx again to Bazik for that link.


No problem :) Speex is also the best codec available for that purpose right now (as you see on the comparsion). And its free :)
Posted on 2003-07-29 08:26:47 by bazik
Bazik, does speex have .dll some where?
Posted on 2003-07-29 08:54:32 by masnick[CCCP]
Can anybody share .dll of speex?
Posted on 2003-07-29 09:01:55 by masnick[CCCP]
"]
Bazik, does speex have .dll some where?


Either you have to build it from the source code or ask on the mailing list for a dll version.
Posted on 2003-07-29 09:02:36 by bazik
I did! But need urgently! Boss is waiting!
Posted on 2003-07-29 09:10:09 by comrade

Im interested in your project. Sounds fun. Keep us (or me) informed if you dont mind :alright:

:NaN:


Here is I think our working build. :)
It is in Visual Basic. Started in FASM, but no include files for mmsystem, so moved to VB. :)
Our whole project for remote store control is in Visual Basic. So far we have live stream using WMP control from WM encoder on server. But its 10-second delay. So we need realtime audio (two-way) and real-time video (probably will be pushed JPEGs from server, thanks Scronty).
Posted on 2003-07-29 09:12:27 by comrade
Here is also some other test we did. Its in C, records from microphone, encodes to MP3 and plays back. Aborted since haven't found practical way to programmatically decode separate MP3 chunks. :(
Posted on 2003-07-29 09:17:05 by comrade
Also, we have problem with sound skipping. When transferring sound over LAN with 4096 chunks, we get skips but are not as very serious (not as noticeable). But when actually going through Internet it skips a lot. In inner loop of playing (while waiting for chunk to play), it check for new data that arrived, and queues it up with recursive call. But that still does not eliminate skipping. I think now problem is with sender (recorder), it encodes in a single-loop and sends out once buffer is full. But how to make it send while recording? Tricky to do multi-threading in Visual Basic... and waveInStart() seems to be a blocking, synchronous call.
Posted on 2003-07-29 09:22:33 by comrade
Here is a new version of our proggy. I added ther ACM compression. Took me a while, since I had some problem with buffer. Some guy had similar to this and wanted hundreds dollars for source code, bastard Texas capitalist wouldn't give for free. Here is our, very similar in functionality. DSP gives 1:16 compression, but sound still skips though. I think sender problem.
Posted on 2003-07-29 11:40:37 by masnick[CCCP]
"]
Here is a new version of our proggy. I added ther ACM compression. Took me a while, since I had some problem with buffer. Some guy had similar to this and wanted hundreds dollars for source code, bastard Texas capitalist wouldn't give for free. Here is our, very similar in functionality. DSP gives 1:16 compression, but sound still skips though. I think sender problem.


Actually, one method to get rid of the sound skips is to lower your chunk sizes. One method is to have a cyclic fifo buffer for the data, where your input stream is being compressed and packed for output, while in the background all "ready" packets go out and any incoming come in. Not sure how you actually did do the transfer work, but if you're using VB, cheat a little, toss the internet transfers on a timer. (It's naughty, but it's "get by-able". A cheap way of multi-threading with severe limitations.)

The main reason your sound skips is your large buffer size, perhaps monitor buffer transmission times and auto-adjust out packet sizes accordingly.



You're bottlenecks for the program are as follows:

:eek: Single buffers for fifo, if your transmission is stalled for any reason, you'll get a blank spot, reasons for these follow.
:eek: Use of ReDim, avoid at all costs. This is the worst idea when dealing with buffers, typically build a buffer in memory and chunk off of it, the ws.SendData is the wrong method here, you can't specify your total data count with it.
:eek: No static buffers means memory chopping at an alarming rate, which will put an overhead strain on overall system performance.

:alright: Recommendations, don't use the ws.GetData or ws.SendData, instead use the API calls to the Wsock32.dll directly:

Declare Function Send Lib "wsock32.dll" Alias "send" (ByVal s As Long, buf As Any, ByVal buflen As Long, ByVal flags As Long) As Long
Declare Function recv Lib "wsock32.dll" (ByVal s As Long, buf As Any, ByVal buflen As Long, ByVal flags As Long) As Long

Those will let you actually specify how much data is going either way to your buffers (letting you make static buffer space, even chop it up into segments for a cyclic fifo method to cut down on process interferences). You could allocate 64k of ram, break it into 4 in and 4 out buffers, and 32k of it for the audio compress/decompress areas, 16k for each should be fine, doubt your smaller packet sizes will generate data that large, but if they do, go larger. When your program is done, you're merely getting rid of 1 larger memory chunk, no ReDims that cause a memory flush and allocate each time you do it. It'll make the program faster, smoother and won't chunk memory up.
Posted on 2003-07-30 13:08:03 by FunkyMeister
Thanks very much.
Posted on 2003-07-30 14:43:29 by comrade
FunkyMeister, do you think it's possible to make similar program for video? Cause we tried to research but didn't find a lod.
Posted on 2003-07-31 09:53:23 by masnick[CCCP]
"]
FunkyMeister, do you think it's possible to make similar program for video? Cause we tried to research but didn't find a lod.


Look around for resources on "VFW" (Video For Windows), there should be examples for reading a "camera device" and using it to also display. Probably resources for that.

You'll really need to do cyclic buffering a lot for those, as you'll cause massive studdering if you have your transmission and reception of audio and video buried in your normal routines (they need to be off on another thread).

With respect to your WINSOCK issues, go to www.allapi.net and download their last offering of it if it's still there, has all of the Winsock API there AND examples. This is a VB aimed site.
Posted on 2003-07-31 10:35:16 by FunkyMeister