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

Opus format with Ogg codec for BufferStream #161

Merged
merged 53 commits into from
Jan 27, 2025
Merged

Opus format with Ogg codec for BufferStream #161

merged 53 commits into from
Jan 27, 2025

Conversation

alnitak
Copy link
Owner

@alnitak alnitak commented Dec 29, 2024

Description

BufferType to use in setBufferStream, now support also opus as data type. When adding audio chunks using addAudioDataStream using Opus, it now expects to receive a stream of an Opus file.
This can be useful for example when you have a stream coming from a network and you want to play it in real-time. Tested with the Opus coming from OpenAI's Text-To-Speech APIs.

To achieve this I've used Xiph Ogg and Opus libraries.

working on

  • Linux
  • Android
  • Windows
  • iOS
  • MacOS
  • Web

Use external Xiph libraries where possible:

  • Linux
  • MacOS

This means the opus and ogg libraries are embedded in iOS, Android, and Windows. On MacOS and Linux, you should install them with brew install libogg opus or with your distribution's package manager. If not installed, it compiles anyway, but it will throw if you want to use the opus streaming feature.


To avoid future incompatibilities when using other WASM compiled plugins, it is now necessary to add init_module.dart.js script to index.html:

<script src="assets/packages/flutter_soloud/web/libflutter_soloud_plugin.js" defer></script>
<script src="assets/packages/flutter_soloud/web/init_module.dart.js" defer></script>

By default when compiling a WASM library the default name for the JS module is Module and AFAIK only one can exist. Now the module name is called Module_soloud and it needs to be initialized.


Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@alnitak alnitak marked this pull request as ready for review January 27, 2025 17:59
@alnitak alnitak merged commit 06c67b6 into main Jan 27, 2025
1 check passed
@alnitak alnitak deleted the opus branch January 27, 2025 17:59
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.

1 participant