473,382 Members | 1,238 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Problem recording audio in mu-law with MCI

I have written a simple application that uses the MCI functions to record
audio to a file. It works fine with PCM audio (tried both
44.1kHz/16bit/stereo and 8kHz/8bit/mono). However, when I try to use
mu-law, I get a MCIERR_OUTOFRANGE error when sending the MCI_SET command.
Here is what I did:

----- start code snippet -----

MCI_WAVE_SET_PARMS wavset;
ZeroMemory(&wavset, sizeof(MCI_WAVE_SET_PARMS));

wavset.wFormatTag = WAVE_FORMAT_MULAW; // was WAVE_FORMAT_PCM
wavset.nSamplesPerSec = 8000;
wavset.wBitsPerSample = 8;
wavset.nChannels = 1;
wavset.nBlockAlign = (wavset.wBitsPerSample/8) * wavset.nChannels;
wavset.nAvgBytesPerSec = wavset.nBlockAlign * wavset.nSamplesPerSec;

DWORD dwError = mciSendCommand(wDeviceID, MCI_SET,
MCI_WAIT |
MCI_WAVE_SET_AVGBYTESPERSEC |
MCI_WAVE_SET_BITSPERSAMPLE |
MCI_WAVE_SET_BLOCKALIGN |
MCI_WAVE_SET_CHANNELS |
MCI_WAVE_SET_FORMATTAG |
MCI_WAVE_SET_SAMPLESPERSEC,
(DWORD)(LPMCI_WAVE_SET_PARMS)&wavset);

// dwError is MCIERR_OUTOFRANGE, but no error when using WAVE_FORMAT_PCM
// above.

----- end code snippet -----

Do I need to fill out other members of MCI_WAVE_SET_PARMS for non-PCM audio,
or is it simply not possible to capture audio and save it as mu-law
directly?
Regards,
Michael Lee

Nov 17 '05 #1
0 1475

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Sugapablo | last post by:
I had an idea for something that I can't find any evidence if it exists, or if it can be done. I assume it can be done. What I'd like to be able to do, is to allow people who come to my website,...
2
by: lrandolph | last post by:
Is there a way to allow a user to record a sound file from javascript or html? We need to be able to record and convert to binary to send via XML. If possible, we'd like this to be a server side...
7
by: psk | last post by:
Hi, I need to read live audio from microphone and somehow make data packets from it and send using my client-server implementation where it will be played. Can anyone tell me abt any...
0
by: June Li | last post by:
H I got a problem with detecting sound card with Windows xp I am working on an application to test microphone. First I need detect if there is a sound card installed (or integrated audio...
1
by: Sakharam Phapale | last post by:
Hi All, I am developing an application like sound recorder. While recording if there is a silence for more than given time (say 5 seconds), Recording should be paused.
4
by: =?Utf-8?B?Um9zaGFuIFIuRA==?= | last post by:
Hi All, I am new to C# programming; I am developing an application for recording audio data using voice modem. I am using HyperTerminal to manually process audio data. The modem when configured...
0
by: universe | last post by:
I am developing a web application in that I need to record audio, for that I am importing "winmm.dll" and using mciExecute function.(the following code is vb.net). If I have posted in irrelavent...
2
by: tiffxi | last post by:
I'm an ASP.NET newbie. I'm trying to write an audio-recording code in an ASP.Net page. I created a windows User Control that has the buttons and codes for this (it calls the winmm.dll in system32...
4
by: vijaypatidar | last post by:
hi i am using flash action script 3 for streaming video and audio via web cam and mice to flash media server.as all know that flash uses nellymoser audio codec for recording audio. i want to convert...
1
by: waqasahmed996 | last post by:
Hi to all, i want to ask that is audio recording is possible in flash. actually i want to make recording from browser. is that possible in flash. if yes please give me some help or send me some...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.