B4J Question Audio Beeper

Phil Thompson

Member
Licensed User
Longtime User
Waiting for debugger to connect...
Program started.
java.lang.NoClassDefFoundError: android/media/AudioTrack
at anywheresoftware.b4a.audio.Beeper.Initialize2(Beeper.java:54)
at anywheresoftware.b4a.audio.Beeper.Initialize(Beeper.java:37)
at phil.timeclock.b4xmainpage._initialize(b4xmainpage.java:2089)
at phil.timeclock.b4xpagesmanager._initialize(b4xpagesmanager.java:112)
at phil.timeclock.main._appstart(main.java:104)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 

Phil Thompson

Member
Licensed User
Longtime User
OOPS!
I intended to add text above the preceding error text.
This was generated when I added the audio library and followed the instruction of use for B4J

Audio library was updated and it now supports generating "beep" sounds.

B4X:

Dim b As Beeper
b.Initialize(300, 500) '300 milliseconds, 500 hz
b.Beep
Once the object is initialized you can reuse it and play it multiple times.
Documentation: http://www.b4x.com/android/help/audio.html

Installation instructions:
- Download the attached file.
- Copy both files to the internal libraries folder: C:\Program Files\Anywhere Software\Basic4android\Libraries
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

Phil Thompson

Member
Licensed User
Longtime User
B4A Audio library will not work with B4J.

For a "standard" beep: https://www.b4x.com/android/forum/threads/generate-beep-on-a-desktop.135209/post-855115

And you might be able to create a custom beep with this: https://www.b4x.com/android/forum/threads/b4j-jaudiotrack2.142197/
Code to create the beep data is available here: https://www.b4x.com/android/forum/threads/audio-library-beeper-duration.78712/#post-498840 (intended for B4A AudioStreamer but might still be useful).
OK... Will look at other options. This surprised me though when you said it would not work with B4J
1731706080307.png
 
Upvote 0

teddybear

Well-Known Member
Licensed User
The Audio library is not included in the B4J installer, I guess someone has put it into the internal folder:cool:
 
Upvote 0
Top