Solved

Compressing Streams

Posted on 1999-01-08
8
295 Views
Last Modified: 2010-04-06
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
Comment
Question by:peimbert
8 Comments
 

Author Comment

by:peimbert
ID: 1355455
Edited text of question
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1355456
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
 

Expert Comment

by:qdyoung
ID: 1355457
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
 
LVL 7

Expert Comment

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


0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Expert Comment

by:jpdupont
ID: 1355459
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
 

Author Comment

by:peimbert
ID: 1355460
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
 

Author Comment

by:peimbert
ID: 1355461
jpdupont, Since your answer was the best, please post an answer.

Regards,

Nadia
0
 

Accepted Solution

by:
jpdupont earned 100 total points
ID: 1355462
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now