sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Playing sounds in sketchup

    Scheduled Pinned Locked Moved Plugins
    17 Posts 5 Posters 2.8k Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      Mr Tee
      last edited by

      @tig said:

      As well as TBD's suave.rb there are the simple API methods
      UI.beep for a simple system-beep
      UI.sound(path_to_sound_file) for a .wav file osa...
      To attach it to an object requires more code...
      Didier Bur's script to use UI.openURL(url) when you click an object [can't recall its name off-hand] could be easily modified to play a sound with the code above...

      As I cant get the suawe to work I'm trying the above method, but I cant find that peice of code from Didier Bur to attach it to an object.
      cheers!

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        Try this http://rhin.crai.archi.fr/rld/plugin_details.php?id=799
        It's for URLs BUT could be adapted to play sounds...

        TIG

        1 Reply Last reply Reply Quote 0
        • M Offline
          Mr Tee
          last edited by

          Thank you TIG!
          i installed it but it doesnt work for some reason, wont launch the html interface.
          How could i modify it to play audio files instead?

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            @mr tee said:

            Thank you TIG!
            i installed it but it doesnt work for some reason, wont launch the html interface.
            How could i modify it to play audio files instead?

            Sorry! I mis-linked http://rhin.crai.archi.fr/rld/plugin_details.php?id=229 is links.rb what you want the other is a links manager and is encrypted too!
            Download and read the file in Notepad...
            You will see that it links files/urls to objects - you need to link sound files to objects...
            It also uses UI.openURL(filepath) you'd substitute that with UI.play_sound(soundpath)...

            TIG

            1 Reply Last reply Reply Quote 0
            • M Offline
              Mr Tee
              last edited by

              @unknownuser said:

              And there is the ever popular Homer Button:
              http://forums.sketchucation.com/viewtopic.php?p=6879#p6879

              Thanks BooFredlay!
              This would also work actually. but myexperience in Ruby isnt that good.
              I've managed to make custom button image and custom sound, but i wonder how to ad more buttons in that tool bar?(see code below)
              Is there a way to make the buttons longer?

              plugins = Sketchup.find_support_file("Plugins")
              sfile = File.join(plugins, "ljudstudie", "r1.wav")
              icon = File.join(plugins, "ljudstudie", "r1.png")
              tb = UI::Toolbar.new("Ljudstudie")
              cmd = UI::Command.new("Doh") { UI.play_sound(sfile) }
              cmd.small_icon = icon
              cmd.large_icon = icon
              cmd.tooltip = cmd.status_bar_text = "R1"
              tb.add_item(cmd)
              tb.show

              1 Reply Last reply Reply Quote 0
              • M Offline
                Mr Tee
                last edited by

                @tig said:

                @mr tee said:

                Thank you TIG!
                i installed it but it doesnt work for some reason, wont launch the html interface.
                How could i modify it to play audio files instead?

                Sorry! I mis-linked http://rhin.crai.archi.fr/rld/plugin_details.php?id=229 is links.rb what you want the other is a links manager and is encrypted too!
                Download and read the file in Notepad...
                You will see that it links files/urls to objects - you need to link sound files to objects...
                It also uses UI.openURL(filepath) you'd substitute that with UI.play_sound(soundpath)...

                Thanks!
                I had a look at the code, did u mean copy bits of the code.
                is that possible to make an object act as a button which trigger a sound stored on the harddrive somewhere?

                1 Reply Last reply Reply Quote 0
                • TIGT Offline
                  TIG Moderator
                  last edited by

                  The original code makes objects open 'attached' URLs.
                  If you substitute a 'sound-file-path' for the url/file-path and adjust other commands it should play the sound...
                  Obviously it's somewhat more complex than that, BUT you could copy the links.rb and rename it and its def methods, substituting suitable stuff for sound file [.wav] in place of url/file-path and UI.play_sound() in place of UI.openURL().........
                  You can't make a button - the url-link works off the context-menu BUT perhaps DCs have something ???

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    Mr Tee
                    last edited by

                    ok!
                    DC's?

                    1 Reply Last reply Reply Quote 0
                    • TIGT Offline
                      TIG Moderator
                      last edited by

                      @mr tee said:

                      ok!
                      DC's?

                      Dynamic Components...

                      TIG

                      1 Reply Last reply Reply Quote 0
                      • M Offline
                        Mr Tee
                        last edited by

                        Just curious, anyone had suawe working?
                        I managed to get the script installed and the demoscene loads fine, but I cant hear any sound!

                        I'm running SU 8!

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        • First post
                          Last post
                        Buy SketchPlus
                        Buy SUbD
                        Buy WrapR
                        Buy eBook
                        Buy Modelur
                        Buy Vertex Tools
                        Buy SketchCuisine
                        Buy FormFonts

                        Advertisement