# Bind variable to channel?

**URL:** <https://forum.csound.com/t/bind-variable-to-channel/1489>\
**Category:** Newbies\
**Created:** [January 2, 2024, 5:41am UTC](https://forum.csound.com/t/bind-variable-to-channel/1489 "2024-01-02T05:41:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lo94](https://forum.csound.com/user_avatar/forum.csound.com/lo94/32/242_2.png) [@lo94](https://forum.csound.com/u/lo94)\
**Post date:** [January 2, 2024, 5:41am UTC](https://forum.csound.com/t/bind-variable-to-channel/1489/1 "2024-01-02T05:41:58Z")

</div>

Hey all,

Was just curious if there is an efficient way to bind a variable to a channel so it automatically updates on change or if this has to be explicitly handled via checking with opcodes like `changed` and `changed2`

---

<div class="post-metadata">

**Author:** ![tarmo](https://forum.csound.com/letter_avatar_proxy/v4/letter/t/c37758/32.png) [@tarmo](https://forum.csound.com/u/tarmo)\
**Post date:** [January 2, 2024, 9:22am UTC](https://forum.csound.com/t/bind-variable-to-channel/1489/2 "2024-01-02T09:22:06Z")

</div>

Hi!

There is chn\_export that binds global variable to named channel. Very useful.

Tarmo

T, 2. jaanuar 2024 07:52 lo94 via The Csound Community \<[noreply@forum.csound.com](mailto:noreply@forum.csound.com)\> kirjutas:

---

<div class="post-metadata">

**Author:** ![lo94](https://forum.csound.com/user_avatar/forum.csound.com/lo94/32/242_2.png) [@lo94](https://forum.csound.com/u/lo94)\
**Post date:** [January 2, 2024, 2:37pm UTC](https://forum.csound.com/t/bind-variable-to-channel/1489/3 "2024-01-02T14:37:52Z")

</div>

Oh very cool! Does that opcode run on initialization pass and will it run if placed inside an instrument?

Also, if you happen to know, is chnexport what Cabbage uses for its widgets to bind to channels?

---

<div class="post-metadata">

**Author:** ![tarmo](https://forum.csound.com/letter_avatar_proxy/v4/letter/t/c37758/32.png) [@tarmo](https://forum.csound.com/u/tarmo)\
**Post date:** [January 2, 2024, 3:21pm UTC](https://forum.csound.com/t/bind-variable-to-channel/1489/4 "2024-01-02T15:21:28Z")

</div>

Hi!

I tried on Cabbage, yes input from the widget works, displaying value from the global value did not (maybe I did something wrong). Here is a minimal example:

tarmo
