> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Interleave

> Interleave

# Interleave

This function interleaves audio samples so that all samples that correspond to a specified frame are contiguous.

## Syntax

```cpp theme={null}
void DSP::Interleave(  
         XMVECTOR* __restrict pOutput,  
         const XMVECTOR* __restrict pInput,  
         const size_t uChannelCount,  
         const size_t uFrameCount  
)  
```

### Parameters

*pOutput*   \_Out\_writes\_((uChannelCount \* uFrameCount) / 4)\
Type: XMVECTOR\* \_\_restrict

Caller-provided array of XMVECTOR elements that receives the samples in interleaved form. It cannot overlap *pInput*, and it must have at least (*uChannelCount* × *uFrameCount*) ÷ 4 elements.

*pInput*   \_In\_reads\_((uChannelCount \* uFrameCount) / 4)\
Type: XMVECTOR\* \_\_restrict

Caller-provided array of XMVECTOR elements that supplies audio samples in deinterleaved form. It cannot overlap *pOutput*, and it must have at least (*uChannelCount* × *uFrameCount*) ÷ 4 elements.

*uChannelCount*   \_In\_\
Type: size\_t

Number of channels contained in the data. *uChannelCount* must be greater than 1.

*uFrameCount*   \_In\_\
Type: size\_t

Number of frames of valid data. *uFrameCount* must be greater than 0.

### Return value

Type: void

None.

## Remarks

For example, the audio of the form \[LLLRRR] becomes \[LRLRLR]. For more information about Interleave classes and members, see [Interleave Class](https://learn.microsoft.com/previous-versions/microsoft-robotics/bb842567\(v%3Dmsdn.10\)). For information about the Deinterleave function, see [Deinterleave](/reference/audio/xdsp/functions/deinterleave).

## Requirements

**Header:** xdsp.h

**Supported platforms:** XBOX One family consoles and XBOX Series consoles

## See also

[xdsp](/reference/audio/xdsp/xdsp_members)

[Game for Windows and the DirectX SDK blog](https://walbourn.github.io/xdsp-h-digital-signal-processing-helper-functions/)

[Microsoft Audio/Video Interleaved](https://wiki.multimedia.cx/index.php/Microsoft_Audio/Video_Interleaved)


## Related topics

- [Deinterleave](/reference/audio/xdsp/functions/deinterleave.md)
- [SHAPE_DMA_CONTEXT](/reference/audio/shapedmacontext/structs/shape_dma_context.md)
- [SHAPE_FLOWGRAPH_DMA_COMMAND](/reference/audio/shapeflowgraph/structs/shape_flowgraph_dma_command.md)
