tag:blogger.com,1999:blog-284600789737488130.post9211040419787230832..comments2024-02-07T02:22:20.642-05:00Comments on Ruby on Windows: Adding Sound to Your Ruby AppsDavid Mullethttp://www.blogger.com/profile/05597492688893461137noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-284600789737488130.post-8867736863787464812013-07-08T01:59:43.313-05:002013-07-08T01:59:43.313-05:00been thinking about this for months. I do long cl...been thinking about this for months. I do long cli processing and helps to know when processing is done.<br />nilanjannoreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-80941435941347816342010-10-18T17:29:22.838-05:002010-10-18T17:29:22.838-05:00This did not work for me, I installed it like it s...This did not work for me, I installed it like it says, and I get this error:<br /><br />C:\Users\Ted\ruby-sound>ruby ruby-sound.rb<br />:29:in `require': 126: The specified modul<br />e could not be found. - C:/Ruby192/lib/ruby/gems/1.9.1/gems/win32-api-1.4.6-x8<br />6-mingw32/lib/win32/api.so (LoadError)<br /> from :29:in `require'<br /> from C:/Ruby192/lib/ruby/gems/1.9.1/gems/windows-api-0.4.0/lib/windows/a<br />pi.rb:1:in `'<br /> from :29:in `require'<br /> from :29:in `require'<br /> from C:/Ruby192/lib/ruby/gems/1.9.1/gems/windows-pr-1.0.9/lib/windows/so<br />und.rb:1:in `'<br /> from :29:in `require'<br /> from :29:in `require'<br /> from C:/Ruby192/lib/ruby/gems/1.9.1/gems/win32-sound-0.4.2/lib/win32/sou<br />nd.rb:1:in `'<br /> from :33:in `require'<br /> from :33:in `rescue in require'<br /> from :29:in `require'<br /> from ruby-sound.rb:1:in `'Unknownhttps://www.blogger.com/profile/03904736238878577764noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-51877778394711035652009-06-02T07:17:11.459-05:002009-06-02T07:17:11.459-05:00Now it works, great! Thank you, David!Now it works, great! Thank you, David!Benjaminnoreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-36264694789606022562009-06-01T20:26:36.563-05:002009-06-01T20:26:36.563-05:00@Benjamin-
Call the play method with the ASYNC an...@Benjamin-<br /><br />Call the play method with the ASYNC and LOOP flags:<br /><br />Sound.play('jeopardy.wav', Sound::ASYNC|Sound::LOOP)<br />puts "Tell me your solution: "<br />solution = gets.chomp<br />Sound.stop()<br /><br />The above code starts playing the wav file and immediately returns to the next line of code.<br /><br />DavidDavid Mullethttps://www.blogger.com/profile/05597492688893461137noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-3198104372155295572009-06-01T17:06:34.441-05:002009-06-01T17:06:34.441-05:00Thank you!
But for my program I would like to pla...Thank you!<br /><br />But for my program I would like to play the music simultaneously...<br /><br />F.e. <br /># start wav-file<br />puts "Tell me your solution: "<br />solution = gets.chomp<br /># end wav-file afterwards<br /><br />Is that possible with Win32 sound library?<br /><br />With the code that I got the music starts...plays a few seconds...stops... and then the program goes on...<br />any solution with that library?Benjaminnoreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-34929531650061896232009-05-20T20:49:32.977-05:002009-05-20T20:49:32.977-05:00@Benjamin:
A wav file has a finite length. But yo...@Benjamin:<br /><br />A wav file has a finite length. But you can loop it, wait a while, then stop it:<br /><br />Sound.play('chimes.wav', Sound::ASYNC|Sound::LOOP)<br />sleep(5)<br />Sound.stop()David Mullethttps://www.blogger.com/profile/05597492688893461137noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-1215560332479974712009-05-18T06:53:00.000-05:002009-05-18T06:53:00.000-05:00I tried the code with a wav-file and I wondered if...I tried the code with a wav-file and I wondered if it is possible to set the duration (and maybe also the volumen) like in the beep tone... any idea?<br />Thanks for all answers!Benjaminnoreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-89962355113295858912009-04-14T19:01:00.000-05:002009-04-14T19:01:00.000-05:00Can Ruby turn ON/OFF window Audio device?
Usually...Can Ruby turn ON/OFF window Audio device?<br /><br />Usually the Audio is turned OFF as default.<br /><br />But, want to turn ON and play finish test tone and turn it back OFF.<br /><br />Possible?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-14056931393119196402009-02-19T13:01:00.000-05:002009-02-19T13:01:00.000-05:00Just wondering if you guys have an idea of how to ...Just wondering if you guys have an idea of how to play tones to a sound card - not the built in speaker. I need to send it to an output line on my card. Or if ti's even possible. I know I can record low volume sounds, and then play them - but I was wondering if I can generate them dynamically and send to our PA system - to signal lunch times and stuff. <BR/>Thanks.konunghttps://www.blogger.com/profile/11280415044128839107noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-69142538375072152012008-10-03T11:50:00.000-05:002008-10-03T11:50:00.000-05:00I find the module very useful for (simple) debuggi...I find the module very useful for (simple) debugging purposes. I even had forgotten I had used it before and in a way "rediscovered" it the next time I needed it.<BR/>Both times - thanks to this blog post, so - thanks David!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-84453485089597204932008-07-19T09:38:00.000-05:002008-07-19T09:38:00.000-05:00Rafael-I don't have Linux to test this out, but th...Rafael-<BR/><BR/>I don't have Linux to test this out, but the snippet here calls the "aplay" command:<BR/><BR/>http://pastie.org/pastes/181456<BR/><BR/>Perhaps something like this will work for you.<BR/><BR/>DavidDavid Mullethttps://www.blogger.com/profile/05597492688893461137noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-17440719935089524172008-07-10T21:26:00.000-05:002008-07-10T21:26:00.000-05:00Do you know a gem that play sound (mp3) on linux?t...Do you know a gem that play sound (mp3) on linux?<BR/><BR/>thanksAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-76465792215660612342008-02-22T05:56:00.000-05:002008-02-22T05:56:00.000-05:00One possible usage of the beep -to signal end of l...One possible usage of the beep -<BR/>to signal end of long processing activity, when the human goes away from the computer.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-26899057550239385982007-07-29T19:46:00.000-05:002007-07-29T19:46:00.000-05:00Thanks, Daniel!I have updated the article with the...Thanks, Daniel!<BR/><BR/>I have updated the article with the new URL for the docs.<BR/><BR/>DavidDavid Mullethttps://www.blogger.com/profile/05597492688893461137noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-62929819232195193492007-07-29T11:13:00.000-05:002007-07-29T11:13:00.000-05:00Updated doc link: http://rubyforge.org/docman/view...Updated doc link: http://rubyforge.org/docman/view.php/85/1709/Sound.htmlDaniel Bergerhttps://www.blogger.com/profile/05224445093970941579noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-36596004397304190222007-05-17T01:50:00.000-05:002007-05-17T01:50:00.000-05:00Interesting to know, but I´m not sure if this real...Interesting to know, but I´m not sure if this really necessary?!<BR/>As You said, it´s difficult not to put too much beeps & rings to an application...and I´m sure there more guys outside that put too much sound into there app then others who do it "right".<BR/>But I don´t want to get philosophical... ;)<BR/>As always: Interesting post, thanks for it! Maybe I´ll use it in one of my next scripts to see how useful it could be for me.Christian Baumannhttps://www.blogger.com/profile/06797922947252740926noreply@blogger.com