Skip to contentSkip to conversation

How to apply rate conversion in asound.conf

DISCUSSION Dolevo Jay 2 participants 5 messages Nov 6, 2013 – Nov 12, 2013 1 message not in the archive

lore
Share & tools
lore

Dolevo Jay

author
#0 lore raw

Hi experts,

I am currently using the following asound.conf, which is pretty much copy-paste from the link below.

asound.conf
-------------------------------------
pcm.!default {
type plug
slave.pcm multi
}

pcm.multi {
        type multi;
        slaves.a.pcm "hw:0,1";
        slaves.a.channels 2;
        slaves.b.pcm "hw:1,1";
        slaves.b.channels 2;

        bindings.0.slave a;
        bindings.0.channel 0;
        bindings.1.slave a;
        bindings.1.channel 1;
        bindings.2.slave b;
        bindings.2.channel 0;
        bindings.3.slave b;
        bindings.3.channel 1;
}

-------------------------------------

http://www.alsa-project.org/main/index.php/Asoundrc#Virtual_multi_channel_devices
-------------------------------------

My purpose is to apply rate conversion to the "hw:1,1" and have 44100 rate out. There is a sample conversion like:

pcm.rate_convert {
type rate
slave sl2
}

but how can I attach this rate_convert code to the multi code?

Thanks.

#1 lore raw
Quoted 5 lines · Dolevo Jay

pcm.!default {
type plug
slave.pcm multi
}

Quoted 7 lines
pcm.multi {
        slaves.a.pcm "hw:0,1";
        slaves.b.pcm "hw:1,1";

...

My purpose is to apply rate conversion to the "hw:1,1" and have 44100 rate out.

All slaves must use the same rate.

The easiest way is apply this to the plug plugin:

pcm.!default {
	type plug
	slave {
		pcm multi
		rate 44100
	}
}

Regards,
Clemens

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#3 lore raw
Quoted 36 lines

Date: Wed, 6 Nov 2013 17:30:25 +0100
From: [email protected]
To: [email protected]; [email protected]
Subject: Re: [alsa-devel] How to apply rate conversion in asound.conf

Quoted 5 lines · Dolevo Jay

pcm.!default {
type plug
slave.pcm multi
}

Quoted 7 lines
pcm.multi {
        slaves.a.pcm "hw:0,1";
        slaves.b.pcm "hw:1,1";

...

My purpose is to apply rate conversion to the "hw:1,1" and have 44100 rate out.

All slaves must use the same rate.

The easiest way is apply this to the plug plugin:

pcm.!default {
	type plug
	slave {
		pcm multi
		rate 44100
	}
}
Quoted 6 lines

Regards,
Clemens
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

Hi,

What you suggested worked perfect but I implemented the rate conversion in my software for some specific reasons. What I need to do now is to have a aosund.conf which has dmix into multi plugins together.
So, here is my multi configuration:
--------------------------------
pcm.!default {
type plug
slave.pcm multi
}

pcm.multi {
        type multi;
        slaves.a.pcm "hw:0,1";
        slaves.a.channels 2;
        slaves.b.pcm "hw:1,1";
        slaves.b.channels 2;
 
        bindings.0.slave a;
        bindings.0.channel 0;
        bindings.1.slave a;
        bindings.1.channel 1;
        bindings.2.slave b;
        bindings.2.channel 0;
        bindings.3.slave b;
        bindings.3.channel 1;
}

--------------------------------
The following dmix runs ok for 1,1 hardware:
--------------------------------

pcm.dmixer {
    type dmix
    ipc_key 2048
    slave {
        pcm "hw:1,1"
    }
    bindings {
        0 0
        1 1
    }
}

pcm.!default {
type plug
slave.pcm dmixer
}
--------------------------------

Could you please tell me how I can implement the second configuration with dmixer into the first one which has multi. So, basically how can I call a plugin inside of another plugin?

Thanks a lot.

author
#4 lore raw
Quoted 102 lines

From: [email protected]
To: [email protected]
Date: Fri, 8 Nov 2013 14:15:30 +0000
Subject: Re: [alsa-devel] How to apply rate conversion in asound.conf

Quoted 32 lines

Date: Wed, 6 Nov 2013 17:30:25 +0100
From: [email protected]
To: [email protected]; [email protected]
Subject: Re: [alsa-devel] How to apply rate conversion in asound.conf

Quoted 5 lines · Dolevo Jay

pcm.!default {
type plug
slave.pcm multi
}

Quoted 7 lines
pcm.multi {
        slaves.a.pcm "hw:0,1";
        slaves.b.pcm "hw:1,1";

...

My purpose is to apply rate conversion to the "hw:1,1" and have 44100 rate out.

All slaves must use the same rate.

The easiest way is apply this to the plug plugin:

pcm.!default {
	type plug
	slave {
		pcm multi
		rate 44100
	}
}
Quoted 6 lines

Regards,
Clemens
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

Hi,

What you suggested worked perfect but I implemented the rate conversion in my software for some specific reasons. What I need to do now is to have a aosund.conf which has dmix into multi plugins together.
So, here is my multi configuration:
--------------------------------
pcm.!default {
type plug
slave.pcm multi
}

pcm.multi {
        type multi;
        slaves.a.pcm "hw:0,1";
        slaves.a.channels 2;
        slaves.b.pcm "hw:1,1";
        slaves.b.channels 2;
 
        bindings.0.slave a;
        bindings.0.channel 0;
        bindings.1.slave a;
        bindings.1.channel 1;
        bindings.2.slave b;
        bindings.2.channel 0;
        bindings.3.slave b;
        bindings.3.channel 1;
}

--------------------------------
The following dmix runs ok for 1,1 hardware:
--------------------------------

pcm.dmixer {
    type dmix
    ipc_key 2048
    slave {
        pcm "hw:1,1"
    }
    bindings {
        0 0
        1 1
    }
}

pcm.!default {
type plug
slave.pcm dmixer
}
--------------------------------

Could you please tell me how I can implement the second configuration with dmixer into the first one which has multi. So, basically how can I call a plugin inside of another plugin?

Quoted 7 lines

Thanks a lot.

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

Hello,

I'd appreciate if someone could tell me even this is possible or not?

Thanks.

#5 lore raw
In reply to Dolevo Jay
Quoted 1 line · Dolevo Jay

how can I call a plugin inside of another plugin?

The slave PCM name is the name of some pcm.xxx device.

Quoted 1 line

What I need to do now is to have a aosund.conf which has dmix into multi plugins together.

pcm.!default {
type plug
slave.pcm multi
}

pcm.multi {
	type multi
	slaves {
		a { pcm "hw:0,1" channels 2 }
		b { pcm "dmixer" channels 2 }
	}
	bindings [
		{ slave a channel 0 }
		{ slave a channel 1 }
		{ slave b channel 0 }
		{ slave b channel 1 }
	]
}
pcm.dmixer {
	type dmix
	...
}

But you need another dmix device for hw:0,1.

Regards,
Clemens