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

Chris Wine chriswine at gmail.com
Thu Jan 14 17:06:15 UTC 2021


Something like this might work for you:

gst-launch-1.0 \
  interleave name=i ! wavenc ! filesink location=test.wav \
  audiotestsrc wave=0 freq=100 volume=0.4 ! audio/x-raw,channels=1 ! i. \
  audiotestsrc wave=2 freq=100 volume=0.4 ! audio/x-raw,channels=1 ! i. \
  audiotestsrc wave=0 freq=100 volume=0.4 ! audio/x-raw,channels=1 ! i. \
  audiotestsrc wave=2 freq=100 volume=0.4 ! audio/x-raw,channels=1 ! i.

it's just using 4 different audiotestsrc elements, and with the
capsfilters, force them to produce mono audio which gets interlaced into 1
stream before being written to the file. Right now, this will run
infinitely, so you might want to set the num-buffers property on the
audiotestsrc elements to limit them.

--Chris

On Thu, Jan 14, 2021 at 6:03 AM Nick_law <nicholas at umantec.net> wrote:

> 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/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210114/ba91e906/attachment.htm>


More information about the gstreamer-devel mailing list