alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [alsa-devel] Custom Kernel driver to open and use another ALSA PCM
@ 2019-10-02 13:24 ed nwave
  2019-10-04 11:19 ` Kai Vehmanen
  0 siblings, 1 reply; 3+ messages in thread
From: ed nwave @ 2019-10-02 13:24 UTC (permalink / raw)
  To: alsa-devel

Hello,

A little bit of an unorthodox request but I need my custom PCM driver to
connect directly to another PCM driver if possible. I have an application
that already sees my custom PCM driver as the connected sound card, but I
also need to pipe the PCM data within my driver after altering it out to
another PCM of my choice ( my actual sound card ).

As an example, my PCM driver acts as a sound card connected to a microphone
capture application, within the my custom PCM I've added various "dalek"
and other voice changing alterations and now I need to output this stream
into my actual sound card.
The sound card I need my driver to import or connect to is a DAC over USB
and I believe the loaded kernel module is snd_sub_audio which I can see via
lsmod. It's PCM hw:1,0.

So is this possible? An if so, how? Even the most basic information would
be appreciated.

Thanks.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [alsa-devel] Custom Kernel driver to open and use another ALSA PCM
  2019-10-02 13:24 [alsa-devel] Custom Kernel driver to open and use another ALSA PCM ed nwave
@ 2019-10-04 11:19 ` Kai Vehmanen
       [not found]   ` <CACtB+u17_napoSXO0L+NhJ7r0abZCN2hMXMTRg8OAtJc+hXFKw@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Kai Vehmanen @ 2019-10-04 11:19 UTC (permalink / raw)
  To: ed nwave; +Cc: alsa-devel

Hi,

On Wed, 2 Oct 2019, ed nwave wrote:

> A little bit of an unorthodox request but I need my custom PCM driver to
> connect directly to another PCM driver if possible. I have an application
[...]
> As an example, my PCM driver acts as a sound card connected to a microphone
> capture application, within the my custom PCM I've added various "dalek"
> and other voice changing alterations and now I need to output this stream

I have to ask why you are doing this in kernel? From performance and 
latency point of view, PCM processing should be in user-space (see e.g. 
JACK and Pulseaudio for old examples).

Br, Kai
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [alsa-devel] Custom Kernel driver to open and use another ALSA PCM
       [not found]   ` <CACtB+u17_napoSXO0L+NhJ7r0abZCN2hMXMTRg8OAtJc+hXFKw@mail.gmail.com>
@ 2019-10-04 14:33     ` Kai Vehmanen
  0 siblings, 0 replies; 3+ messages in thread
From: Kai Vehmanen @ 2019-10-04 14:33 UTC (permalink / raw)
  To: ed nwave, alsa-devel

Hi,

(routing back to alsa-devel, Ed's alsa-devel subscription is still
pending so he can't sent to the list, forwarding with his permission)

On Fri, 4 Oct 2019, ed nwave wrote:

> The example used of a voice changing app was just an illustration of how 
> I need to connect "my driver" directly to a sound card driver that's 
> all. I understand the user-space comment entirely.   The actual 
> objective is one common driver ( my PCM driver ) being used by 4 music 
> applications where I can dynamically switch the output PCM without 
> restarting the applications or the applications even knowing the output 
> cards not real. 

so far this is pretty much directly from original design goals of JACK.
But ok, then you mention this:

> I must have direct access to audio hardware i.e. hw:1,0 
> for applications like RoonReady/ RAAT. So Pulseaudio's out. I require 
> the ability to

Now this can be a problem of course if you cannot modify the apps.
The you would have to route this via alsa-lib plugins.

> follow ( like and MPD playlist ). As I understand Jack is set for a 
> certain rate and format at the start when connecting and does not update 
> rates automatically if the rate of the songs change; can jack connect 
> directly to hw and handle DSD rates?. This is all part of a headless 

I've been out of the loop for some years now, but no, I don't think JACK 
supports these. But you are anyways customizing quite a lot of SW, so 
you could e.g. consider extending JACK and/or some other audio 
server for this purpose, or just write a new one. 

> Other requirements are my applications must have no plugins or dmix and 
> connect directly to hardware i.e. hw:1,0 - due to rate demands, no 
> remixing. Another requirement is the latency required by one company to 
> attain multi-room streaming being about 1ms max, this is for 
> certification. Finally there's the need to change bit rate settings 

I think reaching the latency requirement (and not doing mixing) can 
certainly be done in user-space, so I still read the "need to access 
harwdare directly" more as "existing user-space components are not 
suitable for my needs" than a strict requirement for doing this in kernel.

But alas, I get your context and I understand these constraints are real 
for you as well. Just wanted to make sure you have taken good enough look 
at user-space options.

> All that's left for me to do is to connect pipe the data directly to the 
> driver for the my sound card. Question is can it be done? And if so, 
> where do I even start? How can I import snd_usb_audio and open it so it 
> appears a the typical snd_card struct?

The longrunning trend has been to push stuff like this to user-space, so 
you will not find much examples. I haven't done this myself, so I'll let 
other people make recommendations. I'd start by looking at ALSA OSS 
emulation and the virtualized drivers we have (like sound/xen/).

Br, Kai
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

end of thread, other threads:[~2019-10-04 14:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-02 13:24 [alsa-devel] Custom Kernel driver to open and use another ALSA PCM ed nwave
2019-10-04 11:19 ` Kai Vehmanen
     [not found]   ` <CACtB+u17_napoSXO0L+NhJ7r0abZCN2hMXMTRg8OAtJc+hXFKw@mail.gmail.com>
2019-10-04 14:33     ` Kai Vehmanen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).