Comments (13)
Opus doesn't support 44100 internally. I'm guessing that the rate 44100 you
see is the decoded data sample rate for playback. If you attach a sample
file I can take a look at it.
On Sun, 6 Nov 2016 at 14:34 Rotem [email protected] wrote:
Hi,
I'm streaming from recorderjs to node-opus.
On the server when I read the header file it seems like it is still
44100.I also tried to run opusinfo, and still it is 44100.
Do I miss anything?this is how I use it on the client:
var rec = new Recorderjs.Recorder({
encoderPath:'libs/recorderjs/encoderWorker.min.js',
streamPages:true,
encoderSampleRate:48000
});On the server, using node-opus I do:
var oggDecoder = new ogg.Decoder();
var opusDecoder=null;
var wavWriter = null;
var fsOpus = fs.createWriteStream(opusFile);
oggDecoder.on('stream',function (oggStream) {
opusDecoder = new opus.Decoder();
opusDecoder.on('format', function (format) {
console.log(format);
wavWriter = new wav.FileWriter(pcmFile, {
channels: format.channels,
sampleRate: format.sampleRate,
bitDepth: format.bitDepth
});
opusDecoder.pipe(wavWriter);
});
oggStream.pipe(opusDecoder);}) stream.pipe(oggDecoder); stream.pipe(fsOpus);
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#60, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAe7gw4MeoEuznIPtcfCn55ZBmcziSPfks5q7ivTgaJpZM4KqpxP
.
from opus-recorder.
Sure,
Thank you!
See attached.
in.opus.txt
from opus-recorder.
This is the opusinfo output for your file. What part about this doesn't look right to you?
New logical stream (#1, serial: f07d0bd4): type opus Encoded with Recorder WARNING: EOS not set on stream 1 (normal for live streams) Opus stream 1: Pre-skip: 3840 Playback gain: 0 dB Channels: 1 Original sample rate: 44100Hz Packet duration: 20.0ms (max), 20.0ms (avg), 20.0ms (min) Page duration: 3700.0ms (max), 3700.0ms (avg), 3700.0ms (min) Total data length: 23777 bytes (overhead: 1.31%) Playback length: 0m:03.620s Average bitrate: 52.55 kb/s, w/o overhead: 51.86 kb/s
from opus-recorder.
Original sample rate: 44100Hz
means that the original audio had a bandwidth of 44100Hz. Judging from your code snippets, it was then up-sampled to 48000Hz for encoding with opus. This all looks as expected.
from opus-recorder.
I'm getting an error from node-opus (Maybe it related to node-opus)
Error: Could not create decoder. Check the decoder parameters
When looking into node-opus code, it seems like it sends the header sampleRate to the opus decoder, and opus decoder does not support it.
Any idea what's going on? If for example I modify the code and hard code 48000, it works.
from opus-recorder.
Yeah, seems that node-opus is using the header defined sample rate to try and decode. I opened an issue here: Rantanen/node-opus#20
from opus-recorder.
Ok. Thanks,
Still, if I try to play the file after the decoding.. it different (like slower..)
from opus-recorder.
Likely because you are decoding at 48000 Hz and then playing it back at 44100Hz without resampling?
from opus-recorder.
Ok, so I need to downsample it then... Thank you for the help. Do you know if there is a library that downsample?
from opus-recorder.
Lots of them. Easiest would probably be to pipe your output to SOX.
Never tried this, but it might do the trick: https://www.npmjs.com/package/sox
from opus-recorder.
Ok,
Thank you!
I think we should close this issue as it is not related to recorderjs.
from opus-recorder.
See my pull request on node-opus:
Rantanen/node-opus#21
Hope that should solve it.
from opus-recorder.
Cool. 👍
from opus-recorder.
Related Issues (20)
- How to use with Vite? HOT 5
- 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)
- 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
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.