Is beep zero-based?

Dar Scott dsc at swcp.com
Sun Jun 8 12:09:01 EDT 2003


On Sunday, June 8, 2003, at 12:30 AM, valetia at mac.com wrote:

> Cross-platform note:  Windows and OS X do not execute the beep command 
> if
> it’s issued while a beep is playing. This means that if you specify a
> numberOfTimes on a Windows or OS X system, the user might hear fewer 
> beeps
> because not all of them are sent to the speaker. To ensure that the 
> user
> hears a specific number of beeps, use a loop with a wait command after 
> each
> beep:
>
>   repeat for 4 times -- ensure 4 separate beeps
>     beep
>     wait 200 milliseconds
>   end repeat

On my OS X I can execute a beep while a beep is playing, but not during 
the first 10 to 20 ms of the beep.  The beeps are not queued, so it 
stutters if the time is too short.

And...

on mouseUp
   put the long seconds into tDummy
   put the long seconds into tStart
   put the long seconds into tEnd
   put (tEnd-tStart) into tCorrection
   put empty into field "Report"
   repeat with beepTimes = 0 to 4
     put the long seconds into tStart
     beep beepTimes
     put the long seconds into tEnd
     set the numberFormat to "0.######"
     put beepTimes & " beeps    " into beepReport
     set the numberFormat to "0.000000"
     put ((tEnd-tStart)-tCorrection) & " s    " into timeReport
     put max( (beepTimes-1)*.5 +.0005, .0001) & " s expected" into 
expReport
     put beepReport & timeReport & expReport & lineFeed after field 
"Report"
     wait 2 seconds
   end repeat
end mouseUp

This produces ...

0 beeps    0.000009 s    0.000100 s expected
1 beeps    0.000221 s    0.000500 s expected
2 beeps    0.000279 s    0.500500 s expected
3 beeps    0.500557 s    1.000500 s expected
4 beeps    1.000787 s    1.500500 s expected

Bug.

Dar Scott






More information about the use-livecode mailing list