Solved

How to use Audio Compression Manager under C++

Posted on 1997-07-24
6
1,135 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

895 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

18 Experts available now in Live!

Get 1:1 Help Now