Groups
Groups
Sign in
Groups
Groups
Kivy users support
Conversations
Labels
About
Send feedback
Help
Buildozer setup for audio
62 views
Skip to first unread message
Vivek Koppikar
unread,
May 28, 2023, 4:50:58 PM
5/28/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Kivy users support
How can I appropriately setup buldozer.spec so i can capture audio from the mic on android phones.
Appreciate any help!
Cheers
Vivek Koppikar
unread,
May 28, 2023, 4:57:51 PM
5/28/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Kivy users support
I missed adding that I intend to use pyjunius so I can call java classes for audio
Robert
unread,
May 28, 2023, 5:26:57 PM
5/28/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Kivy users support
Paras 4 and 5
https://github.com/Android-for-Python/Android-for-Python-Users#basic-pyjnius-usage
Vivek Koppikar
unread,
May 28, 2023, 6:03:38 PM
5/28/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Kivy users support
Thanks Robert. Let me give it a try.
Cheers
Vivek Koppikar
unread,
May 28, 2023, 7:12:10 PM
5/28/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Kivy users support
Gave it a try:
Here is my code in Pythin, KIvyMD and pyjunius...
The app crashes as soon as def record() is run.. ie after I hit the to record button
from kivy.lang import Builder
from
kivymd.app
import MDApp
from jnius import autoclass
from time import sleep
kv = '''
Screen:
MDCard:
size_hint: None, None
size: root.size
pos_hint: {"center_x":0.5, "center_y": .5}
elevation: 10
padding: 25
spacing: 25
orientation: "vertical"
MDLabel:
id: is_recording
text: "Not recording"
font_size: 50
halign: "center"
MDRoundFlatButton:
text: "Record"
font_size: 40
pos_hint: {"center_x": 0.5}
on_press: app.record()
MDRoundFlatButton:
text: "Stop"
font_size: 40
pos_hint: {"center_x": 0.5}
on_press: app.stop()
'''
class MyApp(MDApp):
__version__ = "1.0.0"
def build(self):
self.theme_cls.theme_style = "Dark"
self.theme_cls.primary_palette = "BlueGray"
return Builder.load_string(kv)
#return Builder.load_file('./mainscreen.kv')
def record(self):
self.root.ids.is_recording.text = f"Recording"
# get the needed Java classes
MediaRecorder = autoclass('android.media.MediaRecorder')
AudioSource = autoclass('android.media.MediaRecorder$AudioSource')
OutputFormat = autoclass('android.media.MediaRecorder$OutputFormat')
AudioEncoder = autoclass('android.media.MediaRecorder$AudioEncoder')
# create out recorder
mRecorder = MediaRecorder()
mRecorder.setAudioSource(AudioSource.MIC)
mRecorder.setOutputFormat(OutputFormat.THREE_GPP)
mRecorder.setOutputFile('/sdcard/testrecorder.3gp')
mRecorder.setAudioEncoder(AudioEncoder.AMR_NB)
mRecorder.prepare()
# record 5 seconds
mRecorder.start()
sleep(5)
mRecorder.stop()
mRecorder.release()
def stop(self):
self.root.ids.is_recording.text = "Stopped"
if __name__ == "__main__":
MyApp().run()
Robert
unread,
May 28, 2023, 9:09:47 PM
5/28/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Kivy users support
https://github.com/Android-for-Python/Android-for-Python-Users#get-an-error-message
Robert
unread,
May 28, 2023, 9:12:31 PM
5/28/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Kivy users support
And probably unrelated, sleep() will stall the Kivy event loop. Use Clock, or sleep() in a thread.
Reply all
Reply to author
Forward
0 new messages