Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to use Audio Compression Manager under C++

Posted on 1997-07-24
6
Medium Priority
?
1,174 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 800 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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 tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
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 Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
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…

927 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