Solved

Audio compression.

Posted on 2004-05-01
12
378 Views
Last Modified: 2007-12-19
Hi.
I am recording voice with waveInWrite() in PCM format. I want to compress it. I tried to compress with ACM but it works with few formats, gives low compression and bad quality. Can someone suggest me what to do? May be I should find some other codecs to work with ACM or may be there is something else besides ACM?
0
Comment
Question by:Buffon
12 Comments
 
LVL 22

Expert Comment

by:grg99
Comment Utility
You need to carefully make a request to get a better codec loaded.
See the code at msdn about how to use ICOpen().



0
 
LVL 1

Accepted Solution

by:
instruo earned 100 total points
Comment Utility
Speex is the best codec I've found.  try these links (though the first one was down when I tried...  probably just temporary)

www.speex.org
http://www.republika.pl/roed/speexw/
0
 
LVL 3

Expert Comment

by:RJSoft
Comment Utility
Your not considering Ogg Vorbis or Mp3?

RJ
0
 
LVL 11

Author Comment

by:Buffon
Comment Utility
Mpeg Layer 3 I cannot record with waveInWrite, Ogg Vorbis I still didnt tried.
0
 
LVL 3

Expert Comment

by:RJSoft
Comment Utility
Well actually you can record with waveInWrite but then transform your pcm wave buffer to mp3 with lame. You use lame to transform the data buffer you record to an mp3 format.

Me I have not done it that way yet as it was easier to save the buffer as a wav file and then use lame.exe to convert it to mp3. I simply call ShellExecute to lame.exe with parametors. "open","lame.exe","xxx.wav"...

But the user is left with a largish wav file.

I have seen some links to the lame.dll and I believe the whole source code is out there for lame to create your own dll. So you could concievably modify the dll code to accept your wave buffer and translate it. (Modifying the file reading function of lame and set the stream to an input handle to your buffer).

I dont believe you can get much support from lame developer I think he dropped the project.

Ogg Vorbis is supposed to be better. But it is not main stream.

RJ
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 11

Author Comment

by:Buffon
Comment Utility
Can you tell me more about this "lame"? I am not familiar with it. Thanks.
0
 
LVL 3

Expert Comment

by:RJSoft
Comment Utility
lame = lame aint mp3 encoder.

lame was created to encode wav files to mp3.

The lame.exe
http://www.trudyholler.com/pages/download_razorlame.html
The lame source
http://lame.sourceforge.net/

Do a search for mp3 lame for more info

RJ
0
 
LVL 3

Expert Comment

by:RJSoft
Comment Utility
I dont understand your selection of an answer. The author of this question was obviously interested in using lame.

Is speex have better or equal compression as mp3 or Ogg? Or was your selection based on some other criteria? If so please explain.

RJ
0
 
LVL 11

Author Comment

by:Buffon
Comment Utility
With speex I get a good enough quality and good compression. And I can compress PCM to speex with ACM.
To mp3 or Ogg I didnt succeed to convert. So the one who advised to me about speex gets the points.
0
 
LVL 3

Expert Comment

by:RJSoft
Comment Utility
Buffon;

My apology. I thought the admin issued the points.

Out of curiosity, are you creating some kind of text to speech application or something similar?

I started to work on a text to speech application and got it to work using some of the libraries for Windows 98.

But I ran into problems trying to make one that worked on Windows 98 and XP. I could not get the XP version to work. Not sure if I had the correct libraries.

I never got arround to solving that one because some humongus download stopped me from going further. I believe I had the option of getting the CD from microsoft.

I cant exactly remember now cause it was a while back but I think it was the TTS sdk or something. I think I left off at trying to find the necessary files without downloading the whole thing.

Another thing related that I am having serious problem finding solution to is my wave editor program.

Using waveOut-waveIn low level api, I am able to record, save, pause, stop, add effects (reverb, echo, chorus, volume and, pitch) play a wav file. But after I save the file I would like to be able to edit the file.

So I need to be able to obtain a handle to the buffer and display it graphically. I need some kind of indicator of the current position when the wav file is playing. So that I can stop at that position and modify that area of the buffer.

I sorta got the graphical representation of the wav file. I found some link to another info site where the author speaks of a type of file that he creates a smaller representation of the wave file info by averaging. But it was not really a wav editor app it was just an explanation of how to represent a wav graphically.

The main problem is I do not know how to obtain current position using the waveIn or waveOut functions. I have been wondering if I should do this with mciSendString ??

Anyway if you have any ideals what I am talking about let me know.
If not my apologies.

Thanks
RJ
0
 
LVL 11

Author Comment

by:Buffon
Comment Utility
No problem at all. I am sorry, I am not working on text to speech, but on VoIP. Good luck anyway.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

771 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

10 Experts available now in Live!

Get 1:1 Help Now