Hi,

august wrote:

>> for(i = 0; i < out_format->num_channels; i++)
>>    {
>>    for(j = 0; j < in_format->num_channels; j++)
>>      {
>>      matrix[i][j] = (i == j) ? 1.0 : 0.0;
>>      }
>>    }
>>
>> If I didn't make a mistake, this should cover the cases you describe.
> 
> This looks correct to me and looks like the best way of handling a
> default configuration.   It is especially useful if you can assign the
> mix matrix like you suggested  before.

Ok, that's done for the case, that the predefined mixer initialization
fails and no user matrix is given.

> Where could I start to work on this?  I'm a little blinded by all the
> channel_id's .

I wanted to start to explain, but then I realized that the actual code-lines
are less than the explanation, so I quickly did it myself.

There are now 2 new functions:

void gavl_audio_options_set_mix_matrix(gavl_audio_options_t * opt,
                                        const double ** matrix);

const double ** gavl_audio_options_get_mix_matrix(gavl_audio_options_t * opt);

and a new audio conversion flag (on by default):

GAVL_AUDIO_NORMALIZE_MIX_MATRIX

For initializing the mix matrix there are 3 possibilities:

1. User defined matrix (optionally with normalization)
2. Prefefined up-/downmixing (like before)
3. Fallback (unity matrix).

> How does that happen if you don't assign an input or output channel_id?
> Why does gavl try to guess this?  It seems weird to me that a normal 8
> or 16 channel wav file would have channel_id's.

If you send e.g. a 6 channel signal to pulseaudio, it will treat it as a
5.1 signal.

Also, 2 channels mean (in 99% of the cases) Left, Right. But the AC3 standard
allows Mono+LFE as well.

> I guess what is confusing me is all the LEFT, RIGHT, FRONT_CENTER, AUX,
> etc. business.  For someone who works with multichannel audio, these
> things don't mean anything. 

Well, Pulseaudio, Alsa and some audio file formats I described earlier
specify something like channel IDs, also most PC audio hardware has at
least 5.1 outputs nowadays, so I doubt that they are completely nonsense.
For practically all *consumer* level applications, they mean indeed a lot,
and that's why they are there.

Of course I know, that for *prosessional* applications, these end-user
stuff is irrelevant, and that's why we are discussing how to make it better.

> It only means something if you have a home
> entertainment system where the direction of the viewer/listener is
> assumed to be singular and the speakers are adjusted accordingly.

Not only for a home-enternainment system. If you have an Ambisonics
recording (not supported in gavl yet), you'll also need to specify which
channel carries which signal.

> I find AUX especially confusing.

One can rename GAVL_CHID_AUX to GAVL_CHID_GENERIC if that helps.

> Am I correct in assuming that MOST audio editors/writers  will assign
> these channel_ids wrong or at least arbitrarily?  I mean, how do you
> know if you want a specific channel to be left, right or center unless
> it is for a specific speaker configuration? 

As I said, and end user want's to watch DVDs with 5.1 sound,
so we need to know the channel IDs for the AC3 decoder and Alsa
(or pulseaudio). He also wants e.g. to rip a DVD into a .mov file
with the AAC codec, so the channel IDs for AAC are also important.
And if he watches the .mov on a 5.1 system, it should still be right.

Gavls multichannel support does that right for all cases I tried.

> Is there anywhere I can read up on this?

I don't know much except some file format specs.

> And, how does interleaving fit in?  Right now, I am getting segfaults
> and can't see exactly where (it is different with different audio
> files) 

Interleaving shouldn't matter here.
If you still get segfaults with current CVS, we must investigate this.

> For my puredata external, where the input can vary, but output format is
> fixed  I now have three audio frames:  input, tmp, and output.
> 
> The input frame is created for each open file and can vary in all
> aspects: channel, samplerate, bitdepth, interleaving, etc.
> 
> The output is set once to the desired out format with a fixed number of
> chans, samplerate, etc.
> 
> The tmp frame is used as an in-between.  How should I set the
> interleaving and number of channels on this frame so that I can use it
> to translate input to output ?   Should it match the input on
> interleaving, but the output in channels?

Interleaving should be GAVL_INTERLEAVE_NONE, because that speeds up
most calculations. Number of channels can be tricky.
The gavl_audio_converter_t (which also has tmp frames inside) tries
to make time-consuming calculations (like resampling) with as few channels
as possible.

Burkhard

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Gmerlin-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gmerlin-general

Reply via email to