Skip to main content

Offline Rendering

About Offline Rendering

Offline rendering, also known as offline bouncing or exporting, is a process in audio programming where an audio recording or project is processed and rendered to a new audio file. This process can be done outside of real-time playback, which allows for more processing power and time to be devoted to rendering the audio.

Offline rendering is commonly used in audio production to create a final mix or master of a recording, where multiple tracks and effects are mixed together to create a stereo or multichannel audio file. During offline rendering, the audio processing is performed in real-time and then recorded to a new audio file.

Offline rendering can also be used for various other audio processing tasks, such as applying audio effects, normalizing audio levels, or converting audio file formats. Offline rendering can be done using various audio software applications, which often provide options for adjusting the processing parameters and settings used during rendering.

The benefits of offline rendering include the ability to use more processing power and time for audio processing, as well as the ability to render audio at higher quality than real-time playback. Additionally, offline rendering allows for the rendering of audio files in various formats, which can be useful for distribution or playback on different devices.

Using the OfflineGraphRenderer Class

You can process your AudioGraphs with the OfflineGraphRenderer class. This can be useful if you want to test out your graph and variables on multiple files, without the constraints of a realtime AudioPlayer/Recorder. For the moment, this is only available in C++.

Initialize the OfflineGraphRenderer instance and create your audio graph. In this example, it is a simple gain node with a gain of 0.5f (half volume).

This example uses an OfflineGraphRenderer to process an AudioGraph with a single GainNode.

import SwitchboardSDK

let graphRenderer = SBOfflineGraphRenderer()

let gainNode = SBGainNode()
gainNode.gain = 0.5

let graph = SBAudioGraph()
graph.connect(graph.inputNode, to: gainNode)
graph.connect(gainNode, to: graph.outputNode)

graphRenderer.sampleRate = 48000
graphRenderer.maxNumberOfSecondsToRender = 10.0

graphRenderer.processGraph(graph, withOutputFile: "output.mp3", withOutputFileCodec: .mp3)