rodio icon indicating copy to clipboard operation
rodio copied to clipboard

Feature: ChannelRouter

Open iluvcapra opened this issue 1 year ago • 10 comments

This is an implementation of a multichannel router/mixer source. See #653.

iluvcapra avatar Dec 07 '24 22:12 iluvcapra

BTW I'm working on a separate project right now to try to profile all these different approaches, once I have that I'll post what I find and then we can move forward with this.

iluvcapra avatar Dec 11 '24 20:12 iluvcapra

BTW I'm working on a separate project right now to try to profile all these different approaches, once I have that I'll post what I find and then we can move forward with this.

very cool, I'm curious to see if what ends up as best lines up with our suspicions

yara-blue avatar Dec 12 '24 13:12 yara-blue

For mixing several input streams we can use similar class that uses the same algorithm but accepts several Sources at once. Our existing mixer only sums all inputs without any volume adjustments,

PetrGlad avatar Dec 19 '24 19:12 PetrGlad

For mixing several input streams we can use similar class that uses the same algorithm but accepts several Sources at once. Our existing mixer only sums all inputs without any volume adjustments,

Isn't the better way to do this to have users wrap the streams they are mixing in a Volume struct?

yara-blue avatar Dec 20 '24 12:12 yara-blue

Yes, it is a simpler solution. Maybe we could add and example or make some kind of cookbook.

I was just pondering whether an über-mixer might be useful (the one like in this PR but allowing multiple inputs). For sparse matrix representation this would be straightforward to adapt (or have another more advances version).

By he way, the router in this PR should also handle situation when number of input channels change. At least for current API this is required.

PetrGlad avatar Dec 20 '24 16:12 PetrGlad

make some kind of cookbook.

I really like that idea! Sink/Player will be easy to use but the power of rodio lies in connecting the sources in an audio pipeline. We could have a bunch of examples but a cookbook is way nicer!

yara-blue avatar Dec 20 '24 16:12 yara-blue

@iluvcapra Would you mind if we merge this PR as is, so we can iterate or improve on this? The implementation can likely be further polished but it seems functional already, but we can have it gated as an experimental API.

PetrGlad avatar Jan 01 '25 18:01 PetrGlad

I've pulled this up to the upstream, we can merge it or I can keep working on it. I've been doing my active tinkering in my (unpublished) benchmark project but this all works, I've included an example as well.

iluvcapra avatar Jan 01 '25 19:01 iluvcapra

I've pulled this up to the upstream, we can merge it or I can keep working on it. I've been doing my active tinkering in my (unpublished) benchmark project but this all works, I've included an example as well.

It sounds like your still having fun? As long as that's true keep it up. We can merge it whenever your done with it, we have all the time in the world. If this PR becomes a chore then let us know, we don't want that open source has to be fun.

yara-blue avatar Jan 02 '25 10:01 yara-blue

Just to show what I had in mind in my proposals before #671 (my favorite version).

PetrGlad avatar Jan 07 '25 17:01 PetrGlad