Ask Your Question

Coding sound alerts in Base

asked 2020-05-21 10:41:40 +0100

Philip K gravatar image

updated 2020-08-31 21:49:28 +0100

Alex Kemp gravatar image

The command beep generates a machine-specific warning sound (on the Mac a dull and unimpressive thud). But is there any other mechanism which can be used in a macro to generate different alarm sounds, such as sound(pitch,length) ?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-05-21 10:51:05 +0100

torreone gravatar image

updated 2020-05-21 10:53:44 +0100

Under linux, but I also believe under other operating systems this works. Instead of a generic sound, this functon use any mp3, also very short, of any kind

function playMp3(sFullPath)    ' sFullPath = path-name-extension
     dim oPlayer1 as object, sUrlSound as string, oSounMgr as object

     sUrlSound = ConvertToUrl(sFullPath)       

     If not fileexists(sUrlSound) Then       
         msgbox sUrlSound & " does not exist",16
        If GetGuiType() = 1 Then
            oSounMgr = CreateUnoService("")
            oSounMgr = CreateUnoService("")       
        End If
        If IsNull(oSounMgr) Then
           msgbox "Sound Mgr not set",16
            oPlayer1 = oSounMgr.createPlayer(sUrlSound)
            oPlayer1.setMediaTime(0.0): oPlayer1.setVolumeDB(-10)   
            oPlayer1.setPlayBackLoop( 0 ): oPlayer1.start(0)
            while oPlayer1.isplaying()
            oPlayer1 = nothing:  oSounMgr = nothing: 
        End If
     End If
End function
edit flag offensive delete link more


Thank you. It may come to that, and I have found a convenient site for creating a short sine-wave signal: []. However, since it involves using an external file, not integral to the database, I am a little doubtful of its utility.

Philip K gravatar imagePhilip K ( 2020-05-25 12:19:55 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-05-21 10:41:40 +0100

Seen: 71 times

Last updated: May 21 '20