Beep sound
Someone previously asked how to beep, and I answered with a relatively short piece of code that played a binary encoded wave file by inserting into the REBOL sound port. For very simple needs, this 1 liner works: call/show "echo ^G"
posted by: Nick 5-Sep-2012/20:55:01-7:00
Even better: call/show/wait "echo ^G"
posted by: Nick 5-Sep-2012/20:57:08-7:00
I used the above code to create the simplest 1-line REBOL timer/stopwatch (this one waits 3 seconds then beeps): wait 3 call/show/wait "echo ^G" For more elaborate waiting: s: now/time until [now/time - s > 00:00:03] call/show/wait "echo ^G"
posted by: Nick 5-Sep-2012/21:03:17-7:00
User configurable stop watch: s: request-text/title "Seconds to wait:" wait to-integer s call/show/wait "echo ^G"
posted by: Nick 5-Sep-2012/21:05:33-7:00
With a count-down: s: to-integer request-text/title "Seconds to wait:" loop s [print s s: s - 1 wait 1] call/show/wait "echo ^G"
posted by: Nick 5-Sep-2012/21:09:03-7:00
Shaved a few characters: s: to-integer ask"Seconds: "loop s[print s s: s - 1 wait 1]call/show/wait"echo ^G"
posted by: Nick 5-Sep-2012/21:15:33-7:00
I like this version more. It gets permission to run the "call" function first: call""repeat s 3[print s wait 1]call"echo ^G" interactive: call "" s: to-integer ask "Seconds: " repeat i s [print i wait 1] call "echo ^G"
posted by: Nick 9-Sep-2012/11:21:42-7:00
Alarm beep goes off 5 times: call "" s: to-integer ask "Seconds: " repeat i s [print i wait 1] loop 5 [call "echo ^G" wait 1]
posted by: Nick 9-Sep-2012/11:25:08-7:00
Sound port solution playing a wav file only seems to work under windows and then only as it seems in REBOL SDK version. I'll state/ask this question also on AltMe later today.
posted by: Arnold 11-Sep-2012/6:47:32-7:00
Sound port works fine in every version of REBOL/View I've tried. What OS and REBOL version are you using?
posted by: Nick 13-Sep-2012/16:58:03-7:00
|