Announcement

Collapse
No announcement yet.

Sound alert when frame finishes rendering...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sound alert when frame finishes rendering...

    I'm looking for a way to get maya to play an alert sound when it finishes rendering a single frame (the way after effects does). A post render script perhaps. I found several for batch renders, but don't know much mel scripting and haven't found one for rendering a single frame. Seems like it should be pretty simple. Does anyone know of something like that?

    Thanks!

  • #2
    Hi,

    Do you need a cross-platform solution or just something specific to some os(es) ?
    Do you want to play a sound, or a simple system beep/bell ?

    Basically you could add a post-render frame mel :
    if (!`about -batch`) play_some_sound;

    Playing a basic beep will be specific on each os, unfortunately the stdout redirection forced by maya will break the print("\a") trick, so you must fall back on platform-specific implementations, ie:

    - windows : python("from winsound import Beep; Beep(2000, 200)")
    - linux : python("with open('/dev/audio', 'wb') as f: f.write((chr(63) * 4 + chr(0) * 4) * 250)")
    - osx : python("from AppKit import NSBeep; NSBeep()")

    Playing a specific sound will be trickier, but if you got some working scripts, it should be easy to fit your needs.

    HTH !

    Tonio

    Comment


    • #3
      I'm just looking for a windows 7 solution to play any sound really. A default bell/beep would be fine as long as it isn't so soft and short I miss it.
      I'll try that post-render mel script and see if I can make it work

      Thanks!

      Comment


      • #4
        The winsound python module should be sufficient, I can't test it here but I will try this solution at home : winsound.PlaySound("file_path", winsound.SND_FILENAME)

        See http://docs.python.org/2/library/winsound.html

        Kind regards,

        Tonio

        Comment


        • #5
          Hmm. That doesn't seem to work.
          I get this error mostly:
          # Error: line 1: NameError: file <maya console> line 1: name 'winsound' is not defined #

          Also, I can see how to add a mel post-render script but what about a python post render script? Do you just add the script to the "Python Post Translate script" box in the render settings?

          Comment


          • #6
            Originally posted by evanerichards View Post
            Do you just add the script to the "Python Post Translate script" box in the render settings?
            No, Python post translate does something else.

            You can use the pythong("") mel function.
            V-Ray developer

            Comment


            • #7
              you can call python code from a mel script with the "python" command, and you have to explicitly import any required module since it's just like a freshly launched interpreter :

              if (!`about -batch`) python("import winsound; winsound.PlaySound(...)");

              the "about -batch" condition is not mandatory, but it is a good idea to avoid annoying sounds when launching batch renders, especially at the crack of dawn

              Tonio

              Comment


              • #8
                @t.petrpv - Nice. I'll give it a shot.
                @thekraken - Sweet. I'll see if I can get that winsound thing working. The "from winsound import Beep; Beep(2000, 200)" command worked earlier, so maybe I'll just try to use the pythong("") mel function to run that script.

                Thanks!

                Comment

                Working...
                X