Skip to content

sample webserver #2158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Conversation

AnkushMalaker
Copy link
Contributor

@AnkushMalaker AnkushMalaker commented Apr 5, 2025

This implements a sample webserver for for the sdks in python.
It uses uv to handle dependencies which is pretty standard nowadays.

The webserver saves the data to .wav and .opus files, demonstrating decoding opus data and exposing a local webserver to the internet (and thus the phone) via ngrok.
preview image 1

preview image 2

@skywinder
Copy link
Collaborator

Please add a description to your pull request along with some screenshots or a video to demonstrate how it works. An empty pull request makes it difficult and time-consuming for other developers to understand what’s going on.

Also, the README is currently empty — please fill it in with basic instructions on how to get started. This will help others test and contribute more effectively.

@beastoin
Copy link
Collaborator

beastoin commented Apr 7, 2025

man @AnkushMalaker , appreciate you help but it's cleaning time now.

feel free to re-open it later if needed

/ closed

@beastoin beastoin closed this Apr 7, 2025
@AnkushMalaker
Copy link
Contributor Author

@skywinder @beastoin , thanks for your feedback and time, I've updated the PR with details.

@AnkushMalaker
Copy link
Contributor Author

The thing to note here is that with my devkit, some of the frames are failing to decode

 LOG  Received message from backend: Received 37 bytes (decoding failed)
 LOG  Received message from backend: Received and decoded 41 bytes
 LOG  Received message from backend: Received and decoded 42 bytes
 LOG  Received message from backend: Received and decoded 36 bytes
 LOG  Received message from backend: Received and decoded 50 bytes
 LOG  Received message from backend: Received and decoded 40 bytes
 LOG  Received message from backend: Received 42 bytes (decoding failed)
 LOG  Received message from backend: Received 37 bytes (decoding failed)
 LOG  Received message from backend: Received and decoded 36 bytes
 LOG  Received message from backend: Received 37 bytes (decoding failed)
 LOG  Received message from backend: Received and decoded 38 bytes
 LOG  Received message from backend: Received 37 bytes (decoding failed)
 LOG  Received message from backend: Received and decoded 36 bytes
 LOG  Received message from backend: Received and decoded 48 bytes

This COULD indicate the root behind the clicking, I'm not sure.
It should take at max 5 minutes to run this example end-to-end and validate if this happens on other devices.

@beastoin
Copy link
Collaborator

beastoin commented Apr 8, 2025

The Omi SDKs are designed to support functionalities of the Omi device when connected directly to a specific platform. The back-end shouldn't be involved here.

If you're just trying to debug the clicking issue from the device, I suggest starting by answering the following question:

  1. Are the audio bytes transmitted from the Omi device to your computer (or phone), via an app using the Omi SDK, clean? In other words, is the clicking issue happening at that stage?

I will keep the PR here in a week to see if we could find the value of merging this PR or not.

Keep diving man.

@AnkushMalaker

@AnkushMalaker
Copy link
Contributor Author

See, and that's exactly why I think we need an example backend at the very least that shows how to interact with the data from these sdks.
There are just two key points here:
Strip header, decode opus.

But I'm getting decoding errors. Could I have been doing something wrong? Not sure. Again, that's why we may need an example.

Without the decoded audio (without corruption), being saved to a .wav file properly, I can't verify if the audio is clean.

@skywinder
Copy link
Collaborator

I will keep the PR here in a week to see if we could find the value of merging this PR or not.

Just want to clarify: this pull request should be treated as an open issue related to the clicking sound. We should not merge it unless we find it genuinely helpful, but it’s useful to keep it open while the issue exists, as it significantly helps with debugging.

Once we identify the root cause and figure out how to fix it, we can decide whether this PR is still needed — and either merge it if it’s useful, or close it if not.

But please don’t close it yet — it’s important to keep the thread active so we can continue working on the issue and tracking the research progress here.


## Running the backend

1. Install [uv](https://docs.astral.sh/uv/)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

about installing UV — I don’t want to install one more thing on my laptop. Could you wrap it in Docker, so I can just run the server without modifying the system?

@skywinder
Copy link
Collaborator

Also, please, for the whole team and for people who don’t know what it’s about, explain why it’s needed and in which cases to use it, so everyone can review and fully understand its purpose here.

Some people might think it should be outside and just referenced from the repo. If it’s an essential part of debugging, then it needs to be explained clearly right here, so others can easily understand it without searching, googling, or asking questions.

So please make these changes to keep it simple for everyone.

@skywinder skywinder marked this pull request as draft April 13, 2025 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants