Code/new Sound Effects Player

From kJams Wiki
Revision as of 20:28, 10 March 2011 by Deusexmachina (talk | contribs) (Sound effects player)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

So this has been a very frequent request among kJams users, so I decided to take a break from my other kJams project, and get this thing up and running. Place any sound effects files you want to access in a folder called "soundFX" in your kJams folder (~/Music/kJams, most likely) or you can run the script once and it will make it for you. You have two choices on how to implement this. You can open Applescript Editor and paste the following code into a new script window, and save as an application, and then run as you would any other application. Or better yet, open up Automator, select "Service" from the template choices on the opening splash screen, and then drag "Run AppleScript" from the Library onto the Stage. Change the "Service receives selected" popup to "no input", and "applications" to "kJams". (First choose "other…" from the popup menu, and then browse to kJams in the file selector.) Next, paste the following code over top of where is says "(* Your script goes here *)", and save. That's it, you're ready to go! To use, run the application or select the service from the service menu, and a list of your sound effects will pop up. Select the one you want and hit "Play." Voilá, the sound plays over top of any audio you already have running.

Since this is already version r2, there are some additional features:

1) You can play another effect while the first is still playing. Both will play together. Play the sound of footsteps, and while it is still playing, add the sound of a door closing, layered with a voice saying "See ya!" 2) Want a chorus? Select multiple items from the list at one time and they will all play in unison. I have tested with as many as 36 simultaneous sounds playing.

Let me know what you think back in the forums.

P.S. If you find this useful, check out my other scripts. P.P.S If you think this is the bomb, and are feeling generous, I could always use the additional incentive :) <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHRwYJKoZIhvcNAQcEoIIHODCCBzQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcN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BLp8i+huajat37XVNjVpgDf0mMvpq3Q7gyHKIB0ERDPoNmZr1xepvCakL6ZB7ZKWlucJlrZ3VRN+sTUeuIHd86U8Q==-----END PKCS7----- "> <input type="image" src="btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> </form> (being poor and all).