# Replace a node in an AudioProcessorGraph?

**URL:** <https://forum.juce.com/t/replace-a-node-in-an-audioprocessorgraph/8969>\
**Category:** General JUCE discussion\
**Created:** [July 15, 2012, 3:16pm UTC](https://forum.juce.com/t/replace-a-node-in-an-audioprocessorgraph/8969 "2012-07-15T15:16:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rory](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/rory/32/534_2.png) [@rory](https://forum.juce.com/u/rory)\
**Post date:** [July 15, 2012, 3:16pm UTC](https://forum.juce.com/t/replace-a-node-in-an-audioprocessorgraph/8969/1 "2012-07-15T15:16:15Z")

</div>

Does anyone know of an eloquent (and quick) way to replace a node in an AudioProcessorGraph. In my graph I would like to replace one node with a new filter but I don’t want to lose all the connections. I want the new filter to be positioned in the same place in the graph as the previous one, with the same connections. Any suggestions?

---

<div class="post-metadata">

**Author:** ![TheVinn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/thevinn/32/806_2.png) [@TheVinn](https://forum.juce.com/u/TheVinn)\
**Post date:** [July 15, 2012, 4:39pm UTC](https://forum.juce.com/t/replace-a-node-in-an-audioprocessorgraph/8969/2 "2012-07-15T16:39:48Z")

</div>

You could implement a “wrapper” node that forwards it to a pointer to a filter, and expose a member that lets you change the filter.

---

<div class="post-metadata">

**Author:** ![rory](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/rory/32/534_2.png) [@rory](https://forum.juce.com/u/rory)\
**Post date:** [July 15, 2012, 6:13pm UTC](https://forum.juce.com/t/replace-a-node-in-an-audioprocessorgraph/8969/3 "2012-07-15T18:13:31Z")

</div>

Thanks, good thinking. In the end I was able to do it by taking a copy of the existing graph as xml, then remove my filter, add a new one with the same ID and reconnect where necessary. Works pretty well, but your approach might be a better option in the long run.
