Solved

How to use Audio Compression Manager under C++

Posted on 1997-07-24
6
1,156 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

615 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