Last active
October 1, 2025 19:48
-
-
Save ZiTAL/b306c09e098e2ad7003af6c77b3328a0 to your computer and use it in GitHub Desktop.
Revisions
-
ZiTAL revised this gist
Oct 1, 2025 . No changes.There are no files selected for viewing
-
ZiTAL revised this gist
Oct 1, 2025 . 1 changed file with 84 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,84 @@ host = "127.0.0.1" port = 8000 name = "Name" desc = "Description" url = "https://example.com" # free opus config free_passwd = "test" free_mount = "/test.opus" # acc config private_passwd = "test" private_mount = "/test.aac" # telnet settings.server.telnet.set(true) settings.server.telnet.bind_addr.set("0.0.0.0") settings.server.telnet.port.set(1234) # inputs input0 = input.pulseaudio(device="alsa_output.usb-PreSonus_AudioBox_USB_96_000000000000-00.stereo-fallback.monitor") input1 = input.pulseaudio(device="alsa_input.usb-BEHRINGER_UMC202HD_192k-00.Direct__Direct__source") # default input current_input = ref(0) # switch input based on ref() sel = switch(track_sensitive=false, [ (fun () -> current_input() == 0, input0), (fun () -> current_input() == 1, input1) ]) # safe fallback s = fallback(track_sensitive=false, [sel, blank()]) # server select input server.register("select", fun (arg) -> if arg == "0" then current_input := 0; "Switched to: INPUT 0" elsif arg == "1" then current_input := 1; "Switched to: INPUT 1" else "Usage: input_select <0|1>" end) # server status server.register("status", fun (_) -> "current=" ^ string(current_input()) ^ "\ninput0_ready=" ^ string(source.is_ready(input0)) ^ "\ninput1_ready=" ^ string(source.is_ready(input1))) # server get current input server.register("current", fun (_) -> if current_input() == 0 then "INPUT 0" else "INPUT 1" end) # free opus audio output.icecast( %opus(vbr="unconstrained", application="audio", samplerate=48000, channels=2, bitrate=160), host=host, port=port, password=free_passwd, mount=free_mount, name=name, description=desc, url=url, s ) # private aac audio output.icecast( %ffmpeg( format="adts", %audio(codec="aac", b="256k", ar=48000, ac=2) ), host=host, port=port, password=private_passwd, mount=private_mount, name=name, description=desc, url=url, s ) -
ZiTAL created this gist
Oct 1, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,82 @@ host = "127.0.0.1" port = 8000 name = "Name" desc = "Desc" url = "https://example.com" # vorbis config vorbis_passwd = "test" vorbis_mount = "/test.ogg" # mp3 config mp3_passwd = "test" mp3_mount = "/test.mp3" # telnet settings.server.telnet.set(true) settings.server.telnet.bind_addr.set("0.0.0.0") settings.server.telnet.port.set(1234) # inputs # pactl list short sources input0 = input.pulseaudio(device="alsa_output.usb-PreSonus_AudioBox_USB_96_000000000000-00.stereo-fallback.monitor") input1 = input.pulseaudio(device="alsa_input.usb-BEHRINGER_UMC202HD_192k-00.Direct__Direct__source") # default input current_input = ref(0) # switch input based on ref() sel = switch(track_sensitive=false, [ (fun () -> current_input() == 0, input0), (fun () -> current_input() == 1, input1) ]) # safe fallback s = fallback(track_sensitive=false, [sel, blank()]) # server select input server.register("select", fun (arg) -> if arg == "0" then current_input := 0; "Switched to: INPUT 0" elsif arg == "1" then current_input := 1; "Switched to: INPUT 1" else "Usage: input_select <0|1>" end) # server status server.register("status", fun (_) -> "current=" ^ string(current_input()) ^ "\ninput0_ready=" ^ string(source.is_ready(input0)) ^ "\ninput1_ready=" ^ string(source.is_ready(input1))) # server get current input server.register("current", fun (_) -> if current_input() == 0 then "INPUT 0" else "INPUT 1" end) # ogg/vorbis audio output.icecast( %vorbis.cbr(samplerate=48000, channels=2, bitrate=256), host=host, port=port, password=vorbis_passwd, mount=vorbis_mount, name=name, description=desc, url=url, s ) # mpeg/mp3 audio output.icecast( %mp3.cbr(samplerate=48000, bitrate=320, stereo=true), host=host, port=port, password=mp3_passwd, mount=mp3_mount, name=name, description=desc, url=url, s )