Home   Archive   Permalink



how to beep using the bell

how to beep using the bell in rebol ?
    
    


posted by:   Yuem     2-Jun-2010/22:53:16-7:00



The bell?
    
beep-sound: load to-binary decompress 64#{
eJwBUQKu/VJJRkZJAgAAV0FWRWZtdCAQAAAAAQABABErAAARKwAAAQAIAGRhdGEl
AgAA0d3f1cGadFQ+T2Z9jn1lSjM8T2uNsM/j7Midc05PWGh4eXVrXE5DQEZumsTn
4M2yk3hiVU9fcX+GcFU8KkNmj7rR3+HYroJbPUpfdoqAbldBP0ZWbpW62OvRrohk
WlleaHB2dW9bRzo1WYWy3OHbyrKObVNCVGp/jXpgRC48Vnievtfm6MCUaUVLWW1/
fXNkUkdCRlN7ps3r3cSkgm1fWFhmdH2AaVA6LElwnMja4dzNpHtXPUxje45/aVA5
PUtif6TG3uvMpHtXU1lkcnd2cGVURT0+ZJC84+HUvaGCZ1NIWm6AinVaQCtAX4Wu
yt3k37aJYEBKXXOHf3FdSEJET2KJsdPr1reUcGJbW2FsdXl2YUs5MFF7qdPe3tO+
mHNUP1Bnfo59ZEkyPFFukbTR5OvGm3BMTVlpent1aVpMQ0FJcZ3I6uHMsJB2YlZR
YXJ/hW5UOypEaJK90+Dg1qyBWjxKYHeLgG1WPz9HWXKYvNnr0KyFYVhZX2pydnVu
Wkc7N1yHtN3h2sivjGxTRFZrgI15X0MtPVh7osHZ5ua+kmdES1tvgn5zY1BGQ0hW
fqjO69vBoX9rXllaaHV9fmhPOi1Lcp/K2+DayaF4Vj1NY3uNfmhONjxLZIKnyODr
yqJ4VFFYZHN3dm5iUUM9QGaTv+Th0rqdf2VTSltvgIl0WT4rQGCIssze5N60iF8/
Sl10h39vW0ZBRFFljLPU69W1kG1gWlxiYHkWb1ECAAA=
}
    
insert port: open sound:// beep-sound wait port close port

posted by:   Nick     3-Jun-2010/0:01:54-7:00



You can use the following code to embed any wave file (or images, executables, or any other file, for that matter):
    
R E B O L [Title: "Binary Resource Embedder"]
system/options/binary-base: 64
uncompressed: read/binary to-file request-file/only
editor compress to-string uncompressed

posted by:   Nick     3-Jun-2010/10:11:34-7:00



thanks for the code nick. what I am looking for is to make my PC beep using the onboard speaker, not using a sound card. Just like in the old DOS machines. you could use the ASCII bell code to make sound on your PC.
the ascii code for the bell is Ctrl G, i tried that with rebol but couldn't the beep to sound
    
Anyone has tried to use the ASCII bell code ?


posted by:   yuem     4-Jun-2010/22:25:37-7:00



I think Microsoft has removed that from recent versions of the Windows API (http://msdn.microsoft.com/en-us/library/ms679277(VS.85).aspx)
    
This example is in my tutorial, but does not work in newer versions of Windows:
    
R E B O L []
    
; The "kernel32.dll" is a standard dll in all Windows installations:
    
lib: load/library %kernel32.dll
play-sound: make routine! [
     return: [integer!] pitch [integer!] duration [integer!]
] lib "Beep"
for hertz 37 3987 50 [
     print rejoin ["The pitch is now " hertz " hertz."]
     play-sound hertz 50
]
free lib
halt

posted by:   Nick     4-Jun-2010/23:21:27-7:00