Solved

How to use Audio Compression Manager under C++

Posted on 1997-07-24
6
1,147 Views
Last Modified: 2013-12-03
I have serious problems with the Win32 ACM. I have to do the following tasks:
* record audio (PCM 11kHz, Mono, 8bit),
* compress this into TrueSpeech 1k/s (lowest format),
* send it over a netwotk,
* decompress it back to the original format,
* play sample.
The recording works. But how can I compress it using the Windows ACM functions into the TrueSpeech format? I achieved it to convert the sample to another PCM format but not to another audio codec. If you have some sample code that shows how to implement such a compression using C++ please send it to me.
Thanks in advance
Gregor Fleissner
0
Comment
Question by:Duebel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 200 total points
ID: 1401818
Video for Windows 1.1 DK comes with a sample: ACMApp. It can be used to convert between any format that ACM supports. Let me know your email address so that I can send it to you.
0
 

Author Comment

by:Duebel
ID: 1401819
Thanks a lot for your answer. After you mentinoed ACMApp I found this sample by my self inside the VC5 help.
0
 

Author Comment

by:Duebel
ID: 1401820
The ACMAPP sample is not that easy to read. Maybe you can help me.
I recorded sound in PCM 8kHz Mono 8bit format. Now I want to convert it into TrueSpeech (8kHz, 1bit, mono) format. Here is the code I I wrote but which didn't work:

++++++++++++++++++++++++++++++++
HACMSTREAM hACMStream;
WAVEFORMATEX wfx;
ACMSTREAMHEADER acmHeader;
DWORD dwSource, dwDest;
BYTE* pDestData;
      
wfx.nChannels=1;
wfx.wFormatTag=34;
wfx.wBitsPerSample=1;
wfx.nSamplesPerSec=8000;
wfx.nAvgBytesPerSec=1067;
wfx.nBlockAlign=32;
wfx.cbSize=32;
      
m_hr=acmStreamOpen(&hACMStream, NULL, &m_wfx, &wfx, NULL, 0, 0, 0);
dwSource=dwDest=GetLength();
m_hr=acmStreamSize(hACMStream, dwSource, &dwDest, ACM_STREAMSIZEF_SOURCE);

pDestData=(BYTE*)malloc(dwDest);

ZeroMemory(&acmHeader, sizeof(acmHeader));
acmHeader.cbStruct=sizeof(acmHeader);
acmHeader.pbSrc=(BYTE*)m_pData;
acmHeader.cbSrcLength=dwSource;
acmHeader.cbSrcLengthUsed=dwSource;
acmHeader.pbDst=pDestData;
acmHeader.cbDstLength=dwDest;
      
m_hr=acmStreamPrepareHeader(hACMStream, &acmHeader, 0);
m_hr=acmStreamConvert(hACMStream, &acmHeader, 0);
++++++++++++++++++++++++++++++++

The acmOpenStream function fails with error 512 (ACMERR_NOTPOSSIBLE). What is not correct here?
Please help me.
Thanks
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 23

Expert Comment

by:chensu
ID: 1401821
First, use ACMApp to convert a PCM 8kHz Mono 8bit format file to a TrueSpeech 8kHz 1bit mono format file so as to make sure ACM supports this sort of conversion. Second, make sure the two formats (WAVEFORMATEX) are correct. (Since wfx.cbSize=32, you should define WAVEFORMATEX + 32 bytes variable BYTE wavefmt[sizeof(WAVEFORMATEX) + 32], I think.) Third, try applying the flags ACM_STREAMOPENF_NONREALTIME and ACM_STREAMOPENF_ASYNC with a callback function.
0
 

Author Comment

by:Duebel
ID: 1401822
Thank you very very much. The problem was the size and the not specified ACM_STREAMOPENF_NONREALTIME flag. Now it works great.
0
 

Expert Comment

by:ambition
ID: 2785237
Can you sent me a sample code?I want to
built a VioceEmail progame,need your help!
Thank you!
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to estimate memory and number of CPU for an ASP.NET Application 13 36
Best book to learn C++ 4 87
windbg taking it's time 32 100
Recommendation vb6 to vb.net or others 14 202
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

740 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