---
title: "Audio"
description: "Working with audio in Disguise using the Python API"
url: https://developer.disguise.one/python-api/guides/audio/
---

# Audio in Disguise

This guide provides an overview of how to use the Disguise Python API to manage and interact with audio.

* * *

## Audio Track

An [`AudioTrack`](/python-api/docs/audiotrack) is a resource that represents an audio file in the timeline.

| Task | Python |
| :-- | :-- |
| **Get audio file** | `audio_file = audio_track.audioFile`<br>Returns an [`AudioFile`](/python-api/docs/audiofile) object. |
| **Get audio header** | `header = audio_track.header`<br>Returns an [`AudioInfo`](/python-api/docs/audioinfo) object. |

* * *

## Audio File

An [`AudioFile`](/python-api/docs/audiofile) resource contains information about a specific audio file.

| Task | Python |
| :-- | :-- |
| **Get audio header** | `header = audio_file.header`<br>Returns an [`AudioInfo`](/python-api/docs/audioinfo) object with details like sample rate and bit depth. |

* * *

## Audio Analyser

The [`AudioAnalyser`](/python-api/docs/audioanalyser) is a device that provides real-time analysis of an audio signal.

| Task | Python |
| :-- | :-- |
| **Get audio lines** | `lines = audio_analyser.lines`<br>Returns a list of [`AudioLine`](/python-api/docs/audioline) objects. |

* * *

## Controlling Volume

Volume for sequenceable objects like layers is controlled via keyframes. To set a static value, you typically set the value of the first keyframe.

### Set volume on an Audio Layer

```python
audio_layer = next((l for l in guisystem.track.layers if l.name == "MyAudioLayer"), None)
if audio_layer:
    vol_seq = audio_layer.findSequence("volume")
    if vol_seq:
        vol_seq.disableSequencing = False
        key_seq = vol_seq.sequence
        if key_seq:
            # Set a keyframe at time 0.0 seconds
            key_seq.setFloat(0.0, 0.5)
```

### Set master transport volume

```python
transport = guisystem.currentTransportManager
transport.volume = 0.8
```

### Control master volume (local layer)

```python
t_vol_layer = next((l for l in guisystem.track.layers if l.name == "TransportVolumeLocal"), None)
if t_vol_layer:
    vol_seq = t_vol_layer.findSequence("volume")
    if vol_seq:
        vol_seq.disableSequencing = False
        key_seq = vol_seq.sequence
        if key_seq:
            # Set a keyframe at time 0.0 seconds
            key_seq.setFloat(0.0, 1.0)
```

* * *

## Keyframing Audio Properties

You can animate audio properties, such as the `volume` of an `Audio` layer, using keyframes. This follows the same pattern as other sequenceable properties in Disguise (see [Track and Sequencing](/python-api/guides/track-and-sequencing)).

* * *

## Audio Line

An [`AudioLine`](/python-api/docs/audioline) represents a single line of audio analysis data. This is often used for frequency analysis (e.g., getting bass, mid, treble levels).

| Task | Python |
| :-- | :-- |
| **Example Expression** | `audioline:name.c[range]`<br>This is used in expressions to get frequency data. For example, `audioline:my-audio.c[0]` might give you the bass level. |

* * *

## System-level Audio Management

You can access audio-related components from the main `system` object.

| Task | Python |
| :-- | :-- |
| **Get audio output device map** | `audio_out_map = system.audioOut`<br>Returns an [`AudioOutDeviceMap2`](/python-api/docs/audiooutdevicemap2) object for managing audio outputs. |
| **Get all audio tracks** | `tracks = system.audioTracks`<br>Returns a list of all [`AudioTrack`](/python-api/docs/audiotrack) objects in the project. |
| **Check if video has audio** | `has_audio = video_clip.hasAudio`<br>Returns `True` if a [`VideoClip`](/python-api/docs/videoclip) resource has an embedded audio track. |
| **Reset audio system** | `system.resetAudio()`<br>Resets the audio engine. |

### Map an audio device

```python
# Find the logical device to map by iterating and checking its description
logical_device = next((d for d in system.audioOut.outputs if d.description == "L-Acoustics P1"), None)
if logical_device:
    # Find the physical machine output to map to
    machine_output = next((o for o in system.machines[0].audio.outputs if o.description == "Dante PCIe RX (machine-name)"), None)
    if machine_output:
        patch = logical_device.patch
        patch.device = machine_output
        patch.channel = 0  # e.g., Left channel
```

Maps the named logical device to a named physical output.
