It is currently 27 Mar 2017, 09:31



Audio mixing and routing with CasparCG

CasparCG Server, Client and development

Moderators: Macey, Jonas Hummelstrand, didikunz

Audio mixing and routing with CasparCG

Postby juanidiaz » 25 Jan 2017, 21:56

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?
User avatar
juanidiaz
 
Posts: 9
Joined: 10 Jul 2016, 23:56

Re: Audio mixing and routing with CasparCG

Postby didikunz » 26 Jan 2017, 09:48

There is nothing like an input volume in Caspar. You can control the volume of a layer with the command you mentioned. So you need to play your input on a layer to be able to controll the audio.
Didi Kunz
CasparCG Client-Programmer, Template Maker & Live CG-Operator
Media Support, CH-5722 Gränichen, Switzerland http://mediasupport.ch/
Problems? Guide to posting Bug reports & Feature requests
User avatar
didikunz
 
Posts: 3398
Joined: 10 May 2010, 09:08
Location: Aarau, Switzerland

Re: Audio mixing and routing with CasparCG

Postby juanidiaz » 26 Jan 2017, 16:17

Thank you Didi, so if the command I use to get the SDI input is:
Code: Select all
PLAY 1-0 DECKLINK 1

then the command to change the audio level would be:

Code: Select all
MIXER 1-0 VOLUME 1 5 linear

This will control all audio levels -all channels- of the SDI video.
Is there any way to control the level per channel?
User avatar
juanidiaz
 
Posts: 9
Joined: 10 Jul 2016, 23:56

Re: Audio mixing and routing with CasparCG

Postby didikunz » 26 Jan 2017, 17:09

juanidiaz wrote:Is there any way to control the level per channel?


I don't think so.
Didi Kunz
CasparCG Client-Programmer, Template Maker & Live CG-Operator
Media Support, CH-5722 Gränichen, Switzerland http://mediasupport.ch/
Problems? Guide to posting Bug reports & Feature requests
User avatar
didikunz
 
Posts: 3398
Joined: 10 May 2010, 09:08
Location: Aarau, Switzerland

Re: Audio mixing and routing with CasparCG

Postby Jesper Stærkær » 27 Jan 2017, 11:31

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
User avatar
Jesper Stærkær
 
Posts: 835
Joined: 13 Apr 2010, 18:06
Location: Trondheim, Norway

Re: Audio mixing and routing with CasparCG

Postby juanidiaz » 21 Feb 2017, 20:05

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 567 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 567 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 567 times


... all that dynamically! I can trigger CasparCG commands from a flash template, so this will call the special scenario.

Is this even possible?
User avatar
juanidiaz
 
Posts: 9
Joined: 10 Jul 2016, 23:56

Re: Audio mixing and routing with CasparCG

Postby Jesper Stærkær » 21 Feb 2017, 20:21

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
User avatar
Jesper Stærkær
 
Posts: 835
Joined: 13 Apr 2010, 18:06
Location: Trondheim, Norway

Re: Audio mixing and routing with CasparCG

Postby juanidiaz » 21 Feb 2017, 21:51

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!
User avatar
juanidiaz
 
Posts: 9
Joined: 10 Jul 2016, 23:56

Re: Audio mixing and routing with CasparCG

Postby Jesper Stærkær » 21 Feb 2017, 23:20

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
User avatar
Jesper Stærkær
 
Posts: 835
Joined: 13 Apr 2010, 18:06
Location: Trondheim, Norway

Re: Audio mixing and routing with CasparCG

Postby juanidiaz » 22 Feb 2017, 17:37

I know its a tricky result what I'm looking for. I have all equipment to test at the station... and open to try.

Thanks again!
User avatar
juanidiaz
 
Posts: 9
Joined: 10 Jul 2016, 23:56

Re: Audio mixing and routing with CasparCG

Postby juanidiaz » 08 Mar 2017, 17:23

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??
User avatar
juanidiaz
 
Posts: 9
Joined: 10 Jul 2016, 23:56

Re: Audio mixing and routing with CasparCG

Postby hreinnbeck » 09 Mar 2017, 04:57

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.
hreinnbeck
 
Posts: 294
Joined: 04 Aug 2009, 06:31

Re: Audio mixing and routing with CasparCG

Postby vimlesh1975 » 09 Mar 2017, 04:57

Good experiments and findings.
User avatar
vimlesh1975
 
Posts: 595
Joined: 29 Aug 2011, 11:42
Location: Doordarshan, Mumbai, India

Re: Audio mixing and routing with CasparCG

Postby Jesper Stærkær » 09 Mar 2017, 09:47

You can't use a decklink device two times, so you need to run the decklink into a background layer, then use a route command to duplicate it.
Jesper Stærkær
Independent Consultant at SuperFly.tv
User avatar
Jesper Stærkær
 
Posts: 835
Joined: 13 Apr 2010, 18:06
Location: Trondheim, Norway

Re: Audio mixing and routing with CasparCG

Postby hreinnbeck » 09 Mar 2017, 10:54

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.
hreinnbeck
 
Posts: 294
Joined: 04 Aug 2009, 06:31

Re: Audio mixing and routing with CasparCG

Postby juanidiaz » 13 Mar 2017, 15:39

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.
User avatar
juanidiaz
 
Posts: 9
Joined: 10 Jul 2016, 23:56

Re: Audio mixing and routing with CasparCG

Postby juanidiaz » 13 Mar 2017, 15:42

Jesper Stærkær wrote:You can't use a decklink device two times, so you need to run the decklink into a background layer, then use a route command to duplicate it.


Hi Jesper... how do I do that?
User avatar
juanidiaz
 
Posts: 9
Joined: 10 Jul 2016, 23:56

Re: Audio mixing and routing with CasparCG

Postby Jesper Stærkær » 13 Mar 2017, 16:17

Like Hreinnbeck suggested above:

Code: Select all
PLAY 1-1 route://1-0


However, you need custom channel layouts for both the decklink play command and the route command, and I'm sorry, but I have no time available to test this and find the combination :(
Jesper Stærkær
Independent Consultant at SuperFly.tv
User avatar
Jesper Stærkær
 
Posts: 835
Joined: 13 Apr 2010, 18:06
Location: Trondheim, Norway


Return to Tech and Development

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests