Hey,

Thanks for the reply.  I can't believe I didn't think of this stuff
earlier.

My one application right now has to define the number of outputs at
creation time and cannot change them for every file that is passed
through it.

The effect I want (for now at least until arbitrary mixing can be
done)  is as follows:

If I have 5 channel output, but an 8 channel input, I want the first 5
channels to be passed to the first 5 channels of output and disregard
the last 3. 

If I have a 5 channel output, but a 3 channel input, I want
the 3 input channels to be  passed to the first 3 output channels and
then disregard the final 2 out channels.


> >     could somebody explain what the
> > 
> >     gavl_audio_format_t::channel_locations[] is supposed to contain?
> > 
> >     Can I safely set them all to GAVL_CHID_NONE?  Or, is it supposed to
> >     be numbered?
> 
> GAVL_CHID_NONE means "unknown/unsupported". GAVL_CHID_AUX is more likely
> what you want.
> 
> As long as num_channels and channel_locations[] are always the same for
> input and output, gavl should pass then through unchanged.


do I set it up like this:

channel_locations[0] =0;
channel_locations[1] =1;
.
.
channel_locations[x]=x;

or, do I set it up like this:

for (int i=0;i<GAVL_MAX_CHANNELS;i++)
        channel_locations[i]= GAVL_CHID_AUX;

> If it doesn't, it's a bug.
> 

> >     My problem is how to down mix from, say, an 8channel audio to a 4
> >     channel player.  
> >     
> >     When using a stereo output, just setting this worked for the internal
> >     gavl_audio_converter:
> >     
> >     output_audio_format.channel_locations[0] = GAVL_CHID_NONE; 
> > 
> >     But, now, when I want to mix 8 to 4 channels I am getting:
> > 
> >     Couldn't construct mix matrix, using (probably wrong) default
> >     Segmentation fault
> 
> Oops, that's probably because the default mix matrix is defined only
> for up to 6 channels. Maybe you are the first one who throws 8 channels
> at gavl.


ahh, ok.  funny that I didn't come up to this previously.  Eventually, I
may be throwing GAVL_MAX_CHANNELS at it - maybe even more.

> >     Here is the file I am testing:
> >     http://romanhaefeli.net/8ch_does_play.wav
> >     
> >     Strangely enough, this is an 8ch wav that DOES play on a 4channel
> >     output using gavl:
> >     http://romanhaefeli.net/8ch_does_not_play.wav
> > 
> >     I assume this has something to do with interlacing?
> 
> You probably mean interleaving, but that's irrelevant here.

yes, interleaving.  

> The gavl_audio_converter_t converts input frames to non-interleaved
> before it mixes.
> 
> >     Any idea why this is happening?  Seems weird that it would segfault
> >     on me..or am I doing something else stupid?
> 
> No, it's gavls fault.
> 
> >     ...Ok, the real question:
> > 
> >     If my output is 5 channels, but my input is 8 channels, how do I tell
> >     gavl to simply select the first five channels?
> > 
> >     Or, is there a way to build a channel matrix in gavl so that I can
> >     mix arbitrary channels?
> 
> Not yet, but it would be a nice feature. A clean way would be a public 
> function:
> 
> gavl_audio_options_set_mix_matrix(gavl_audio_options_t * opt, double ** 
> matrix);
> 
> where matrix[i][j] contains the factor for mixing input channel j to output
> channel i.

ok.   Factor is from 0.0 -> 1.0  I assume?

> Internally, in gavl/mix.c there is a function init_matrix(), which could check
> if there is a predefined matrix. If you want you can play around with that.

ok, I will look into that when I get a chance.

> Also note, that the matrix is normalized by default such that the signal
> *never* clips (maximum coefficient sum of each matrix row must be one).
> Maybe you also want an option for disabling this.

how about:

gavl_audio_options_set_mix_matrix(
                        gavl_audio_options_t * opt, 
                        double ** matrix,
                        bool normalize);

> I just commited a tiny fix for downmixing more than 6 input channels into one
> output channel, so the actual number crunching stuff should support generic
> mix setups already.
> 

I still get a segfault if I set channel_locations[] to GAVL_CHID_NONE.
If I set them to GAVL_CHID_AUX, I get no audio.


-august.

------------------------------------------------------------------------------
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