Comments (9)
I had the decode audio logic in the lib, but decided to remove it, because:
- Decoding and playback is outside the scope of a recording lib.
- Up to date browsers can usually play ogg audio with the audio tag.
You can reference the decoder code here
Alternatively, perhaps there is a way to get the PCM out of an audio tag?
from opus-recorder.
Makes perfect sense that you removed it :) In my case I can't use the <audio>
element or new Audio
because I require an offlineAudioContext
, which is a bit of a bummer as they don't support MediaElementAudioSourceNode
s!
One question from me: the decode
function takes packets. How does that map to the ogg file blob? Do I convert over to an arraybuffer
and fire it into that function, or do I need to break it up in some way first? Sorry for the noob questions, and thank you again for all your hard work on this.
from opus-recorder.
To get the packets out of an ogg file, you will need to parse each page, and then parse the segment table to get the packet boundaries. I've seen some libs around which can do this. I think speex.js has something and perhaps aurora.js as well.
https://github.com/jpemartins/speex.js/blob/master/src/ogg.js
https://github.com/audiocogs/ogg.js/releases
from opus-recorder.
If you can follow the logic after encode(), you need to do the same, but backwards.
from opus-recorder.
I have created a new branch for opus only operation. I have included a decoder for completeness. It has not been documented or thoroughly tested, but the happy path is working. Check it out if you are still in need.
from opus-recorder.
Merged decoder which allows decoding back to buffers.
from opus-recorder.
Oh boy, I'm only just catching up on this. It's super that you broke them out to two separate scripts - thank you!
from opus-recorder.
@chris-rudmin Any chance you could write a little documentation on how to use the decoding script? I'm trying to use your excellent library to record audio for Twilio, which only accepts mp3, wav, aiff or ulaw, but unfortunately not ogg/opus. So I can either store the files as ogg on the server and transcode with ffmpeg before sending to Twilio, or get access to the buffers after downsampling and save them as wav.
from opus-recorder.
You create a worker with the decoder and then pass it a typed array with your encoded data along with the decode command. Sounds like it might be easier to use the original recorder is and record wav.
I will add some documentation when I get some time.
from opus-recorder.
Related Issues (20)
- The first recording is not saved in Safari on IOS 15.1 HOT 1
- Robotic, torn audio on IOS 15.1 HOT 3
- Issue while using decoder with React application HOT 11
- Recorder output file size too small - Vue.js HOT 4
- building and running on windows 10 HOT 4
- Error running waveRecorder.html example HOT 3
- using waveform-playlist with opus-recorder HOT 1
- Uncaught TypeError: Cannot read properties of undefined (reading 'length')
- Not working with Vite + Vue 3
- wasm streaming compile failed: TypeError: Could not download wasm module falling back to ArrayBuffer instantiation how can i resolve this issue ? HOT 3
- Convert 16 bit signed int to 32 bit float HOT 8
- Audio distorted after 30 seconds HOT 6
- few seconds of recording are missing at the beginning (especially on IOS) HOT 1
- Play pages real-time HOT 2
- ondataavailable not fired with waveWorker
- TypeScript definitions HOT 1
- Opus Player
- Is it possible to Decode two audio sources HOT 4
- Error webassembly.compile HOT 1
- Glitches in waveform on Chrome HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opus-recorder.