Page 1 of 1

System.Console.BeepBeep(frequency, duration)

Posted: Mon Mar 04, 2019 6:42 pm
by abmuzzy
Is there any way to run
System.Console.BeepBeep(frequency, duration)
or any other function to produce frequency/length defined sound
while using OpenOffice scripting?
Not just beep
Not calling prestored wav file, but generating a sound of a certain frequency during a certain time?
ON LINUX?
UBUNTU?

On PC, Windows, MS Office, VBA
it will be as below
===================================================
'Dim freq As Integer = Integer.Parse(txtFrequency.Text)
'Dim duration As Integer = Integer.Parse(txtDuration.Text)

Dim freq As Integer
Dim duration As Integer
freq = 500
duration = 1000 'ms
System.Console.Beep(freq, duration)
================================

When I run it on LibreOffice Calc it runs upto the
System.Console.Beep(freq, duration)

and

returns

BASIC syntax error

where the culprit is "System"
===============================================================
So I am looking for a way to call System.Console.Beep(freq, duration) with Basic as Script
Or some other way of GENERATING a sound with certain length and certain frequency
ANy help will be appreciated

Re: System.Console.BeepBeep(frequency, duration)

Posted: Mon Mar 04, 2019 7:13 pm
by JeJe
On windows its just the Beep function which you can declare at the top of a module. Don't know whether these work under Linux with WINE installed.

Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long

Re: System.Console.BeepBeep(frequency, duration)

Posted: Mon Mar 04, 2019 7:23 pm
by abmuzzy
Just tried.

Code: Select all

REM  *****  BASIC  *****

Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
Sub Main
msgbox "hello"
End Sub

Function eps () 
Msgbox "Func"
end Function

Sub press
'Dim freq As Integer = Integer.Parse(txtFrequency.Text)
'Dim duration As Integer = Integer.Parse(txtDuration.Text)


'Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long

Dim freq As Integer
Dim duration As Integer


'freq = Integer.Parse(txtFrequency.Text)
'duration = Integer.Parse(txtDuration.Text)


freq = 500
duration = 10

'System.Console.Beep(freq, duration)

msgbox "hello"
Call eps
Call Beep(500,1000)

End Sub

Re: System.Console.BeepBeep(frequency, duration)

Posted: Mon Mar 04, 2019 7:25 pm
by abmuzzy
kernel32
Error Not declared

Re: System.Console.BeepBeep(frequency, duration)

Posted: Tue Mar 05, 2019 6:53 am
by abmuzzy
'I found some kind of a walkaround.


Sub Main

'man page Beep
'Shell("firefox",2)
'msgbox "hello"

Shell("beep -f 1000 -n -f 2000 -n -f 1500 ")

End Sub


'Thanks anyway.