mattvperry / opus-ruby Goto Github PK
View Code? Open in Web Editor NEWRuby FFI module for the OPUS Audio Codec
License: MIT License
Ruby FFI module for the OPUS Audio Codec
License: MIT License
test.rb
require 'opus-ruby'
# Create new encoder with a sample rate of 48 kHz, a frame size of 480 bytes and 1 channel
encoder = Opus::Encoder.new 48000, 480, 1
# Set the bitrate to 32 kbit/s
encoder.bitrate = 32000
# Set the VBR rate to 0 (CBR)
encoder.vbr_rate = 0
# Encode some raw audio
encoded = encoder.encode(raw_audio, 960)
# Safely destroy encoder
encoder.destroy
ruby test.rb
in <main>': undefined local variable or method
raw_audio' for main:Object (NameError)
I want record audio from system audio device
Hello!
Thank you so much for the Opus ruby gem.
It's been working like a charm for my own needs and has been happily chugging along inside mf DIY smart home code to give me high quality audio transmissions.
Recently I've come across a different encoding that I'd like to try, due to it being specifically designed for low processing power systems such as the ESP32 - The LowComplexity3 encoding scheme, mainly meant for BLE audio transmission.
It might be able to encode and decode audio with less effort than Opus, which would be better for the ESP (Opus encoding at 16kHz samples takes about 70% CPU already, and quite a chunk of RAM per decoder as well).
I'm mainly asking for your help in creating FFI bindings, as I've never done it before.
The LC3 codec source code is available on GitHub in c, with a very similar interface to the Opus codec, so it shouldn't be very different.
Best regards,
Xasin
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.