?
Solved

WAV Compression

Posted on 1998-08-02
3
Medium Priority
?
844 Views
Last Modified: 2013-12-03
I used this call to open a MM handle for sample recording

WAVEFORMATEX wINEX;
WAVEIN wIN;

   wINEX.wFormatTag = WAVE_FORMAT_PCM;
      wINEX.nChannels = 2;
      wINEX.nSamplesPerSec = 16000;
      wINEX.wBitsPerSample = 8; //  8,16
      wINEX.nBlockAlign = (wINEX.wBitsPerSample * wINEX.nChannels) / 8;
      wINEX.nAvgBytesPerSec = wINEX.nSamplesPerSec * wINEX.nBlockAlign;
      wINEX.cbSize = 0;

      f = waveInOpen(
                  &wIN,
                  WAVE_MAPPER,
                  &wINEX,
                  (unsigned long)waveInProc,
                  0,
                  CALLBACK_FUNCTION);

I decided to use ADPCM for a better compression , but if I select WAVE_FORMAT_ADPCM to wFormatTag , the waveInOpen returns an error code : 32 . What's happening ?

And of course , if you have a suggestion for a better compression , tell me .

Thanks
0
Comment
Question by:WxW
[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
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 30 total points
ID: 1412917
You need to set the WAVEFORMATEX properly. For example,

// Format Tag: WAVE_FORMAT_ADPCM
// Channels: 1
// Samples Per Second: 11,025
// Avg Bytes Per Second: 5,666
// Block Alignment: 256
// Bits Per Sample: 4
// Extra Format Information: 32 bytes
// Offset Data Bytes
   0xF4, 0x01, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00,
   0x00, 0x02, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00,
   0xC0, 0x00, 0x40, 0x00, 0xF0, 0x00, 0x00, 0x00,
   0xCC, 0x01, 0x30, 0xFF, 0x88, 0x01, 0x18, 0xFF

You may use an utility to convert a PCM wave file to an ADPCM wave file. Then, use the RiffWalk utility (it comes with the Platform SDK) to see its header information.

0
 
LVL 6

Author Comment

by:WxW
ID: 1412918
Thanks chensu . But tell me . 1st. How I calculate the variables of WAVEFORMATEX because when specifying for example 8000 hz , it is not working . 2nd From where I get the extra bytes values ?
0
 
LVL 23

Expert Comment

by:chensu
ID: 1412919
You can find the specification in MSDN Library on MSDN CDs or online (http://www.microsoft.com/msdn).

Microsoft Developer Network\Tools and Technologies\Multimedia Standards Update\New Multimedia\Document\Data Types and Data Techniques\New WAVE Types
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

770 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