This creates a new alsa device that you can use with liquidsoap. The plug operator in ALSA is used to work-around any hardware limitations in your device (mixing multiple outputs, resampling etc.). In some cases you may need to read more about ALSA and define your own PCM device.
Once you have created this device, you can use it in liquidsoap as follows:
input.alsa(device="pcm.liquidsoap", ...)
With my current setup (see .env) I have no issues with my audio output at all. As my output device I use a YAMAHA AG06 MK2. My asound.conf looks like this:
pcm.aura_engine { type plug slave { pcm "hw:CARD=AG06MK2,DEV=0" }}pcm.aura_recorder { type plug slave { pcm "pcm.aura_engine" }}
I do run into issues when using a input device (AURA_ENGINE_INPUT_DEVICE=someotheraudiodevice). @david I am thinking about testing this with just liquidsoap. Do you have some thoughts on what the simplest liquidsoap script could be to test this?
I did test all this on 1.0.0-alpha1 with docker compose.
My .env file:
# Released versions of the Docker imagesAURA_ENGINE_VERSION=1.0.0-alpha1AURA_ENGINE_API_VERSION=1.0.0-alpha1AURA_ENGINE_CORE_VERSION=1.0.0-alpha1# Version of postgres. Defaults to 14# POSTGRES_VERSION=14### GENERAL# TimezoneTIMEZONE=Europe/Vienna# Folder to store service log filesAURA_LOGS=../../logs# Folder holding audio sources provided by Tank (absolute path)AURA_AUDIO_STORE_SOURCE=../../audio/source# Folder holding M3U PlaylistsAURA_AUDIO_STORE_PLAYLIST=../../audio/playlist# Folder holding audio for fallback scenariosAURA_AUDIO_STORE_FALLBACK=../../audio/fallback# Folder holding audio block recordingsAURA_AUDIO_STORE_RECORDINGS=../../audio### ENGINE# Possible values: debug, info, warning, error, criticalAURA_ENGINE_LOG_LEVEL=debug# Database for caching scheduling dataAURA_ENGINE_DB_HOST=engine-postgresAURA_ENGINE_DB_NAME=aura_engineAURA_ENGINE_DB_USER=aura_engineAURA_ENGINE_DB_PASS=passwd# APIAURA_ENGINE_API_BASE_URL=http://engine-api:8008/AURA_STEERING_BASE_URL=http://steering:8000/AURA_TANK_BASE_URL=http://tank:8040/AURA_TANK_ENGINE_PASSWORD=passwd# Details for the Station Fallback i.e. the default show when nothing is scheduledAURA_ENGINE_FALLBACK_SHOW_NAME=PLAYLOG_TESTAURA_ENGINE_FALLBACK_SHOW_ID=666# Offset in seconds how long it takes for Liquidsoap to actually execute a scheduler command; Crucial to keep things in syncAURA_ENGINE_LATENCY_OFFSET=0.5# Fade duration when selecting another mixer input (seconds)AURA_ENGINE_FADE_IN_TIME=1.5AURA_ENGINE_FADE_OUT_TIME=1.5# Host and UDP port where heartbeat is sent to (disabled if empty string)# Seconds how often the vitality of Engine Core should be checked (default=1)AURA_ENGINE_HEARTBEAT_SERVER=AURA_ENGINE_HEARTBEAT_SERVER_PORT=43334AURA_ENGINE_HEARTBEAT_FREQUENCY=1### ENGINE API# Possible values: debug, info, warning, error, criticalAURA_ENGINE_API_LOG_LEVEL=debug# Configure the database for engine-apiAURA_ENGINE_API_DB_NAME=aura_engine_apiAURA_ENGINE_API_DB_USER=aura_engine_apiAURA_ENGINE_API_DB_PASS=passwd# Set the URL engine-api should bind to. Note that setting this to 0.0.0.0:8008 would make engine-api globally accessible. You probably want to set this to a private network.AURA_ENGINE_API_BIND_URL=0.0.0.0:8008### ENGINE CORE# Audio Device SettingsAURA_ENGINE_OUTPUT_DEVICE=pcm.aura_engineAURA_ENGINE_INPUT_DEVICE=# Fallback SettingsAURA_ENGINE_FALLBACK_TYPE=folderAURA_ENGINE_FALLBACK_FOLDER_RELOAD=300AURA_ENGINE_FALLBACK_MAX_BLANK=15.AURA_ENGINE_FALLBACK_MIN_NOISE=0.AURA_ENGINE_FALLBACK_THRESHOLD=-80.# Misc SettingsAURA_ENGINE_CORE_LOG_LEVEL=5AURA_ENGINE_FRAME_SAMPLERATE=AURA_ENGINE_FRAME_DURATION=AURA_ENGINE_FRAME_SIZE=AURA_ENGINE_API_URL_PLAYLOG=http://engine-api:8008/api/v1/playlog# Telnet SettingsAURA_ENGINE_TELNET_ENABLE=trueAURA_ENGINE_TELNET_HOST=0.0.0.0AURA_ENGINE_TELNET_PORT=1234AURA_ENGINE_TELNET_SERVER_TIMEOUT=16380# Stream Input SettingsAURA_ENGINE_STREAM_INPUT_MAX_BUFFER=5.0AURA_ENGINE_STREAM_INPUT_TIMEOUT=10.0# Stream Output SettingsAURA_ENGINE_STREAM_OUTPUT_ENABLE=falseAURA_ENGINE_STREAM_OUTPUT_ENCODING=oggAURA_ENGINE_STREAM_OUTPUT_BITRATE=128AURA_ENGINE_STREAM_OUTPUT_CHANNELS=2AURA_ENGINE_STREAM_OUTPUT_HOST=localhostAURA_ENGINE_STREAM_OUTPUT_PORT=8888AURA_ENGINE_STREAM_OUTPUT_USER=sourceAURA_ENGINE_STREAM_OUTPUT_PASSWORD=sourceAURA_ENGINE_STREAM_OUTPUT_MOUNTPOINT=aura-radio.oggAURA_ENGINE_STREAM_OUTPUT_NAME=AURA.radioAURA_ENGINE_STREAM_OUTPUT_URL=https://aura.radioAURA_ENGINE_STREAM_OUTPUT_DESCRIPTION=Music from the community radio software suiteAURA_ENGINE_STREAM_OUTPUT_GENRE=music### ENGINE RECORDER# Set an ALSA audio device or HTTP audio streamAURA_ENGINE_RECORDER_AUDIO_DEVICE=pcm.aura_recorder# audio codec format, for example "pcm_s32le"AURA_ENGINE_RECORDER_SAMPLE_FORMAT=# sampling rate, for example 44100AURA_ENGINE_RECORDER_SAMPLE_RATE=# time length of one recording block in seconds, for example 1800AURA_ENGINE_RECORDER_SEGMENT_LENGTH=1800# name of the segment, for example "%Y-%m-%d_%H:%M:%S_%s"AURA_ENGINE_RECORDER_SEGMENT_STRING_FORMAT=%Y-%m-%d_%H:%M:%S# set to true if you want to sync the content of AURA_AUDIO_STORE/recordings/block to somewhere elseAURA_ENGINE_RECORDER_SYNC=False# the destination where we sync to, this can be a remote location. If you chose a remote location# make sure that you supply a sshkey, otherwise the script will ask you for your password every# day# for example user@remote_server:/tmp/audio# AURA_ENGINE_RECORDER_SYNC_DESTINATION=/tmp# the options with which we start rsync. They are not allowed to have spaces in between them# for example "-a" or "-apogt"# AURA_ENGINE_RECORDER_SYNC_OPTIONS=-a# set to True if you want to delete audio files older than X daysAURA_ENGINE_RECORDER_DELETE=False# AURA_ENGINE_RECORDER_DELETE_OLDER_THAN=7AURA_ENGINE_RECORDER_LOG_LEVEL=INFO### DEVELOPMENT #### If you want to use a dev-setup, which exposes some more ports# and builds the containers locally, uncomment the following# line# COMPOSE_FILE=docker-compose.yml:docker-compose.dev.yml
Thanks a lot for testing. Please note this ticket is only about live audio/analog line-in. Line-out is working in my experience without a glitch.
For line-in, it is very important to find the correct settings for your device. Every device has their own native settings which work best. Here in the section "detecting the correct frame size" are some ideas, to come close to them. This is more a trial an error approach and for sure not ideal.
Try a basic liquidsoap script with line-in and tune it's settings. For example test_alsa_framesize.liq.
Then I suggest to try the settings natively in Engine Core, without Docker, to ensure there are no latency issues due to Docker. The relevant settings in engine.ini to tune your device is in the [audio] section.
David Trattnigchanged title from Test how Liquidsoap live audio behaves using a dedicated PCM device configuration to Test how Liquidsoap live audio/analog line-in behaves using a dedicated PCM device configuration
changed title from Test how Liquidsoap live audio behaves using a dedicated PCM device configuration to Test how Liquidsoap live audio/analog line-in behaves using a dedicated PCM device configuration