Closed MHebes closed 4 months ago
I'm sorry I can't help you, I'm new to nodejs streams. Have you found a solution to your problem? I am interested in the solution. I'm currently working on a Discord bot that retrieves the voice streams of two (or more) people in a channel. To mix these streams together, then make the bot output it.
@olivbau No, haven’t been able to figure out the problem yet. Once I do I’ll close this issue. You can also try using the code I posted and see how it works for you — maybe the issue doesn’t manifest itself with your use case.
It seems there has been no activity on this issue for a while, and it is being closed in 30 days. If you believe this issue should remain open, please leave a comment. If you need further assistance or have questions, you can also search for similar issues on Stack Overflow. Make sure to look at the README file for the most updated links.
It seems there has been no activity on this issue for a while, and it is being closed. If you believe this issue should remain open, please leave a comment. If you need further assistance or have questions, you can also search for similar issues on Stack Overflow. Make sure to look at the README file for the most updated links.
I also created a stackexchange code review post about this, but now realize that I have a bug, so it's not really suited for code review yet.
Below is mostly a summary from that post:
Background
I am writing a
Readable
implementation which takes multiple input streams (in Buffer mode). It aligns the inputs' data on 16-bit boundaries, and sums up their respective bytes as if they were 16-bit LE integers. It then outputs those sums.It's essentially a modified implementation of the default
Transform
, where instead ofpipe
ing in you just pass yourReadable
into anaddInput(...)
method.Streams can be added/removed from the input list at any time while running.
This is used to mix together two 16-bit 2-channel PCM audio streams. This output is fed to a discord bot, which eventually sends the audio over a stream to a discord client.
For example:
Problem
I have this mostly working, but after adding and removing a few test streams, it will eventually start dropping data. It seems to play just the first part of chunks, and then skips to the first part of the next chunk.
This behavior doesn't show up in my
test.ts
(see the linked stackexchange post).The only way I've been able to reproduce the behavior is by actually running my discord bot and playing a few test songs. The first few songs play fine, but eventually it starts skipping forward in the song.
Can anyone take a look at
mixer.ts
below and see if I'm making any obvious errors with how I'm forwarding the input streams' data? I seem to be dropping a lot of it somewhere.I'll try to record an example of the issue happening.
Code
(This is also in the discord bot repo (branch
rewrite-index
/ hashd206e9aa
at time of posting), and in the stackexchange post.mixer.ts
I know this is a lot to parse. Any help is appreciated, or even any ideas about how to find the bug would be extremely helpful.