All of lore.kernel.org
 help / color / mirror / Atom feed
* Possibility of routing at the kernel level
@ 2018-08-24  6:27 Mark Farrugia
  2018-08-27  5:57 ` Mark Farrugia
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Farrugia @ 2018-08-24  6:27 UTC (permalink / raw)
  To: alsa-devel; +Cc: James O'Shannessy, Tharindu De Silva

Hi all,

I am currently using the ALSA loopback driver to create a "virtual"
sound card to abstract underlying real sound cards.  I capture from
the loopback in user-space, and then subsequently playback to a real
sound card.

The issue with this is that there is a significant latency introduced
(~100ms) due to the number of transitions of the stream from user to
kernel space. I am seeking a way to avoid this.

My question is this: is there any way of routing PCM substreams at the
kernel level, so that we can avoid the need to pipe audio back up to
user-space with the loopback capturer?  If there is no current
solution that would achieve this, I would proposition to design and
implement a system that uses a top-level ALSA driver, which then
routes dynamically to one or many subscribed lower-level "audio path"
drivers.  The system would also have the option to loopback upon
itself.

Does anyone see any reason that I couldn't (or shouldn't) attempt such
a solution? All feedback is welcome.

Regards,
Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Possibility of routing at the kernel level
  2018-08-24  6:27 Possibility of routing at the kernel level Mark Farrugia
@ 2018-08-27  5:57 ` Mark Farrugia
  2018-09-03 13:01   ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Farrugia @ 2018-08-27  5:57 UTC (permalink / raw)
  To: alsa-devel
  Cc: Greg Kroah-Hartman, Fulup Ar Foll, James O'Shannessy,
	Tharindu De Silva

Hi all,

Following my initial proposition on Friday for kernel-space audio
routing, we at Fiberdyne Systems have since published our initial
source for such a solution, which we are calling ALSA Virtual Driver,
or simply AVIRT.

Please find the source here for your perusal:
https://github.com/fiberdyne/avirt

Currently we use module parameters for the kernel module, however, we
will be porting configuration to another system, such as
configfs/sysfs.

We are completely open to suggestions and constructive criticism.

Regards,
Mark

On Fri, Aug 24, 2018 at 4:27 PM Mark Farrugia
<mark.farrugia@fiberdyne.com.au> wrote:
>
> Hi all,
>
> I am currently using the ALSA loopback driver to create a "virtual"
> sound card to abstract underlying real sound cards.  I capture from
> the loopback in user-space, and then subsequently playback to a real
> sound card.
>
> The issue with this is that there is a significant latency introduced
> (~100ms) due to the number of transitions of the stream from user to
> kernel space. I am seeking a way to avoid this.
>
> My question is this: is there any way of routing PCM substreams at the
> kernel level, so that we can avoid the need to pipe audio back up to
> user-space with the loopback capturer?  If there is no current
> solution that would achieve this, I would proposition to design and
> implement a system that uses a top-level ALSA driver, which then
> routes dynamically to one or many subscribed lower-level "audio path"
> drivers.  The system would also have the option to loopback upon
> itself.
>
> Does anyone see any reason that I couldn't (or shouldn't) attempt such
> a solution? All feedback is welcome.
>
> Regards,
> Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Possibility of routing at the kernel level
  2018-08-27  5:57 ` Mark Farrugia
@ 2018-09-03 13:01   ` Takashi Iwai
  2018-09-04  0:39     ` Mark Farrugia
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2018-09-03 13:01 UTC (permalink / raw)
  To: Mark Farrugia
  Cc: Greg Kroah-Hartman, alsa-devel, Tharindu De Silva, Fulup Ar Foll,
	James O'Shannessy

On Mon, 27 Aug 2018 07:57:00 +0200,
Mark Farrugia wrote:
> 
> Hi all,
> 
> Following my initial proposition on Friday for kernel-space audio
> routing, we at Fiberdyne Systems have since published our initial
> source for such a solution, which we are calling ALSA Virtual Driver,
> or simply AVIRT.
> 
> Please find the source here for your perusal:
> https://github.com/fiberdyne/avirt
> 
> Currently we use module parameters for the kernel module, however, we
> will be porting configuration to another system, such as
> configfs/sysfs.
> 
> We are completely open to suggestions and constructive criticism.

Did you try snd-aloop driver?  I'm not advocating it (as it doesn't
mean a better latency), but it's often an option.


thanks,

Takashi

> 
> Regards,
> Mark
> 
> On Fri, Aug 24, 2018 at 4:27 PM Mark Farrugia
> <mark.farrugia@fiberdyne.com.au> wrote:
> >
> > Hi all,
> >
> > I am currently using the ALSA loopback driver to create a "virtual"
> > sound card to abstract underlying real sound cards.  I capture from
> > the loopback in user-space, and then subsequently playback to a real
> > sound card.
> >
> > The issue with this is that there is a significant latency introduced
> > (~100ms) due to the number of transitions of the stream from user to
> > kernel space. I am seeking a way to avoid this.
> >
> > My question is this: is there any way of routing PCM substreams at the
> > kernel level, so that we can avoid the need to pipe audio back up to
> > user-space with the loopback capturer?  If there is no current
> > solution that would achieve this, I would proposition to design and
> > implement a system that uses a top-level ALSA driver, which then
> > routes dynamically to one or many subscribed lower-level "audio path"
> > drivers.  The system would also have the option to loopback upon
> > itself.
> >
> > Does anyone see any reason that I couldn't (or shouldn't) attempt such
> > a solution? All feedback is welcome.
> >
> > Regards,
> > Mark
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Possibility of routing at the kernel level
  2018-09-03 13:01   ` Takashi Iwai
@ 2018-09-04  0:39     ` Mark Farrugia
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Farrugia @ 2018-09-04  0:39 UTC (permalink / raw)
  To: tiwai
  Cc: Greg Kroah-Hartman, alsa-devel, Tharindu De Silva, Fulup Ar Foll,
	James O'Shannessy

On Mon, Sep 3, 2018 at 11:01 PM Takashi Iwai <tiwai@suse.de> wrote:
>
> On Mon, 27 Aug 2018 07:57:00 +0200,
> Mark Farrugia wrote:
> >
> > Hi all,
> >
> > Following my initial proposition on Friday for kernel-space audio
> > routing, we at Fiberdyne Systems have since published our initial
> > source for such a solution, which we are calling ALSA Virtual Driver,
> > or simply AVIRT.
> >
> > Please find the source here for your perusal:
> > https://github.com/fiberdyne/avirt
> >
> > Currently we use module parameters for the kernel module, however, we
> > will be porting configuration to another system, such as
> > configfs/sysfs.
> >
> > We are completely open to suggestions and constructive criticism.
>
> Did you try snd-aloop driver?  I'm not advocating it (as it doesn't
> mean a better latency), but it's often an option.
>
>
> thanks,
>
> Takashi

We have tried snd-aloop, and this would otherwise be our adopted
solution, if not for the following issues:
1. The latency involved when looping back to user-space. We would
prefer to avoid unnecessary latency altogether if possible.
2. We wish to hold each input in a different SMACK security context -
aloop does not give a PCM device per input, but rather one PCM device,
with a substream per input. This is an issue since SMACK can only
apply one label per PCM device.
3. We want to dynamically construct the sound card PCM devices based
on user configuration.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-04  0:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-24  6:27 Possibility of routing at the kernel level Mark Farrugia
2018-08-27  5:57 ` Mark Farrugia
2018-09-03 13:01   ` Takashi Iwai
2018-09-04  0:39     ` Mark Farrugia

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.