Solved

How to use Audio Compression Manager under C++

Posted on 1997-07-24
6
1,130 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

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

Join & Write a Comment

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
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…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

707 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