From: Jaroslav Kysela <perex@perex.cz>
To: James Warden <warjamy@yahoo.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: Re: Can module snd-aloop (virtual looback device) be made clock slave of a real audio device ?
Date: Tue, 21 Aug 2012 10:55:46 +0200 [thread overview]
Message-ID: <50334D12.2060002@perex.cz> (raw)
In-Reply-To: <1345537715.17735.YahooMailNeo@web39305.mail.mud.yahoo.com>
Date 21.8.2012 10:28, James Warden wrote:
> ----- Original Message -----
> From: Jaroslav Kysela <perex@perex.cz>
> To: alsa-devel@alsa-project.org
> Cc: warjamy@yahoo.com
> Sent: Monday, August 20, 2012 12:26 PM
> Subject: Re: [alsa-devel] Can module snd-aloop (virtual looback device) be made clock slave of a real audio device ?
>
> Date 20.8.2012 11:51, James Warden wrote:
>>> Hello alsa-devel's,
>>>
>>> A while back, I had written a rather hackish method to hook up the
>>> ALSA virtual loopback device to jack (jackaudio.org) via Jack clients
>>> alsa_in / alsa_out so that non jack-aware applications that can
>>> however use ALSA devices "directly" (via alsa-lib) can have their
>>> audio stream redirected to jack (see my rather lengthy prose at
>>> http://alsa.opensrc.org/Jack_and_Loopback_device_as_Alsa-to-Jack_bridge).
>>>
>>> There are a few advantages in this method (depends on your use-cases
>>> of course). But it could be improved (or so I think) by removing the
>>> following drawbacks:
>>>
>>> The alsa_in/out jack clients are resampling the audio stream to
>>> synchronize with the device that jack is using. The resampling, done
>>> by libsamplerate, takes some CPU power. Since many users are using my
>>> recipe on laptops, this is not always welcome.
>>>
>>> Because snd-aloop is a virtual device, couldn't it be made a clock
>>> slave of the h/w device that jack is operating on ? This would in
>>> principle remove the need for resampling. I could imagine that the
>>> module could be passed an option at loading time (e.g. modprobe
>>> snd-aloop clock-master=<real h/w device index> or something like
>>> that)
>>
>> Use 'PCM Rate Shift 100000' mixer control to fine tune the rate (timing)
>> for the snd-aloop PCM devices. An example using this solution is the
>> alsaloop application from the alsa-utils package.
>>
>> Also note that other controls can expose the audio format on the
>> playback side, so you can avoid resampling in the alsa-lib completely
>> for ALSA audio apps. The alsaloop application can give you more hints.
>
>
> Thanks for the hints!
>
> I have a few questions:
>
> 1- I can see the "PCM Rate Shift 100000" control when I list it with amixer.
>
> is there a way to have these (hidden) controls show up in alsamixer as well ?
No, it isn't, it's marked as a part of the PCM API, not mixer API. This
control was introduced to set the drift programatically.
> 2- The range of this control is 80%-120%. Do I understand that it is a constant ? Once set, it just stays there ?
This value can be changed (corrected) at any time.
> 3- How would I know which value I would have to set anyway ?
alsaloop measures the frequency from the real hardware and computes the
actual drift which is passed to snd-aloop. The drift is handled all
times (it's not just one shot measure).
> 4- something a bit orthogonal: my main card is a Hammerfall HDSP + Multiface II.
> The access mode is MAP_NONINTERLEAVED according to the hw_params. This prevents me from e.g. combining this card and the virtual loopback into one (not that I want to do that in the end but I was experimenting with the merge plugin at some point in the past) because the access mode is MAP_INTERLEAVED for snd-aloop. This also prevents the alsaloop utility from being used like in this example:
>
> alsaloop -C hw:Loopback,1,0 -P hw:DSP
>
> This fires up OK, but then when I try to play something on hw:Loopback,0,0, alsaloop gives up with an error message regarding the stream format being wrong or the like (I am not sitting at home now, so I can't say preceisely).
Use the plughw:DSP device which does the conversions.
Jaroslav
--
Jaroslav Kysela <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.
prev parent reply other threads:[~2012-08-21 8:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-20 9:51 Can module snd-aloop (virtual looback device) be made clock slave of a real audio device ? James Warden
2012-08-20 10:26 ` Jaroslav Kysela
2012-08-21 8:28 ` James Warden
2012-08-21 8:55 ` Jaroslav Kysela [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50334D12.2060002@perex.cz \
--to=perex@perex.cz \
--cc=alsa-devel@alsa-project.org \
--cc=warjamy@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.