# HOA Technical Notes - B-Format Rotation

Once you have a B-Format audio stream, it's possible to manipulate it in various ways. For instance, you can rotate it using matrix multiplication. This moves all material in the soundfield.

## Conventions

This page includes second order rotation matrices for FuMa-encoded B-Format for each of the three axes (X, Y and Z) given a rotation angle. It's possible to form other rotations by combining these. These are left-hand-side matrices (and so should be applied as `out[t]=matrix*in[t]`

).

These rotations are sometimes known as "rotate" (Z), "tilt" (X) and "tumble" (Y) in the Ambisonic literature, or "yaw" (Z), "pitch" (Y) and "roll" (X).

For first order rotation, just use the top left corner four-by-four matrix. For higher order rotations, we recommend converting to N3D and rotating using that format.

For rotations at up to third order, you can use the TOA Rotation plugin from the TOA Core VST plugin library.

## X Axis Rotation ("Roll")

This rotates around the X (front/back) axis. This is sometimes known as "tilt" in the Ambisonic literature.

W In | X In | Y In | Z In | R In | S In | T In | U In | V In | |
---|---|---|---|---|---|---|---|---|---|

W Out | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |

X Out | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |

Y Out | 0 | 0 | cos(a) | -sin(a) | 0 | 0 | 0 | 0 | 0 |

Z Out | 0 | 0 | sin(a) | cos(a) | 0 | 0 | 0 | 0 | 0 |

R Out | 0 | 0 | 0 | 0 | (3/4)cos(2a)+(1/4) | 0 | (3/4)sin(2a) | (3/8)cos(2a)-(3/8) | 0 |

S Out | 0 | 0 | 0 | 0 | 0 | cos(a) | 0 | 0 | sin(a) |

T Out | 0 | 0 | 0 | 0 | -sin(2a) | 0 | cos(2a) | -(1/2)sin(2a) | 0 |

U Out | 0 | 0 | 0 | 0 | (1/2)cos(2a)-(1/2) | 0 | (1/2)sin(2a) | (1/4)cos(2a)+(3/4) | 0 |

V Out | 0 | 0 | 0 | 0 | 0 | -sin(a) | 0 | 0 | cos(a) |

## Y Axis Rotation ("Pitch")

This rotates around the Y (left/right) axis. This is sometimes known as "tumble" in the Ambisonic literature.

W In | X In | Y In | Z In | R In | S In | T In | U In | V In | |
---|---|---|---|---|---|---|---|---|---|

W Out | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |

X Out | 0 | cos(a) | 0 | -sin(a) | 0 | 0 | 0 | 0 | 0 |

Y Out | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |

Z Out | 0 | sin(a) | 0 | cos(a) | 0 | 0 | 0 | 0 | 0 |

R Out | 0 | 0 | 0 | 0 | (3/4)cos(2a)+(1/4) | (3/4)sin(2a) | 0 | (3/8)-(3/8)cos(2a) | 0 |

S Out | 0 | 0 | 0 | 0 | -sin(2a) | cos(2a) | 0 | (1/2)sin(2a) | 0 |

T Out | 0 | 0 | 0 | 0 | 0 | 0 | cos(a) | 0 | sin(a) |

U Out | 0 | 0 | 0 | 0 | (1/2)-(1/2)cos(2a) | -(1/2)sin(2a) | 0 | (1/4)cos(2a)+(3/4) | 0 |

V Out | 0 | 0 | 0 | 0 | 0 | 0 | -sin(a) | 0 | cos(a) |

## Z Axis Rotation ("Yaw")

This rotates around the Z (up/down) axis, i.e. horizontally. This is sometimes known as "rotate" in the Ambisonic literature.

W In | X In | Y In | Z In | R In | S In | T In | U In | V In | |
---|---|---|---|---|---|---|---|---|---|

W Out | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |

X Out | 0 | cos(a) | -sin(a) | 0 | 0 | 0 | 0 | 0 | 0 |

Y Out | 0 | sin(a) | cos(a) | 0 | 0 | 0 | 0 | 0 | 0 |

Z Out | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |

R Out | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |

S Out | 0 | 0 | 0 | 0 | 0 | cos(a) | -sin(a) | 0 | 0 |

T Out | 0 | 0 | 0 | 0 | 0 | sin(a) | cos(a) | 0 | 0 |

U Out | 0 | 0 | 0 | 0 | 0 | 0 | 0 | cos(2a) | -sin(2a) |

V Out | 0 | 0 | 0 | 0 | 0 | 0 | 0 | sin(2a) | cos(2a) |