JS scripts not working in Logic as we all know

I wonder if there is any idea of a timeline when JS scripts will run again in Logic. I’m aware that it is due to some restrictions in Mac OS of running JS outside sandboxes but still : I very much miss a simple script that can replace ALL the given Phonemes in the selected notes by another Phoneme ( Like hh to br) in one go. I can read JS and even LUA with some difficulty but would appreciate a pointer or an example if someone has something that deals with that. Have a great day!

Ps : It would have to be LUA because of Logic I forgot to mention…

I just tried ChatGTP and it cam up with this. But I am hesitant having seen the failed code it produces in languages and environments I’m familiar with :slight_smile: lua

– Define the phoneme you want to replace and the phoneme you want to replace it with
local phoneme_to_replace = “AH”
local replacement_phoneme = “EH”

– Get the selected notes in the Synthesizer V plugin
local selected_notes = plugin.getSelectedNotes()

– Iterate through each selected note
for _, note in ipairs(selected_notes) do
– Iterate through each phoneme in the note
for _, phoneme in ipairs(note:getPhonemes()) do
– Check if the phoneme matches the one to be replaced
if phoneme:getSymbol() == phoneme_to_replace then
– Replace the phoneme
phoneme:setSymbol(replacement_phoneme)
end
end
end

Here is a very simple Lua script that can be used to replace the phonemes of all selected notes. The desired new phoneme is entered into a text box.

ak_SetPhonemes.zip (599 Bytes)

1 Like

Thanks for that quick response. It made me understand the LUA scripting better and now I will try to adapt this to select ( about 60 instances per track for three tracks) of the “hh” phoneme in about 10 songs , I abused in the beginning of my Synth V days, to replace the whole lot automatically with “br” which is much more appropriate. As it is now it is a lot of work to select each individual hh into a “selection group” for each track and each song and then trigger the script. It helps me on my way to actual scripting LUA. I come from LiveCode. Cool how this forum never disappoints!

1 Like