This is a Unity sample project that uses the VorbisPlugin to save and load audio data in Vorbis format. You can checkout this repository. The latest released binaries are inside Assets/VorbisPlugin/Plugins/ folder
The latest releases you'll find in VorbisPlugin repository
string pathToFile = ...;
UnityEngine.AudioClip audioClip = OggVorbis.VorbisPlugin.Load(pathToFile);
string pathToFile = ...;
UnityEngine.AudioClip audioClip = ...;
float quality = 0.4f; // optional parameter, values from 0 to 1 (https://xiph.org/vorbis/doc/vorbisenc/overview.html)
OggVorbis.VorbisPlugin.Save(pathToFile, audioClip, quality);
byte[] sourceAudioBytes = ...;
UnityEngine.AudioClip sourceAudioClip = OggVorbis.VorbisPlugin.ToAudioClip(sourceAudioBytes, "NameOfAudioClip");
UnityEngine.AudioClip sourceAudioClip = ...;
float quality = 0.4f; // optional parameter, values from 0 to 1 (https://xiph.org/vorbis/doc/vorbisenc/overview.html)
byte[] bytes = OggVorbis.VorbisPlugin.GetOggVorbis(sourceAudioClip, quality);
- Mono, one channel audio
- Stereo, two channels audio
- Windows: x86, x86_64
- Android: arm64-v8a, armeabi-v7a, x86, x86_64
- iOS: aarch64
- Mac OSX: x86_64
- Windows: x86_64
- Android: arm64-v8a
- iOS: aarch64
- Mac OSX: x86_64
- 2021.1.2f1
- 2019.1.12f1
- Checkout or download this repository
- Open UnityClient project in Unity editor
- Open Assets/_Presentation/Scene/Main.scene
- Run the app
- Press "Save Ogg Audio" to store the source Audio clip at runtime to local storage
- Press "Load Ogg Audio" to load stored in local storage ogg audio file
In case you need some specific platform for the plugin, you can build the libraries yourself. Detailed instructions for building the C wrapper native libraries you'll find here After you build the C libraries, you need to copy it to Assets/VorbisPlugin/Plugins folder:
- Assets/Plugins/Windows/x86_64/VorbisPlugin.dll
- Assets/Plugins/VorbisPlugin/Android/libs/arm64-v8a/libVorbisPlugin.so
- Assets/Plugins/VorbisPlugin/Android/libs/armeabi-v7a/libVorbisPlugin.so
- Assets/Plugins/VorbisPlugin/Android/libs/x86/libVorbisPlugin.so
- Assets/Plugins/VorbisPlugin/Android/libs/x86_64/libVorbisPlugin.so
- Assets/Plugins/VorbisPlugin/OSX/libVorbisPlugin.dylib
- Assets/Plugins/VorbisPlugin/iOS/libogg.a
- Assets/Plugins/VorbisPlugin/iOS/libvorbis.a
- Assets/Plugins/VorbisPlugin/iOS/libvorbisfile.a
- Assets/Plugins/VorbisPlugin/iOS/libVorbisPlugin.a