All of lore.kernel.org
 help / color / mirror / Atom feed
* Sample format changes by plugin while playing
@ 2018-04-13 11:44 Robert Tiemann
  2018-04-19 11:18 ` Robert Tiemann
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Tiemann @ 2018-04-13 11:44 UTC (permalink / raw)
  To: alsa-devel

Hi,

I have a general question about ALSA plugins: Is it possible for an
ALSA plugin to reconfigure the sample rate and sample format of its
slave in such a way that the software playing through that plugin
wouldn't notice?

That is, given some audio stream, the plugin shall be allowed to
change the sample rate and format based on control data extracted from
the audio data pushed through the plugin. In my imagination, any
output format changes should be completely transparent to the sound
player; the player would always deliver a stream of audio data at a
constant rate, and once in a while the plugin would change the
hardware settings. For sure there would be an audible gap during
reconfiguration, but that would be OK for me.

Now, is this possible at all?

Best regards,
Robert

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

* Re: Sample format changes by plugin while playing
  2018-04-13 11:44 Sample format changes by plugin while playing Robert Tiemann
@ 2018-04-19 11:18 ` Robert Tiemann
  2018-04-19 13:53   ` Clemens Ladisch
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Tiemann @ 2018-04-19 11:18 UTC (permalink / raw)
  To: alsa-devel

On 04/13/2018 01:44 PM, Robert Tiemann wrote:

> I have a general question about ALSA plugins: ...

No answers yet. Is this the correct list to ask questions about ALSA
plugin development?

Best regards,
Robert

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

* Re: Sample format changes by plugin while playing
  2018-04-19 11:18 ` Robert Tiemann
@ 2018-04-19 13:53   ` Clemens Ladisch
  2018-04-19 14:22     ` Robert Tiemann
  0 siblings, 1 reply; 8+ messages in thread
From: Clemens Ladisch @ 2018-04-19 13:53 UTC (permalink / raw)
  To: alsa-devel

Robert Tiemann wrote:
> Is this the correct list to ask questions about ALSA plugin development?

Yes.

> Is it possible for an ALSA plugin to reconfigure the sample rate and
> sample format of its slave in such a way that the software playing
> through that plugin wouldn't notice?

In theory, yes.  But you'd have to implement most of this yourself.


Regards,
Clemens

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

* Re: Sample format changes by plugin while playing
  2018-04-19 13:53   ` Clemens Ladisch
@ 2018-04-19 14:22     ` Robert Tiemann
  2018-04-19 14:34       ` Ricard Wanderlof
  2018-04-19 15:57       ` Clemens Ladisch
  0 siblings, 2 replies; 8+ messages in thread
From: Robert Tiemann @ 2018-04-19 14:22 UTC (permalink / raw)
  To: alsa-devel


On 04/19/2018 03:53 PM, Clemens Ladisch wrote:

>> Is it possible for an ALSA plugin to reconfigure the sample rate and
>> sample format of its slave in such a way that the software playing
>> through that plugin wouldn't notice?
> 
> In theory, yes.  But you'd have to implement most of this yourself.

That's fine, I just wanted to know if this could possibly work and if
an ALSA plugin could be the right place for this kind of stuff. That
is, before diving into development and hitting any roadblocks only
much later.

I guess "in theory" means that you don't know about any plugin of such
kind I could take a look at, right?

Thank you,
Robert

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

* Re: Sample format changes by plugin while playing
  2018-04-19 14:22     ` Robert Tiemann
@ 2018-04-19 14:34       ` Ricard Wanderlof
  2018-04-20  7:15         ` Robert Tiemann
  2018-04-19 15:57       ` Clemens Ladisch
  1 sibling, 1 reply; 8+ messages in thread
From: Ricard Wanderlof @ 2018-04-19 14:34 UTC (permalink / raw)
  To: Robert Tiemann; +Cc: alsa-devel


On Thu, 19 Apr 2018, Robert Tiemann wrote:

> 
> On 04/19/2018 03:53 PM, Clemens Ladisch wrote:
> 
> >> Is it possible for an ALSA plugin to reconfigure the sample rate and
> >> sample format of its slave in such a way that the software playing
> >> through that plugin wouldn't notice?
> > 
> > In theory, yes.  But you'd have to implement most of this yourself.
> 
> That's fine, I just wanted to know if this could possibly work and if
> an ALSA plugin could be the right place for this kind of stuff. That
> is, before diving into development and hitting any roadblocks only
> much later.

I'm curious about this. Do you have a need to reconfigure the sample rate 
and format while a stream is playing? We had such a use case a while ago, 
where we had a source whose sample rate could change at any time, but ALSA 
sets up the stream configuration (sample rate etc) when the stream is 
opened (hw_params()) and it doesn't seem to be possible to reconfigure it 
on the fly. In the end we dropped the idea and solved the problem a 
different way.

/Ricard
-- 
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

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

* Re: Sample format changes by plugin while playing
  2018-04-19 14:22     ` Robert Tiemann
  2018-04-19 14:34       ` Ricard Wanderlof
@ 2018-04-19 15:57       ` Clemens Ladisch
  2018-04-20  7:37         ` Robert Tiemann
  1 sibling, 1 reply; 8+ messages in thread
From: Clemens Ladisch @ 2018-04-19 15:57 UTC (permalink / raw)
  To: alsa-devel

Robert Tiemann wrote:
> I guess "in theory" means that you don't know about any plugin of such
> kind I could take a look at, right?

No; most plugins force the configuration of the slave to be similar, and
to be done at the same time as their own.

PulseAudio does something similar to this, but it's much more complex
than just an ALSA plugin.


Regards,
Clemens

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

* Re: Sample format changes by plugin while playing
  2018-04-19 14:34       ` Ricard Wanderlof
@ 2018-04-20  7:15         ` Robert Tiemann
  0 siblings, 0 replies; 8+ messages in thread
From: Robert Tiemann @ 2018-04-20  7:15 UTC (permalink / raw)
  To: alsa-devel



On 04/19/2018 04:34 PM, Ricard Wanderlof wrote:

> I'm curious about this. Do you have a need to reconfigure the sample rate 
> and format while a stream is playing? We had such a use case a while ago, 

Sort of. The input format, however, is fixed in my case. The output
format may be different and must be recovered from the audio stream.
Infrequently, the output format will change while the input format
remains the same.

You can think about it as a compression scheme. I'd like to play such
audio streams without touching any players, that's why I thought about
writing an ALSA plugin for this.

> but ALSA sets up the stream configuration (sample rate etc) when the
> stream is opened (hw_params()) and it doesn't seem to be possible to
> reconfigure it on the fly

This is probably something that my plugin would have to do with its
slave. If this would possible during playback without disrupting the
player, then I'd take this route.

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

* Re: Sample format changes by plugin while playing
  2018-04-19 15:57       ` Clemens Ladisch
@ 2018-04-20  7:37         ` Robert Tiemann
  0 siblings, 0 replies; 8+ messages in thread
From: Robert Tiemann @ 2018-04-20  7:37 UTC (permalink / raw)
  To: alsa-devel


On 04/19/2018 05:57 PM, Clemens Ladisch wrote:
> Robert Tiemann wrote:
>> I guess "in theory" means that you don't know about any plugin of such
>> kind I could take a look at, right?
> 
> No; most plugins force the configuration of the slave to be similar, and
> to be done at the same time as their own.

So a plugin can configure its slave the way it likes? Would it be
possible to change the slave configuration multiple times during
playback (close/open slave would be OK for me)?

> PulseAudio does something similar to this, but it's much more complex
> than just an ALSA plugin.

I'd like to avoid PulseAudio for my case. Basically, I have the choice
between writing an ALSA plugin for a generic and transparent solution,
or implementing the functionality in the playback software.

The latter solution would be rather messy, I suspect, and be
restricted to individual players (currently, I need to support two
different players, both doing their things in very different ways).
Anyway, taking a look a PulseAudio won't hurt if it cannot be done as
ALSA plugin.

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

end of thread, other threads:[~2018-04-20  7:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-13 11:44 Sample format changes by plugin while playing Robert Tiemann
2018-04-19 11:18 ` Robert Tiemann
2018-04-19 13:53   ` Clemens Ladisch
2018-04-19 14:22     ` Robert Tiemann
2018-04-19 14:34       ` Ricard Wanderlof
2018-04-20  7:15         ` Robert Tiemann
2018-04-19 15:57       ` Clemens Ladisch
2018-04-20  7:37         ` Robert Tiemann

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.