Skip to main content

Making Some Noise

Let's explore how the Switchboard SDK can be used by building a simple audio app.

To get started, create an iOS, Android project and integrate the Switchboard SDK. Please follow the integration steps on these pages. Once you have an app that you can build and run, add the following class to your project.

You can also create a C++ app and use the different nodes in C++, where you have to take care of getting the audio in and out of the audio graph in the process method.

"nodes": {
{ "id": "noiseGeneratorNode", "type": "WhiteNoiseGeneratorNode" },
{ "id": "gainNode", "type": "GainNode" }
"connections": {
{ "sourceNode": "noiseGeneratorNode", "destinationNode": "gainNode" },
{ "sourceNode": "gainNode", "destinationNode": "outputNode" }

After the above code is added, initialize the MyAudioEngine class in a place where it would get called (e.g. the main view controller or activity or main function). After this change, you should hear some generated white noise when you run the app.

The implemented audio engine class can be depicted by the following diagram:

This is what happens in this example:

  • An AudioGraph is created that comes with a built-in output node.
  • Two other nodes are created (noise generator and gain nodes) that are added to the audio graph.
  • The noise generator's output is connected to the gain node's input. The gain node's output is connected to the output node's input.
  • The gain value of the gain node is set to 0.5, which is going to reduce the volume of the generated noise.
  • An AudioEngine is created which starts running the constructed AudioGraph instance.

Generating noise is this simple. For some more real-world examples check out our other examples here.