Changing the Pitch and Playback Rate

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

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

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 playback rates by a factor specified with a fixed-point number packed into a DWORD value. The upper 16 bits specify the integer part of the number; the lower 16 bits specify the fractional part. 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 the pitch or playback rate is unchanged.

Although changing the pitch and changing the playback rate seem similar for 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 specifically alter the playback or sample rate.