[nama] Re: Playback stops too soon

  • From: Joel Roth <joelz@xxxxxxxxx>
  • To: nama@xxxxxxxxxxxxx
  • Date: Mon, 30 Apr 2012 06:02:41 -1000

On Tue, Apr 24, 2012 at 02:14:30PM -0400, S. Massy wrote:
> On Tue, Apr 24, 2012 at 01:49:36PM -0400, S. Massy wrote:
> > It becomes even more important, because the problem I described
> > (stopping too soon) was also due to a mismatch in sampling rates. A
> > hunch made me try this quick calculation---
> > length_in_seconds*44100/48000--- and was gratified that it yielded
> > exactly the point at which playback would stop. What I suspect is
> > happening here is that ecasound overrides its default format based on
> > wave headers, as you described, but fails to update some aspect of its
> > internal sampling rate, causing a mismatch between where it thinks its
> > playback head is and where it actually is. I'll report this on
> > ecasound-list.

Hi Massy,

This sounds like an Ecasound bug! I didn't notice a report
on the Ecasound list. Perhaps you were waiting on getting
a reply here??

> But I can't reproduce this in pure ecasound. Nama somehow tricks
> ecasound in that respect. Do you recall roughly in what order commands
> are issued to create the chainsetup?

    eval_iam("cs-disconnect") if eval_iam("cs-connected");
    eval_iam("cs-remove") if eval_iam("cs-selected");
    eval_iam("cs-load $setup");
    eval_iam("cs-select $setup"); # needed by Audio::Ecasound, but not Net-ECI 
!!

> For instance, if I run aio-status in nama, I'll get:
> Input (3): "/home/smassy/nama/bach/.wav/roh_1.wav," - [DB => RIFF wave
> file]
>  -> connected to chains "4": position (0.000/194.893) seconds.
>  -> open, , s24_le/2ch/44100Hz, buffer 128.
> ...even though the wave file is at 48k, but this does not happen if I
> use ai-add in IAM.

It may also be worth checking if this occurs by running Nama
under both the -l (Audio::Ecasound) and -n (Net-ECI) control
interfaces.

I've got a provisional fix for Nama running with jackd. We
now set -f:f32_le,2,48000 (or whatever sample frequency is
set in namarc) at the top of the chain setup file. 
This should work okay for stereo-oriented projects,
which is the main use case for Nama.

Part of the problem is that with Ecasound every
audio format declaration becomes the new default.

A general-purpose solution would require explicitly setting
channel counts for each device.  I think this may apply for
loop devices as well.  This most readable way would be to
abbreviate the format argument (e.g. -f:,1 for a mono
input or output).

The only reason the WAV output format settings do not affect
other audio objects is that the audio output lines come last
in the chain setup, and the WAV output lines come at the
very end of the outputs section.  (That behavior is actually
an accident because of the way the lines are sorted. Names
of record chains start with 'R', which sorts after the
numerical chains used for most track routing.)

Best,

 
> Cheers,
> S.M.
> 

-- 
Joel Roth

Other related posts: