<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" dir="ltr">
<p>hi,</p>
<p><br>
</p>
<p>This is the short version of my quetsion.</p>
<p><br>
</p>
<p>I have a microphone that captures 4 channels audio stream in channel layout of 0x33. I want to change some channels' position to make a stream of layout 0x107, but keeping the data in each channel untouched. How can I do that?</p>
<p><br>
</p>
<p>I already have a solution with using deinterleave/audioconvert/interleave, but want a simpler way, like doing it in one single element.</p>
<div><br>
</div>
Best regards,
<div>Xin<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>发件人:</b> Liu Xin <liuxin8166@hotmail.com><br>
<b>发送时间:</b> 2017年10月24日 20:27<br>
<b>收件人:</b> gstreamer-devel@lists.freedesktop.org<br>
<b>主题:</b> change ambisonic audio's channel position/layout</font>
<div> </div>
</div>
<div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p>hi,</p>
<p><br>
</p>
<p>I'm add an ambisonic microphone to my project to capture spatial sound, and I want to encode it into AAC and stream it. The only AAC encoder that supports 4 channels is FAAC. This plugin requires input's channel layout to be 0x107 ( FRONT_CENTER, REAR_CENTER,
 FRONT_LEFT, FRONT_RIGHT). While my mic's output is 0x33 (REAR_LEFT, REAR_RIGHT, FRONT_LEFT, FRONT_RIGHT), meaning conversion is needed. </p>
<p><br>
</p>
<p>My question is how to do the conversion.</p>
<p><br>
</p>
<p>With gst-launch, I did 2 tests to simulate the entire data path, from capture to conversion to client side's playback (I use a proprietary player to listen to the captured sound. When everything is right, the final.wav should contain correct spatial cue
 when listening. Otherwise, the spatial cue is either wrong or doesn't exist). Result: TEST-1 is correct, while TEST-2 is not. </p>
<p><br>
</p>
<p>TEST-1:</p>
<p></p>
<div></div>
<div>./gst-launch-1.0 -e \</div>
<div>alsasrc device=hw:2 ! foaa2b ! deinterleave name=d \</div>
<div>interleave name=i ! faac ! faad ! deinterleave name=dd \</div>
<div>interleave name=ii ! wavenc ! filesink location=final.wav \</div>
<div>d.src_0 ! queue ! audioconvert ! 'audio/x-raw,channels=1,channel-mask=(bitmask)0x1' ! queue ! i.sink_0 \</div>
<div>d.src_1 ! queue ! audioconvert ! 'audio/x-raw,channels=1,channel-mask=(bitmask)0x2' ! queue ! i.sink_1 \</div>
<div>d.src_2 ! queue ! audioconvert ! 'audio/x-raw,channels=1,channel-mask=(bitmask)0x4' ! queue ! i.sink_2 \</div>
<div>d.src_3 ! queue ! audioconvert ! 'audio/x-raw,channels=1,channel-mask=(bitmask)0x100' ! queue ! i.sink_3 \</div>
<div>dd.src_0 ! queue ! audioconvert ! 'audio/x-raw,channels=1,channel-mask=(bitmask)0x1' ! queue ! ii.sink_0 \</div>
<div>dd.src_1 ! queue ! audioconvert ! 'audio/x-raw,channels=1,channel-mask=(bitmask)0x2' ! queue ! ii.sink_1 \</div>
<div>dd.src_2 ! queue ! audioconvert ! 'audio/x-raw,channels=1,channel-mask=(bitmask)0x10' ! queue ! ii.sink_2 \</div>
<div>dd.src_3 ! queue ! audioconvert ! 'audio/x-raw,channels=1,channel-mask=(bitmask)0x20' ! queue ! ii.sink_3</div>
<div></div>
<div></div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<br>
</div>
TEST-2:<br>
<p></p>
<p></p>
<div>./gst-launch-1.0 -e \</div>
<div>alsasrc device=hw:2 ! foaa2b ! audioconvert ! 'audio/x-raw,channels=4,channel-mask=(bitmask)0x107' \</div>
<div>! faac ! faad ! audioconvert ! 'audio/x-raw,channels=4,channel-mask=(bitmask)0x33' ! wavenc ! filesink location=final.wav</div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<br>
</div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
It's easy to understand TEST-1, because it split 4 channels and give specific order to 4 sub-data-paths. <span style="font-size:12pt">Could someone tell me the why TEST-2 is different to TEST-1?</span></div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<span style="font-size:12pt"><br>
</span></div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<span style="font-size:12pt">I really want to keep my pipeline simple. So I'm also concerning making foaa2b's output 0x107. Foaa2b is my self-written plugin that does ambisonic A-format to B-format conversion. So I can totally change its code. The problem is
 how put each channel to its correct position in the plugin code (which API to use?).</span></div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<br>
</div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
This is a long post. Thank you for your patience.</div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<br>
</div>
<p>Best,</p>
<p>Xin</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>