[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 314
  • Last Modified:

Compressing Streams

Hi,

I saved the contents of a WAV file in a TMemoryStream.  I need to send this stream via tcp/ip, but it's too big!

Is there any way to compress the stream and decompress it once it gets to the client?

Thanx,

Nadia!
0
peimbert
Asked:
peimbert
1 Solution
 
peimbertAuthor Commented:
Edited text of question
0
 
MadshiCommented:
Hmmm. Compressing wav files is difficult (look at http://www.experts-exchange.com/Q.10114383 for this theme, the question is still open).
How about splitting the wav file into several packets?

Regards, Madshi.
0
 
qdyoungCommented:
As what was discussed in Q.10114383, binary compressors provide only about 15% compression. But if you think that it suits your need. Than it's easy. Delphi3 already provide ZLib.pas. ZLIB came with Delphi 3.0 professional, located in the "extras" directory on the CD. You can visit http://www.radix.net/~bziegler/Delphi/Source.html and download remotecontrol.zip for a good example of how to compress TMemoryStream using the ZLib functions. This example compresses bitmap then send the stream via TCP/IP.

Regards, Young.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
jcondeCommented:
Uh..hmm, 15% doesn't seem much, especially when talking about transmitting "Many" streams through the net.


0
 
jpdupontCommented:
I use TLZRW1 component with memory/file streams.
The component had an option "uses streams".
Compression is very good (like zip files).
==
TLZRW1 file compression component.
Visual feedback on a Panel if so desired.
VCL code by D. Heijl
==
See on DSP/Torry.
Create the component at run time and set visible:=false  because
this is a visual component - panel descendant.

Jean-Pol
0
 
peimbertAuthor Commented:
Your answer is not that bad, but when you want to transmit in a NRT manner, 15% is not that good !!!

I tried using ZLib as you stated, as well as the component proposed by  jpdupont and jpdupont's answer is much better....The compression rate is very good (almost as ZIP format) and the quality mantains (Human ear can detect from 20Hz to 20,000Hz) and only variation occurred beyond the 50,000 Hz.

Thank you very much anyway.
0
 
peimbertAuthor Commented:
jpdupont, Since your answer was the best, please post an answer.

Regards,

Nadia
0
 
jpdupontCommented:
Try the TLZRW1 component.
See comment :

"I use TLZRW1 component with memory/file streams.
The component had an option "uses streams".
Compression is very good (like zip files).
==
TLZRW1 file compression component.
Visual feedback on a Panel if so desired.
VCL code by D. Heijl
==
See on DSP/Torry.
Create the component at run time and set visible:=false  because
this is a visual component - panel descendant."

Jean-Pol

0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now