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.
- Swift
- Kotlin
- C++
- JSON
- JavaScript
import SwitchboardSDK
let graphRenderer = SBOfflineGraphRenderer()
let gainNode = SBGainNode()
gainNode.gain = 0.5
let graph = SBAudioGraph()
graph.addNode(gainNode)
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)
import com.synervoz.switchboard.sdk.Codec
import com.synervoz.switchboard.sdk.audiograph.AudioGraph
import com.synervoz.switchboard.sdk.audiograph.OfflineGraphRenderer
import com.synervoz.switchboard.sdk.audiographnodes.GainNode
val graphRenderer = OfflineGraphRenderer()
val gainNode = GainNode()
gainNode.gain = 0.5
val graph = AudioGraph()
graph.addNode(gainNode)
graph.connect(graph.inputNode, gainNode)
graph.connect(gainNode, graph.outputNode)
graphRenderer.setSampleRate(48000)
graphRenderer.setMaxNumberOfSecondsToRender(10.0)
graphRenderer.processGraph(graph, "output.mp3", Codec.MP3)
OfflineGraphRenderer graphRenderer;
graphRenderer.setMaxNumberOfSecondsToRender(5.0); // Max 5 secs of audio will be processed.
graphRenderer.setSampleRate(48000); // The graph's processing sample rate.
graphRenderer.setBufferDurationMs(10); // 10ms buffers will be used to process the graph
GainNode gainNode;
gainNode.setGain(0.5f);
AudioGraph graph;
graph.addNode(gainNode);
graph.connect(graph.getInputNode(), gainNode);
graph.connect(gainNode, graph.getOutputNode());
graphRenderer.processGraph(
graph, // Your graph to process
"input_file.mp3", // Input file name
switchboard::Codec::Mp3, // Input codec
"output_file.ogg", // Output file name
switchboard::Codec::Vorbis, // Output codec
);
Coming soon...
Coming soon...