I’m looking for an easy to program library for infrequently playing sounds (notifications and the like) from a clojure function.
edit: like this
(use 'my.sound.lib')
(play-file "filename")
(beep-loudly)
(bark-like-a-dog)
...
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
OK, with the question now including an API wishlist… 😉
You can use JLayer for MP3 playback on the JVM. On Ubuntu it’s packaged up as libjlayer-java. There’s a simple example of use in Java here. A Clojure wrapper:
Use
(play-file "/path/to/file.mp3")to play back an mp3 fly in a separate thread,(play-file "/path/to/file.mp3" true)if you’d prefer to play it on the current thread instead. Tweak to your liking. Supply your own loud beep and barking dog mp3. 😉For a load beep and the like, you could also use MIDI… Perhaps this blog entry will be helpful if you choose to try.
Also, the link from my original answer may still be helpful in your tweaking: Java Sound Resources: Links.