I'm trying to build a script to toggle the text on a specific button to show muted vs unmuted. So, I want to identify the button that needs to be changed. However, I can't seem to log the ID of the bu
Title
I'm trying to build a script to toggle the text on a specific button to show muted vs unmuted. So, I want to identify the button that needs to be changed. However, I can't seem to log the ID of the button. So, I tried a straightforward "Hello World" style message for the log file, but that didn't show up either. So, I'm trying to get clarity on whether this issue is specific to my installation of SF (just updated to 5.10.5 after having this problem in 5.10.3) or if this is universal and expected.
What do you expect to happen when you run the script/macro?
I'm trying to test the log feature for debugging.
Are you seeing an error?
What happens when you run this script?
In the log file, I only see that a streamdeck performed a KeyDown on the button I pressed.
How were you running this script?
I used a Stream Deck button
How important is this issue to you?
4
Details
{ "inputExpected": "I'm trying to test the log feature for debugging.", "inputIsError": false, "inputWhatHappens": "In the log file, I only see that a streamdeck performed a KeyDown on the button I pressed. ", "inputHowRun": { "key": "-MpfwmPg-2Sb-HxHQAff", "title": "I used a Stream Deck button" }, "inputImportance": 4, "inputTitle": "I'm trying to build a script to toggle the text on a specific button to show muted vs unmuted. So, I want to identify the button that needs to be changed. However, I can't seem to log the ID of the button. So, I tried a straightforward \"Hello World\" style message for the log file, but that didn't show up either. So, I'm trying to get clarity on whether this issue is specific to my installation of SF (just updated to 5.10.5 after having this problem in 5.10.3) or if this is universal and expected." }
Source
function main() {
sf.log("Test: Hello from SoundFlow 5.10.5!");
}
Links
User UID: eOvXIbHdqydWBO69NJkdlsIguhj1
Feedback Key: sffeedback:eOvXIbHdqydWBO69NJkdlsIguhj1:-ORxnsB8UnE4ZxjhJZYZ
Feedback ZIP: CxA9tB9p9sEe836iTP7Jfz8rDT896UAEhwpo9PAP02zbZhDZuw7o1sjviaxJPkSybu53qkDMDIE/WHU5s06+kt03Y5+9vxHn3uINJQlvOCy+uoxxqifNiUJlRnNquZXg9rzg1KssS6SDoO1NvlKA8o2jweD7sO9l2XpUrqdtkWClS35DW1kyv/Sk7wT+LaBNrX8oOeKu85l2Hfq7A9LwB7cJaqZhUimbZAJNGhZCqHVURHMlA6wTTPw7O5hUQQiiA5K4DhBPbvWR+fUqaLGSkkw4E1B6RSq2a5QfVAhX72PaAW8idyhSrlQ4y1S5fGBtJ/IJxE8Hc+hjzjj1JISwxXR/Mk46La2vuXGqbZC4DE4=
- JIn reply toJosh_Morales⬆:Josh Morales @Josh_Morales
function main() { log("Test: Hello from SoundFlow 5.10.5!"); }
this also doesn't seem to work as expected.
- OOwen Granich-Young @Owen_Granich_Young
You can, but you need to call the fucntion.
function main() { log("Test: Hello from SoundFlow 5.10.5!"); } main()
- JJosh Morales @Josh_Morales
Does main() not work in soundflow like traditional java? Isn't it meant to call all necessary functions required?
- OOwen Granich-Young @Owen_Granich_Young
I'm afraid I don't know boss, I learned Java in SF, but yeah you need to call any function for it to work is my understanding. Named main or anything else.
- JJosh Morales @Josh_Morales
Just reread what you had said. I was definitely not calling the function! Thank you!
Chad Wahlbrink @Chad2025-06-12 13:43:02.774Z
Hi @Josh_Morales,
This is a quick follow-up. SoundFlow scripts use JavaScript, which does not treat
main()
as a special or reserved function like Java. In JavaScript,main()
is just a normal function name, and nothing will run unless explicitly called.
- JIn reply toJosh_Morales⬆:Josh Morales @Josh_Morales
log("Test: Hello from SoundFlow 5.10.5!")
This did output to the log file... Can we not use the log object in a function?
- JIn reply toJosh_Morales⬆:Josh Morales @Josh_Morales
To show some of what I'm eventually going for:
function main(){ sf.osc.sendMessage({ host: '127.0.0.1', port: 9006, oscAddress: '/SPHERE/inputA_Mute', arguments: [ { type: 'Int', value: 1, }, ] }); }
This above script does not work, but the script below does:
sf.osc.sendMessage({ host: '127.0.0.1', port: 9006, oscAddress: '/SPHERE/inputA_Mute', arguments: [ { type: 'Int', value: 1, }, ] });
Why does the script only work outside of a function?
- JJosh Morales @Josh_Morales
I completely removed Soundflow and performed a clean install, as far as I can tell. I hunted down all pref files and miscellaneous bits and deleted before the fresh install. Nothing has changed in terms of behavior...
- In reply toJosh_Morales⬆:
Chris Shaw @Chris_Shaw2025-06-06 18:59:42.164Z
As @Owen_Granich_Young pointed out, you need to call the function after you've defined / declared it.
I the first script you just need to add:main()
after line 13.- JJosh Morales @Josh_Morales
Thanks! I actually did end up calling the function properly after double checking Owen’s comment. Big oversight on my part. However, some objects that I would expect still don’t seem to be recognized by SF, specifically context. Is that somehow disabled in the implementation of Java used within SF?
- JIn reply toJosh_Morales⬆:Josh Morales @Josh_Morales
I expressly called the function in my script, and some objects are working as expected (log, sf.osc, etc) However, some objects still don't seem to be recognized (specifically, the context object). How else can we identify the button in a deck in the script? I'm trying to toggle a button's text to reflect the state of what it's controlling (a mute in SPHERE).
- OOwen Granich-Young @Owen_Granich_Young
Sounds like you're quite advanced and ready to have Dynamic decks, which is above our paygrade as regular users. Dynamic deck control is reserved for people in the developer program. I presume that's the ceiling you're hitting, but I'm not sure as I'm not a developer either.
- JJosh Morales @Josh_Morales
Aha! Maybe I need to email the SF people to ask about getting access to that sort of thing? I know Christian had spoken about dynamic buttons eventually being available, but I guess I assumed I would be able to code it myself. Maybe there are limitations put on the available objects to prevent issues?
Chad Wahlbrink @Chad2025-06-12 13:56:14.022Z
Hi @Josh_Morales,
Thanks for reaching out about this.
Unfortunately, creating dynamic surfaces is reserved for handpicked developers who have gone through the SoundFlow Developer Program.
To log specific ideas related to dynamic buttons, I'd encourage you to make a post in the "Ideas" section of the forum.
To read more about our reasoning, I’d suggest reading this post from Christian:
Dynamic buttons - simplified toggle state #post-3If you are looking for a momentary mute, you may be able to work out some workflows using Generic Button Commands described in this video:
- JJosh Morales @Josh_Morales
How would we gain access to the developer program? I thought the ethos behind soundflow was about personal customization to improve workflow. If I’m willing to put the time in coding buttons for myself (not for wider distribution), why is the functionality limited? Further, Christian says that a workaround would be to see the internal state of something in soundflow (a semi dynamic command). However, there doesn’t seem to be a way to find the context of a button in soundflow, only which button on a physical device was pressed and which macro was fired which means I can’t really even track what happened the previous time that button was pressed/the macro was fired. I also can’t see the name of the button or which deck had a button pressed via context. So, the mentioned workaround doesn’t even seem possible…
Christian Scheuer @chrscheuer2025-06-12 14:30:36.331Z
Hi Josh,
You can always contact us on support@soundflow.org to request access to our Developer Program, however we have limited capacity. Onboarding developers takes a lot of resources from our very small team, because there's a lot of custom training involved as it stands right now. At some point in the future we definitely hope to open it up more, but we unfortunately don't have capacity right now to do that.
If you'd like us to work on specific integrations like for Sphere, we're also happy to receive requests. In fact, we've been speaking to Ginger Audio for a while now, so we may be able to help you in other ways. Please let us know more about the specific functions in Sphere you'd like reflected and we can pass along the information to GA.