Triggering a note without pressing a key

Tried this:

defineParameter(“wooshOnOff”, “Eq Reset”, false, function() wooshOnOffChanged() end)

function wooshOnOffChanged ()
if wooshOnOff then
local id = playNote(60, 80, -1)
else
releaseVoice(id)
end
end

But I’m getting an error, any ideas?

You may need to use runSync() to be able to trigger a note from parameter callback.

https://developer.steinberg.help/display/HSD/runSync

Yep, that did the trick! Thanks!

defineParameter(“wooshVol”, nil, 0, -90, 26, 1) – bipolar parameter with integer steps
defineParameter(“wooshOnOff”, “woosh OnOff”, false, function() wooshOnOffChanged() end)
id = 0

function wooshOnOffChanged ()
if wooshOnOff then
runSync(playWoosh)
else
runSync(stopWoosh)
end
end

function playWoosh()
id = playNote(12, 80, -1)
end

function stopWoosh()
releaseVoice(id)
end