Audio mixing and routing with CasparCG

#1
Hello everyone, I’m trying to do some audio mixing and routing with CasparCG… I hope this is even possible.

These are the two tasks:

- Use embedded audio channels 112 of the SDI input and map it into channels 1-2 and 3-4 of the output
- Dip (lower) the audio level from the SDI input to 20% while playing -ta the same time- a short (10 seconds aprox) mp3 audio file. Return the audio level to 100% once the mp3 file is done playing.


So far I’ve found how to control the master (output) volume level using commands like this:

Code: Select all

mixer 1-10 volume 1 5 linear
But I haven’t found a way to control the audio levels of the input signal per channel or in general.

Here is the setup:

1- Running the CasparCG version 2.1.0 (downloaded 2017-01-24)
2- OS is Windows 7
3- Using Decklink 4k Extreme
4- SDI input is HD-SDI (1080i59.94) with 4 embedded audio channels (1-2-3-4)
5- SDI output is HD-SDI (1080i59.94) with 4 embedded audio channels (1-2-3-4)

Any takers? Questions?

Re: Audio mixing and routing with CasparCG

#5
Ah, I see, pr. sdi-channel. No, not dynamically during playout.

What you can do, is to make a custom audio config and a audio mix_config. There you can map and mix all channels the way you want.

An audio config ca be applied multiple places in the pipeline: from producer to channel, from channel to consumer.

You can play the decklink producer with a given audio config to override. I'm not sure if you can use the CALL command to change audio configs at runtime, perhaps?
Jesper Stærkær
Independent Consultant at SuperFly.tv

Re: Audio mixing and routing with CasparCG

#6
Hi guys, thanks for your ideas.

Perhaps Jesper comment is too advanced for me or I'm not reading it correctly. Are you saying I can map each one of the four audio channels of the embedded SDI stream and then control the level of each one dynamically during playout?

I think I did not explain correctly what I want to achieve. The how -whether calling the elements on different layers, etc- is total open (and my question). Here is a quick visual way to explain it:
Image1.jpg
Image1.jpg (51.63 KiB) Viewed 3723 times
1) In the normal scenario the input video signal (feed to the Decklink 4k Extreme) will pass through and all audio channels will go though with no change... very standard!
Image2.jpg
Image2.jpg (101.14 KiB) Viewed 3723 times
2) In the special scenario, only audio source CH1 and CH2 will be carried at 100% level. Audio source CH3 and CH4 will be reduced to 20% and the audio clip aud1.mp3 will be played 100% on each one of them.
Image3.jpg
Image3.jpg (115.89 KiB) Viewed 3723 times
... all that dynamically! I can trigger CasparCG commands from a flash template, so this will call the special scenario.

Is this even possible?

Re: Audio mixing and routing with CasparCG

#7
Are you using internal or external keyer? Or in other words: are you using Decklink producer as your SDI input? If so, you might be able to do just this. But it requires custom audio mappings. But you will never be able to fade between the scenarios and still keep 1/2 + 3/4 in sync. You can perhaps make a fade, if you allow for +/- 1 frame delay between those audio pairs.
Jesper Stærkær
Independent Consultant at SuperFly.tv

Re: Audio mixing and routing with CasparCG

#8
Hi Jesper, I'm not sure if we use Decklink producer... we call the video feed using this command:

Code: Select all

PLAY 1-0 DECKLINK 1
... does that clarifies the question? After that the video initializes following the config file.

This is the configuration file content for HD:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!--<log-level>trace</log-level>-->
  <paths>
    <media-path>M:\casparcg\media\</media-path>
    <log-path>M:\casparcg\log\</log-path>
    <data-path>M:\casparcg\data\</data-path>
    <template-path>M:\casparcg\templates\</template-path>
  </paths>
  <channels>
    <channel>
      <video-mode>1080i5994</video-mode>
      <consumers>
        <decklink>
          <device>2</device>
          <embedded-audio>true</embedded-audio>
          <keyer>external</keyer>
        </decklink>
        <buffer-depth>6</buffer-depth>        
      </consumers>
    </channel>
  </channels>
  <controllers>
    <tcp>
      <port>5250</port>
      <protocol>AMCP</protocol>
    </tcp>
  </controllers>
  <audio>
    <channel-layouts>
      <channel-layout>
        <name>mono</name>
        <type>1.0</type>
        <num-channels>1</num-channels>
        <channels>C</channels>
      </channel-layout>
      <channel-layout>
        <name>stereo</name>
        <type>2.0</type>
        <num-channels>16</num-channels>
        <channels>L R C LFE</channels>
      </channel-layout>
      <channel-layout>
        <name>dts</name>
        <type>5.1</type>
        <num-channels>6</num-channels>
        <channels>C L R Ls Rs LFE</channels>
      </channel-layout>
      <channel-layout>
        <name>dolbye</name>
        <type>5.1+stereomix</type>
        <num-channels>8</num-channels>
        <channels>L R C LFE Ls Rs Lmix Rmix</channels>
      </channel-layout>
      <channel-layout>
        <name>dolbydigital</name>
        <type>5.1</type>
        <num-channels>6</num-channels>
        <channels>L C R Ls Rs LFE</channels>
      </channel-layout>
      <channel-layout>
        <name>smpte</name>
        <type>5.1</type>
        <num-channels>6</num-channels>
        <channels>L R C LFE Ls Rs</channels>
      </channel-layout>
      <channel-layout>
        <name>passthru</name>
        <type>16ch</type>
        <num-channels>16</num-channels>
        <channels />
      </channel-layout>
      <channel-layout>
        <name>8ch</name>
        <type>numbered_8ch</type>
        <num-channels>8</num-channels>
        <channels>1 2 3 4 5 6 7 8</channels>
      </channel-layout>
      <channel-layout>
        <name>16ch</name>
        <type>numbered_16ch</type>
        <num-channels>16</num-channels>
        <channels>1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16</channels>
      </channel-layout>
    </channel-layouts>
  </audio>
</configuration>
As for your other comments:

> Fade: Having a fade between scenarios, this is actually the desired situation. There could be a couple seconds to toggle between scenarios.
> Channel sync: During the special scenario sync between CH 1-2 and CH 3-4 are not a problem. However, once we go back to the normal scenario (with a fade) the channels will sync back up?

Thank you!

Re: Audio mixing and routing with CasparCG

#9
OK, I think it is theoretically possible to do what you want to by creating some background-layers, using re-route producer and custom audio mappings. I don't have the proper monitoring solution here at the momentm but I would like to figure this out some time.

One of my ideas is to map 3-4 from the input to 5-6 on an intermediate layer. Then playing the mp3 on 7-8 and having the whole channel route to the consuming decklink with a final audio mapping. You could then fade between the setups with layer volumes.

Another way around is to make two intermedia layers, using the PLAY command to switch between these, crating the fade.

A bit abstract I know, but I can't explain in detail something I (and perhaps no one else?) have ever tried. This is just me thinking out loud.
Jesper Stærkær
Independent Consultant at SuperFly.tv

Re: Audio mixing and routing with CasparCG

#11
Hello all, I've been playing with the channel layout and this is what I've managed to do so far (bare with me if this is obvious for some of you):

I can play an audio file (LaBamba.MP3) on each one of the audio channels by using this commands:

This one plays the file on audio channel 1 only:

Code: Select all

PLAY 1-15 LaBamba CHANNEL_LAYOUT "stereo:L"
This one plays the file on audio channel 2 only:

Code: Select all

PLAY 1-15 LaBamba CHANNEL_LAYOUT "stereo:R"
This one plays the file on audio channel 3 only:

Code: Select all

PLAY 1-15 LaBamba CHANNEL_LAYOUT "stereo:C"
This one plays the file on audio channel 4 only:

Code: Select all

PLAY 1-15 LaBamba CHANNEL_LAYOUT "stereo:LFE"
This means, that using the channel layout stereo the channel name vs channel number relation is this:
L > 1
R > 2
C > 3
LFE > 4

I have also been able to get the SDI video input using specific audio channels by using these commands:

This one uses channel 1 and channel 2

Code: Select all

PLAY 1-0 DECKLINK 1 CHANNEL_LAYOUT "stereo:L R"
and very similar, this one uses channel 3 and channel 4

Code: Select all

PLAY 1-0 DECKLINK 1 CHANNEL_LAYOUT "stereo:C LFE"
With this I can play the audio files on specific audio channels (CH3 and CH4) as explained in my special scenario. However I still need to find a way to lower the audio level of the video signal on these channels... without affecting the other two channels (CH1 and CH2)

Jasper, I think this is what you meant with:
One of my ideas is to map 3-4 from the input to 5-6 on an intermediate layer. Then playing the mp3 on 7-8 and having the whole channel route to the consuming decklink with a final audio mapping. You could then fade between the setups with layer volumes.

Another way around is to make two intermedia layers, using the PLAY command to switch between these, crating the fade.
How can this be achieved??

Re: Audio mixing and routing with CasparCG

#12
Have you tried doing two layers?

Code: Select all

PLAY 1-0 DECKLINK 1 CHANNEL_LAYOUT "stereo:L R"
MIXER 1-0 VOLUME 0.8

Code: Select all

PLAY 1-1 DECKLINK 1 CHANNEL_LAYOUT "stereo:C LFE"
MIXER 1-1 VOLUME 0.1
I'm not sure that routing the other layer gives you all the channels but you could also try

Code: Select all

PLAY 1-1 route://1-0 CHANNEL_LAYOUT "stereo:C LFE"
Last edited by hreinnbeck on 09 Mar 2017, 04:58, edited 1 time in total.

Re: Audio mixing and routing with CasparCG

#16
hreinnbeck wrote:Thanks Jesper.

If route doesn't give you all the channels you could use it twice. Play the decklink with 16ch and then route to two layers to pick off the channels needed.
Hi hreinnbeck, I tried using the command combination you sugest and I didn't get any response. The output seems the same. Please note the SDI input has all four channels.