> For the complete documentation index, see [llms.txt](https://audalaxy.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://audalaxy.gitbook.io/docs/json-configurations-for-audio/json-configurations-for-audio.md).

# JSON Configurations for Audio

The following options and configurations are available for optimising audio streming and playout.

{% hint style="info" %}
You can find the complete JSON schema with all available settings [here](/docs/json-configuration-guide-advanced-settings/json-configuration-guide-for-advanced-settings.md).
{% endhint %}

## Authentication

**Basic access**

The simplest technique for enforcing access controls.

```json
{
    "mountacl": {
        "username": "",
        "password": ""
    }
}
```

**Token access**

Audalaxy supports authentication by using a Token. Token-Based Authentication, relies on a signed JSON Web Token (JWT) that is sent to the server on each request.

## Auto switch to fallback stream

The Auto Switch function can be used to replace an audio source that is no longer available - for example, as a fallback for a simulcast.

<figure><img src="/files/uEOLIZkS1d1hEcA0DkFN" alt=""><figcaption></figcaption></figure>

### Workflow

Create a new additional source for this channel with the right incoming bitrate and select the fallback master server (the naming in the UI is a bit misleading, it’s not only “mid-roll trigger inside source”).

<figure><img src="/files/kw0x423lVc5tSP8bmIcV" alt=""><figcaption></figcaption></figure>

When creating listener mounts transcoding should be “forced”. Otherwise transcoding will be skipped if the source and listener mount have the same spec (e.g. same bitrate/format). The fallback mechanism is part of our transcodings so it needs to be enabled.

<figure><img src="/files/ogQHr9h0MZBmEnPDXPfk" alt=""><figcaption></figcaption></figure>

A special setting for the channel has to be created in “Advanced Settings”. This is the place for all settings that don’t have an UI and is written in JSON.

<figure><img src="/files/kiYXoP4DxiE7IwM4MNhi" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
Please check if there is a red mark in the sidbar. In this case the JSON is not valid and can not be saved.
{% endhint %}

### Description Structure of the JSON document

* parameters silence, noise and threshold are freely configurable
* configuration per channel
* transcoding feature necessary

```json
{
    "fallback": {
        "url": "http://api.streamabc.net/sources/mounts/redirect/qc_0dm7w3mdgo3b_koaz",
        "max_silence": "10",
        "min_noise": "10",
        "threshold": "-30"
    }
}
```

<mark style="color:red;">`fallback`</mark> is the Key for the settings

<mark style="color:red;">`url`</mark> is the StreamURL of the fallback stream. You can just copy the URL of the source here. However, we have a special service that redirects to the source if a channelkey (our unique ID for a channel) is given. It auto-selects fallback mounts. The syntax is <http://api.streamabc.net/sources/mounts/redirect>/\<channelkey> Just use the channelkey of the current channel here. You can find it under “Setup”

<mark style="color:red;">`max_silence`</mark> is the number of seconds that the stream has to be silent before switching to fallback

<mark style="color:red;">`min_noise`</mark> is the number of seconds without silence before switching back

<mark style="color:red;">`threshold`</mark> is the audio level in dB that is considered silence

### Special use cases

1. If the fallback is a Audalaxy cloud playout there is no need to add an additional source. In that case use the special URL <http://api.streamabc.net/sources/mounts/redirect>/\<channelkey>/playout and replace \<channelkey> with the channelkey of the playout channel.
2. In case of sources with integrated bitflips we need a dedicated fallback url for every codec and bitrate as it is not possible to transcode these channels (in order to not loose the bitflips)

## Geoblocking / Geostreaming

In disallowed countries an audio file is played and the stream stopped.

```json
{
    "geo_allow_countries": ["DE","AT"],
    "geo_fallback": "https://url.zu.einer.audiodatei",
    "geo_active_hours": [20,21]
}
```

<mark style="color:red;">`geo_allow_countries`</mark>

Array specification of which countries are allowed to stream freely, all others are blocked; specify as ISO code

<mark style="color:red;">`geo_fallback`</mark>

URL to a file that is played as an announcement

<mark style="color:red;">`geo_active_hours`</mark>

Optional array with hours as a number when blocking is active. If it is always to be active, omit this block or specify an empty array

## Metadata delay

In advanced settings you can specify that the incoming metadata should be delayed (in seconds).

```json
{
    "metadata_delay": 30
}
```
