We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi
I'm really trying to understand why the following happens. Any insight would be super useful. 🤪
I have set the following settings from an audio-in readable stream:
sampleRate: 44100 sampleFormat: 16 // 2 bytes per sample per channel channelCount: 12 // sound card with 12 inputs (6x Left/Right) highwaterMark = 12 * 2 * 512 // (12 open channels) * (2 bytes per frame) * (512 frames per buffer) = 12288 bytes
I'd think that the buffer-callback gets called +- 86 times per second: 44100 samples per second / 512 samples = 86.1328125
Yet, when I manually count the amount of buffer-callbacks, I get 172, which is exactly the double. Here's the code how I count the buffer-callback:
let prevTimestamp = 0 let processedBuffersInSecond = 0 this.stream.on(`data`, (buffer) => { processedBuffersInSecond++ if(buffer.timestamp - prevTimestamp > 1) { console.log(`Buffers processed in 1 sec: ${processedBuffersInSecond}, ${this.sampleRate} / ${this.framesPerBuffer} = ${this.sampleRate / this.framesPerBuffer}`) processedBuffersInSecond = 0 prevTimestamp = buffer.timestamp } })
# Output Buffers processed in 1 sec: 172, 44100 / 512 = 86.1328125 Buffers processed in 1 sec: 172, 44100 / 512 = 86.1328125 Buffers processed in 1 sec: 172, 44100 / 512 = 86.1328125 Buffers processed in 1 sec: 173, 44100 / 512 = 86.1328125 Buffers processed in 1 sec: 172, 44100 / 512 = 86.1328125 Buffers processed in 1 sec: 172, 44100 / 512 = 86.1328125 Buffers processed in 1 sec: 172, 44100 / 512 = 86.1328125
Why is this? Am I missing something?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi
I'm really trying to understand why the following happens.
Any insight would be super useful. 🤪
I have set the following settings from an audio-in readable stream:
I'd think that the buffer-callback gets called +- 86 times per second:
44100 samples per second / 512 samples = 86.1328125
Yet, when I manually count the amount of buffer-callbacks, I get 172, which is exactly the double.
Here's the code how I count the buffer-callback:
Why is this? Am I missing something?
The text was updated successfully, but these errors were encountered: