Can Anvil connect to external Bluetooth?, can we stream audio and create live feedback with Anvil

I am glad there is a system like AnvilšŸ˜, which is life saving for a person like me. a Python beginner.

I want to build a Web app in Anvil,

a Mindfulness Bio-feedback dashboard.

I have some Technical Queries can you please help me here.

  1. I want to link the proposed Anvil webapp with a Bluetooth wearable device through Web, I am aware of Javascript API to connect, is there any better way to do it through Python?

  2. I want to create live Audio feedback from the data recived from Bluetooth device,

How can i create a live Audio feedback in Anvil and play it on the Web?

  1. Can i Stream Audio in the Anvil?, Can different users upload the audio and can it be streamed.

I have already explored tutorials and did the Talkpython Anvil course as well.

Very new to coding hence many questions, thanks in advance for the help.

Anything that happens client-side in Anvil is happening through Javascript. Anvil just does a good job of hiding that from you and allowing you to write Python.

For anything that Anvil doesnā€™t support in Python (like connecting to a Bluetooth device), you have to use the Javascript bridge. How easy or hard that is depends entirely on the Javascript library youā€™re trying to use.

Hereā€™s a post showing one particular integration: Embedded interactive visualisations in Anvil using e.g. Vega Lite? - #2

And here are the docs on using Javascript from your Python code: Anvil Docs | Using JavaScript

One of the really cool things about the Anvil/Javascript bridge is that you can pass Python functions as Javascript callbacks, so you can work with many Javascript libraries entirely from inside form code.

2 Likes

Thanks for your help,
Do you have any suggestion on streaming audio through Anvil?
Thanks in advance.

Start by looking through the forum for posts on similar topics. Capturing audio, playing audio, storing audio, etc are all topics that show up pretty regularly. Hereā€™s one thread about playing audio: Simple Audio Player - #5 by robert

Then create a small proof of concept, and if it doesnā€™t work, let us know whatā€™s happening and someone will probably be able to help you fix it.

Focus on one technical issue at a time, too, rather than trying to write your entire app all at once.

Edit: Hereā€™s the Anvil docs section on integrating third-party Javascript libraries: Anvil Docs | JavaScript

3 Likes