Skip to content
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

Play raw data #919

Open
LeoChensj opened this issue Nov 28, 2024 · 2 comments
Open

Play raw data #919

LeoChensj opened this issue Nov 28, 2024 · 2 comments
Labels

Comments

@LeoChensj
Copy link

Hello, I am using this library and encountered an issue during the process. I need to play multiple remote MP3 files continuously. Initially, I used connecttohost() to sequentially play the files as each file finished playing. However, because the next file is downloaded only after the current one finishes playing, there’s a significant delay between files, which makes the playback not very smooth.

So I tried a second approach: running two tasks. One task handles playback (using connecttoFS(SD_MMC)), and the other downloads the next audio file and saves it to the SD card, waiting for playback. However, a new issue arose—since both tasks access the SD card simultaneously (even though one is reading and the other is writing), occasional crashes occur when the File object is being read or written.

Then, I tried a third approach: again running two tasks, one for playback (using connecttoFS(SD_MMC)) and the other for downloading the next audio file. This time, instead of saving the file to the SD card, I stored the downloaded data in PSRAM. Before playback (i.e., before connecttoFS(SD_MMC)), the data in PSRAM is saved to the SD card. This avoids simultaneous read/write operations on the SD card. However, since the file must be completely saved before playback can start (saving takes around 500ms), there’s still a gap between MP3 files. Although this gap is within an acceptable range, it’s still not perfect.

Therefore, I was wondering if it’s possible to provide an API for directly playing raw data (e.g., connecttoRawData(uint8_t *data, size_t len)). This would eliminate the need to save data to the SD card (saving around 500ms), resulting in smoother playback.

Thank you for reading, and I look forward to your feedback.

@LeoChensj
Copy link
Author

@schreibfaul1 I look forward to your feedback.

Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant