---
title: "setFormat(_:)"
framework: audiotoolbox
role: symbol
role_heading: Instance Method
path: "audiotoolbox/auaudiounitbus/setformat(_:)"
---

# setFormat(_:)

Sets the bus’s audio format.

## Declaration

```swift
func setFormat(_ format: AVAudioFormat) throws
```

## Parameters

- `format`: The desired audio format.

## Discussion

Discussion false if the operation failed. Discussion Audio units can generally be expected to support the AVAudioFormat standard format (deinterleaved 32-bit float), at any sample rate. Channel counts can be more complex. See the channelCapabilities reference for a more complete discussion. note: In Swift, this method returns Void and is marked with the throws keyword to indicate that it throws an error in cases of failure. You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in Error Handling in The Swift Programming Language and About Imported Cocoa Error Parameters.

## See Also

### Bus Methods and Properties

- [format](audiotoolbox/auaudiounitbus/format.md)
- [isEnabled](audiotoolbox/auaudiounitbus/isenabled.md)
- [name](audiotoolbox/auaudiounitbus/name.md)
- [index](audiotoolbox/auaudiounitbus/index.md)
- [busType](audiotoolbox/auaudiounitbus/bustype.md)
- [ownerAudioUnit](audiotoolbox/auaudiounitbus/owneraudiounit.md)
- [supportedChannelLayoutTags](audiotoolbox/auaudiounitbus/supportedchannellayouttags.md)
- [contextPresentationLatency](audiotoolbox/auaudiounitbus/contextpresentationlatency.md)
- [shouldAllocateBuffer](audiotoolbox/auaudiounitbus/shouldallocatebuffer.md)
