---
title: SpeakBuffer
framework: Application Services
role: symbol
role_heading: Function
platforms: [macOS 10.0+]
path: applicationservices/1552252-speakbuffer
---

# SpeakBuffer

Speaks a buffer of text, using certain flags to controlspeech behavior.

## Declaration

```occ
OSErr SpeakBuffer(SpeechChannel chan, const void *textBuf, unsigned long textBytes, SInt32 controlFlags);
```

## Parameters

- `chan`: The speech channel through which speech is to be spoken.
- `textBuf`: A pointer to the first byte of text to spoken.
- `textBytes`: The number of bytes of text to spoken.
- `controlFlags`: Control flags to customize speech behavior.

## Return Value

A resultcode. See [Result Codes](speech_synthesis_manager.md).

## Discussion

The `SpeakBuffer` functionbehaves identically to the `SpeakText` function,but allows control of several speech parameters by setting valuesof the `controlFlags` parameter.The `controlFlags` parameterrelies on specific constants, which may be applied additively. See [Control Flags Constants](1552213-control_flags_constants.md).

Each constant specifies a flag bit of the `controlFlags` parameter,so by passing the constants additively you can enable multiple capabilitiesof `SpeakBuffer`. If youpass `0` in the `controlFlags` parameter, `SpeakBuffer` worksjust like `SpeakText`.By passing `kNoEndingProsody + kNoSpeechInterrupt` inthe `controlFlags` parameter, `SpeakBuffer` workslike `SpeakText` exceptthat the `kNoEndingProsody` and `kNoSpeechInterrupt` features havebeen selected. Future versions of the Speech Synthesis Manager maydefine additional constants. 

When the `controlFlags` parameteris set to `0`, `SpeakBuffer` behavesidentically to `SpeakText`. 

## See Also

### Starting, Stopping, and Pausing Speech

- [ContinueSpeech](1462728-continuespeech.md)
- [PauseSpeechAt](1461174-pausespeechat.md)
- [SpeakString](1552250-speakstring.md)
- [SpeakCFString](1461621-speakcfstring.md)
- [SpeakText](1552236-speaktext.md)
- [StopSpeech](1462745-stopspeech.md)
- [StopSpeechAt](1459780-stopspeechat.md)
