First time here? Check out the FAQ!

Can I compile, load and start without any windows opening?

+1 vote

I have some Python code which I want to use to start a Sound in the background.

In my code I have

import os.path
import subprocess
kyma_sound = os.path.expanduser("~/kyma/") + self.args["source"]
# self.args["source"] above is a string containing a .kym filename
subprocess.check_call(["open", kyma_sound])

which gets as far as starting Kyma (if not already started) and opening the Sound file without compiling any specific Sound in that file, and does it in a very "visually noisy" way, opening every imaginable Kyma window -- as usual -- and, depending upon which order I do things, puts all the Kyma windows on top of my app, or underneath my app

My end users don't even need the VCS. So, really, all I want to do is load up a specific Sound from a specific Sound file, without opening any windows -- where the specifics of the Sound file and Sound to load are given to my Python code by the user at runtime.

Is there either a Bash command-line or Applescript way of saying "compile this sound from this file" or, perhaps a Kyma Tool way to do the same?

asked Jun 1, 2019 in Using Kyma by kevin-cole (Adept) (1,050 points)

2 Answers

0 votes
Could you do this with SelectableSound?? insert the collection of sounds in the input of selectableSound and maybe control it via python OSC script?
answered Jun 3, 2019 by anssi-laiho (Adept) (1,150 points)
I see where you're going with that, and it eliminates one layer of complexity, so, thanks. I'm now considering adding that into the mix.

But still doesn't get at the "clinicians with no understanding of Kyma nor any desire to understand Kyma" problem. After my code starts Kyma and opens the .kym file, they would still need to select the sound that has the SelectableSound, compile, load & start that sound, and finally, bring my Python code window to the foreground, sending all the Kyma windows to the back, before continuing.

Or am I missing something in your suggestion? (A distinct possibility.)
0 votes
To answer your question, yes there are examples in Xtra Tools showing how a Tool can play a Sound in an associated Sound file window (.kym) or Compiled Sound Grid. But an even better way might be to use OSC to select and play Sounds from a Multigrid (by column and row).

Still pondering how to hide Kyma when you launch it from the Terminal. Maybe there's a way to Apple-script the Mac OS to swap Spaces? So you could specify your python app to start in one space and Kyma to start in another and then move the python Space to the front?
answered Jun 3, 2019 by ssc (Savant) (120,590 points)
The bad news: An OSC message would need to go to the Paca, which cannot compile, load and start a Multigrid or Sound, as I understand things.

The good news: In a terminal window "open x.pci" appears to load and start a Tool. So, it looks like Tool it is. Done for today, but my next visit to the lab will be to find and comprehend the afore-mentioned Xtra Tools examples.

And, finally, in the "not the way I intended but it works okay" news: I went through all my Python code and for every window added a flag that says "Stay on top", and fortunately, they do so in the right order. ;-)
And, we continue to fight. Kyma has no AppleScript dictionary ( And apparently there's considerably more to getting a compiled sound to start than having an InitialState with an onEntry action "Soundscapes playSoundNamed: 'sound x'." (where Soundscapes is a compiled sound grid containing "sound x").