How to generate 2 audio tones and map to specific channel positions (bitmask)

Nick_law nicholas at umantec.net
Thu Jan 14 13:48:47 UTC 2021


Really struggling to work out how one would generate 2 audiotestsrc and then
map/duplicate them to multiple channels.

i.e 
a sine wave on channel 1,3
a sawtooth on channel 2,4 

or
a sine wave on channel 1,4
a sawtooth on channel 2,3 

Here there are 4 channels (but 5 would also be good):

My working example of generating two tones is below:

gst-launch-1.0 interleave name=i  \
audiotestsrc wave=0 freq=100 volume=0.4 ! decodebin ! audioconvert !  \
"audio/x-raw,format=S16BE,channels=1,channel-mask=(bitmask)0x1" ! queue !
i.sink_0  \
audiotestsrc wave=2 freq=100 volume=0.4 ! decodebin ! audioconvert !  \
"audio/x-raw,format=S16BE,channels=1,channel-mask=(bitmask)0x1" ! queue !
i.sink_1  \
i.src ! capssetter
caps="audio/x-raw,format=S16BE,channels=6,channel-mask=(bitmask)0x3f"  \
! audioconvert ! audioresample ! wavenc ! filesink location=test.wav 

I though that setting the bitmask for each source and channels (0xa and 0x5)
would allow gstreamer to populate the correct amount of channels and the
correct signals mapped but alas no go: What I tried was:

gst-launch-1.0 interleave name=i  \
audiotestsrc wave=0 freq=100 volume=0.4 ! decodebin ! audioconvert !  \
"audio/x-raw,format=S16BE,channels=2,channel-mask=(bitmask)0xA" ! queue !
i.sink_0  \
audiotestsrc wave=2 freq=100 volume=0.4 ! decodebin ! audioconvert !  \
"audio/x-raw,format=S16BE,channels=2,channel-mask=(bitmask)0x5" ! queue !
i.sink_1  \
i.src ! capssetter
caps="audio/x-raw,format=S16BE,channels=4,channel-mask=(bitmask)0xf"  \
! audioconvert ! audioresample ! wavenc ! filesink location=test.wav 

but I get
WARNING: erroneous pipeline: could not link queue0 to i

I also tried setting the tone channels to 4 with the same bitmask

I have also tried an audio convert after i.sink_0 and i.sink_1 also with no
luck.

Is this even possible? Any help would be much appreciated. 



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list