# How to create streaming instances of FMOD Events in code

**URL:** https://qa.fmod.com/t/how-to-create-streaming-instances-of-fmod-events-in-code/12519
**Category:** FMOD Studio
**Created:** [June 6, 2016, 7:03pm UTC](https://qa.fmod.com/t/how-to-create-streaming-instances-of-fmod-events-in-code/12519 "2016-06-06T19:03:15Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![metaphysician](https://avatars.discourse-cdn.com/v4/letter/m/edb3f5/32.png) [@metaphysician](https://qa.fmod.com/u/metaphysician)
#### Post date: [June 6, 2016, 7:03pm UTC](https://qa.fmod.com/t/how-to-create-streaming-instances-of-fmod-events-in-code/12519/1 "2016-06-06T19:03:15Z")

</div>

hi folks! i’m not sure i’ve seen this exact situation come up…

i was wondering if there’s a way to set the output of a particular event in the API so that it comes out as a stream independent of the global mixer? this may be a low level API question. the developer wants the ability to access each event in a separate data stream - in effect to ‘record’ the event onto a timeline but not to mix it globally.

the other option is to be able to instance FMOD Studio’s output separately so that each global instance is a separate stream that can be recorded. either method would be fine. any help appreciated! this is through Xcode for an iOS app.

---

<div class="post-metadata">

### Author: ![graeme](https://avatars.discourse-cdn.com/v4/letter/g/50afbb/32.png) [@graeme](https://qa.fmod.com/u/graeme)
#### Post date: [June 9, 2016, 8:07am UTC](https://qa.fmod.com/t/how-to-create-streaming-instances-of-fmod-events-in-code/12519/2 "2016-06-09T08:07:35Z")

</div>

The Studio API does not provide a way to reroute the output of events at runtime. Are you looking to write an event’s output to a wav file? If so, I think you’ll need to write a custom DSP.

The API documentation has an introduction to FMOD’s DSP plugin SDK…  
[http://www.fmod.org/documentation/#content/generated/overview/plugin\_api\_dsp.html](http://www.fmod.org/documentation/#content/generated/overview/plugin_api_dsp.html)

The Low Level API installer also comes with several code examples of how to write a custom DSP…  
[http://www.fmod.org/download/fmodstudio/api/iOS/fmodstudioapi10804ios-installer.dmg](http://www.fmod.org/download/fmodstudio/api/iOS/fmodstudioapi10804ios-installer.dmg)

There’s an Xcode workspace under “FMOD Programmers API/api/lowlevel/examples/xcode32”. Take a look at the “dsp\_custom” example.

The “examples/plugins” directory contains more examples of custom DSP code. These are the source to some real-world DSP effects that are used in Studio.

Hopefully that’s enough for you to get started on making a custom DSP that writes its incoming signal to a file, and then passes silence to its output.

The next step would be registering your DSP, creating an instance, then attaching it to the ChannelGroup head of a playing event. That will involve a few calls to the Low Level API. The steps would go something like this:

(1) Obtain the low level System object with Studio::System::getLowLevelSystem().  
(2) Register your DSP with System::registerDSP().  
(3) Create an instance of your DSP with System::createDSPByPlugin().  
(4) Retrieve the ChannelGroup of a playing event with Studio::EventInstance::getChannelGroup().  
(5) Attach the DSP to the head of the ChannelGroup with ChannelGroup::addDSP().

Some API documentation links…  
[http://www.fmod.org/documentation/#content/generated/FMOD\_Studio\_System\_GetLowLevelSystem.html](http://www.fmod.org/documentation/#content/generated/FMOD_Studio_System_GetLowLevelSystem.html)  
[http://www.fmod.org/documentation/#content/generated/FMOD\_System\_RegisterDSP.html](http://www.fmod.org/documentation/#content/generated/FMOD_System_RegisterDSP.html)  
[http://www.fmod.org/documentation/#content/generated/FMOD\_System\_CreateDSPByPlugin.html](http://www.fmod.org/documentation/#content/generated/FMOD_System_CreateDSPByPlugin.html)  
[http://www.fmod.org/documentation/#content/generated/FMOD\_Studio\_EventInstance\_GetChannelGroup.html](http://www.fmod.org/documentation/#content/generated/FMOD_Studio_EventInstance_GetChannelGroup.html)  
[http://www.fmod.org/documentation/#content/generated/FMOD\_ChannelGroup\_AddDSP.html](http://www.fmod.org/documentation/#content/generated/FMOD_ChannelGroup_AddDSP.html)

Please take particular note of the remarks section for Studio::EventInstance::getChannelGroup, which describes a bunch of caveats that are involved in manipulating the internal ChannelGroup of an event instance.

So yeah, this stuff is not exactly for the faint-hearted. Feel free to yell if you need more help.

Lastly, I’m actually not sure if I correctly interpreted your original question. If I got it wrong, please disregard all of the above. 😉
