Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mciSendString

Status
Not open for further replies.

JurkMonkey

Programmer
Joined
Nov 23, 2004
Messages
1,731
Location
CA
Hey,

I have an audio device which I'm trying to set the bitrate on. So I've been using the following command:

Code:
sCommand = "set " + m_DeviceAlias + " time format ms tempo 60 bitspersample 8 channels " + sampleChannels + " samplespersec " + sampleRate + " format tag pcm";

			rc = mciSendString(sCommand, null, 0, IntPtr.Zero);

my sampleChannels = 2 (Stereo) and my sampleRate = 44100. I want to drop it down to 22050 but it gives me an error.

MCI errmsg: The driver cannot recognize the specified command parameter.

Any ideas?
 
Ok. Turns out, Tempo can't be used on .wav files. Tempo is supposed to be used on MIDI.

Now my problem is this: my counter goes waaaaay too fast. I need to drop the counter speed down.
 
Finally figured out the timer thing.

You have to set bytespersec and use the following formula:

(samplesPerSecond * bitsPerSecond * (channels / 2)) / 8

(44100 * 16 * (1/2)) / 8 CD Quality Mono
(22050 * 16 * (2/2)) / 8 Radio Quality Stereo
(11025 * 8 * (2/2)) / 8 Telephone Quality Stereo

In case anyone else runs into this problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top