# ChangeScorePitchBend

### Synopsis

`Err ChangeScorePitchBend( ScoreContext *scon,int32 Channel, int32 Bend )`

### Description

This function changes the current MIDI pitch bend value used to alter the pitch values of all instruments in the channel. The function is the equivalent of a MIDI Pitch Bend message.

The Bend argument ranges from 0x0 to 0x3FFF. A setting of 0x2000 means that instrument pitch values aren't bent up or down. A setting of 0x0 means that instrument pitches are bent as far down as possible. A setting of 0x3FFF means that instrument pitches are bent as far up as possible.

The pitch bend value supplied by `ChangeScorePitchBend()` works within a pitch bend range, which is contained in the score context. If the range is 8 semitones, for example, the score voices can be bent up a maximum of 8 semitones or down a minimum of 8 semitones. You can set the pitch bend range using `SetScoreBendRange()` and read the current pitch bend range using `GetScoreBendRange()`.

Note that `ChangeScorePitchBend()` only affects notes whose pitches are specified by MIDI note values (0127). It doesn't affect the pitch of notes specified by frequency.

### Arguments

ScoreCon
  Pointer to a ScoreContext data structure controlling playback.

Channel
  The number of the MIDI channel for which to change the pitch bend value.

Bend
  The new pitch bend setting (0x00x3FFF).

### Return Value

This function returns 0 if successful or an error code (a negative value) if an error occurs.

### Implementation

Library call implemented in music.lib V21.

### Associated Files

score.h, music.lib

### Caveats

Pitch can't be bent beyond the range of the instrument.

### See Also

``ChangeScoreControl`(), ChangeScoreProgram(), ConvertPitchBend(), GetScoreBendRange(), InterpretMIDIMessage(), StartScoreNote(), SetScoreBendRange()`