How Zoyra finds and plays a song in about a second
A small gateway, a Java extractor and a few caching tricks keep search fast and playback smooth.
When you tap a song, three things have to happen quickly: find it, get a playable audio address, and deliver the audio to your phone. Here is how Zoyra does each one.
Two small services
The backend is two programs that run together. A Python gateway (FastAPI) is the only thing the app talks to. Behind it, a Java service uses the NewPipe extractor library to search and to find audio streams. The gateway handles the app’s API key, rate limits and caching, and the Java service stays private on the same machine.
Search without the jump
A search asks for songs first and artists second, and the app shows a skeleton while it waits. That stops the common flicker where artists appear first and then songs push them down. Results come in two tiers: a quick first page of 20 songs, then a larger page of 50 once you keep looking.
Streaming through the gateway
Audio addresses from the source are tied to the IP address that asked for them, so the phone cannot use them directly. The gateway fetches the audio and passes it on, supporting the HTTP Range header so the player can seek. It follows redirects only to the music host’s own https addresses, and it sends an open-ended range upstream so streams are never cut short.
- The first play of a new song takes about a second.
- The app looks up the top few search results in advance, so tapping one feels instant.
- Each listener uses roughly 128 kbps.
Downloads as real files
Offline downloads are converted to mp3 on the server with ffmpeg, with at most two conversions running at once so the machine stays responsive.
Lyrics
Synced lyrics come from the open LRCLIB database and are reshaped into the format the app uses: a list of lines with timestamps.