Audio is one of the most important parts of any video production, as it helps users to engage with the content and the message. Audio elements allow you to add sound and music to your video and works in a quite similar way than Video elements.

If an audio element is added to a scene, the audio is contained in the scene and will be cut when moving to the next scene. On the other hand if an Audio element is added directly as a movie element, the audio is played over the scenes. Now we will see this in the next 2 examples.

Adding sound to a scene

In this first example we will create a video with 2 scenes. In the first scene we will add some thunder sound effects to a muted video, and we will leave the second scene without audio.

{
    "project": "tutorial",
    "resolution": "full-hd",
    "quality": "high",
    "scenes": [
        {
            "comment": "Scene #1",
            "elements": [
                {
                    "type": "video",
                    "src": "https:\/\/assets.json2video.com\/assets\/videos\/thunder-storm-02.mp4"
                },
                {
                    "type": "audio",
                    "src": "https:\/\/assets.json2video.com\/assets\/audios\/thunder-01.mp3"
                },
                {
                    "type": "audio",
                    "src": "https:\/\/assets.json2video.com\/assets\/audios\/thunder-02.mp3",
                    "start": 2.5
                },
                {
                    "type": "audio",
                    "src": "https:\/\/assets.json2video.com\/assets\/audios\/thunder-01.mp3",
                    "start": 5.2
                },
                {
                    "type": "audio",
                    "src": "https:\/\/assets.json2video.com\/assets\/audios\/thunder-02.mp3",
                    "start": 8
                }
            ],
            "duration": 10
        },
        {
            "comment": "Scene #2",
            "elements": [
                {
                    "type": "video",
                    "src": "https:\/\/assets.json2video.com\/assets\/videos\/rain-01.mp4"
                }
            ],
            "duration": 10
        }
    ]
}

As expected, when the video switches from scene #1 to scene #2, audio gets muted as scene #2 has no audio.

Adding sound to a movie with multiple scenes

In this second example, we will add the sound effects as movie elements instead of scene #1 elements:

{
    "project": "tutorial",
    "resolution": "full-hd",
    "quality": "high",
    "scenes": [
        {
            "comment": "Scene #1",
            "elements": [
                {
                    "type": "video",
                    "src": "https:\/\/assets.json2video.com\/assets\/videos\/thunder-storm-02.mp4"
                }
            ],
            "duration": 10
        },
        {
            "comment": "Scene #2",
            "elements": [
                {
                    "type": "video",
                    "src": "https:\/\/assets.json2video.com\/assets\/videos\/rain-01.mp4"
                }
            ],
            "duration": 10
        }
    ],
    "elements": [
        {
            "type": "audio",
            "src": "https:\/\/assets.json2video.com\/assets\/audios\/thunder-01.mp3"
        },
        {
            "type": "audio",
            "src": "https:\/\/assets.json2video.com\/assets\/audios\/thunder-02.mp3",
            "start": 2.5
        },
        {
            "type": "audio",
            "src": "https:\/\/assets.json2video.com\/assets\/audios\/thunder-01.mp3",
            "start": 5.2
        },
        {
            "type": "audio",
            "src": "https:\/\/assets.json2video.com\/assets\/audios\/thunder-02.mp3",
            "start": 8
        }
    ]
}

The resulting video has audio over the 2 scenes, as thunder sound effects extend longer than the scene #1.