Microsoft Windows CE 3.0  

Changing the Pitch and Playback Rate

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Some waveform audio I/O devices can vary the pitch and the playback rate of waveform audio data. As with other device capabilities, you can query your waveform audio I/O device by using the waveOutGetDevCapsfunction to determine if your device supports either of these capabilities.

The following table describes the functions that you can use to query and set the waveform audio pitch and playback rate.

Function Description
waveOutGetPitch Retrieves the pitch for the specified waveform audio output device
waveOutGetPlaybackRate Retrieves the playback rate for the specified waveform audio output device
waveOutSetPitch Sets the pitch for the specified waveform audio device
waveOutSetPlaybackRate Sets the playback rate for the specified waveform audio output device

These functions change the pitch and the playback rate by a factor that is specified with a fixed-point number that is packed into a DWORDvalue. The upper 16 bits specify the integer part of the number; the lower 16 bits specify the fractional part of the number. A value of 0x8000 in the low-order word represents one-half, and 0x4000 represents one-quarter. The following table shows three examples of this style of packaging.

Value Packaged value
1.5 0x00018000L
0.75 0x0000C000L
1.0 0x00010000L

A value of 1.0 means that the pitch or playback rate is unchanged.

Although changing the pitch and changing the playback rate seem similar to the user, they are implemented quite differently. Because the device driver controls the playback rate, altering the playback rate does not require any specialized hardware. However, the driver does not change the sample rate. Instead, the driver skips or synthesizes samples. For example, the driver could skip every other sample if an application changed the playback rate by a factor of two. In contrast, changing the pitch requires specialized hardware. When an application alters the pitch, the application does not alter specifically the playback or the sample rate.



 Last updated on Tuesday, May 18, 2004

© 2004 Microsoft Corporation. All rights reserved.