Play a sound with Rhino

Hello,

We are working on an experimental project with Rhino, and we have an idea for which we would like to have your opinion.

The idea would be to have a sound played according to an action in Rhino.
Example : When you type “ExtrudeCrv” and press Enter, a file sample.mp3 is being played.

For now, we’ve explored Python libraries (like playsound · PyPI for example).
But what about the feasability of such a script with RhinoPython (which, as we are aware, is not exactly python but ironpython) ?

Thank you,

Hi @antoine3,

Here are a couple of simple examples:

import System
System.Media.SystemSounds.Asterisk.Play()
import System
wav = r'C:\Windows\Media\notify.wav'
player = System.Media.SoundPlayer(wav)
player.Play()

– Dale

1 Like

Hello @dale ,
Thank you for your answer!
It looks like it would work in Windows only, am I correct?
Is there a solution that would work on macOS? (And even better, one that would work for both Windows and macOS?)

No idea - give it a try.

– Dale

I tried both of them on mac.
It doesn’t play any sound, but interestingly it doesn’t show any error.
I can’t try it on a windows right now but I’ll also try it on windows.
Thank you for your answer, that’s a good start anyway, and shows that it could be doable :slight_smile: