Advertisement
MezzFA0

Sample liquid soap config, streams from JACK to Icecast

Sep 13th, 2012
1,514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.90 KB | None | 0 0
  1. # Script to run liquid soap from a command line.  This will connect to the
  2. # local icecast server streaming out the line in from the sound card.
  3. #
  4. # Line in is passed through liquid soaps compressor and limiter (via jack)
  5. # before being sent to the stream.
  6. #
  7. # We're setting up a mono and stereo feed separately to use as required
  8. #
  9. # The Voice Asia 2012 - WMM 07-09-2012
  10.  
  11. # Icecast Settings, change as required
  12. icecastPassword="PASSWORD_GOES_HERE"
  13. icecastMountPoint="stream"
  14. icecastMountPointStereo="stereoStream"
  15. icecastTitle="The Voice Asia"
  16. icecastPort=9999
  17. icecastHost="localhost"
  18. icecastURL="http://www.thevoiceasia.com"
  19. icecastGenre="Hindi"
  20. icecastDescription="The Voice Asia, bringing you the best from Bollywood, Bhangra, Gospel and everything in between"
  21.  
  22. # Emergency fall back file if theres a silence of more than 5 seconds
  23. # Amend path as required
  24. emergencyFile = mksafe(single("/var/audio/emergency/song.mp3"))
  25.  
  26. # Encoder quality settings, variables are forbidden in the encoder these are
  27. # only here as a reference for default script setup:
  28. # monoBitRate=64
  29. # stereoBitRate=128
  30. # encoderSampleRate=44100
  31. # Change in the icecast output section at the bottom of this script if you
  32. # need different settings.
  33.  
  34.  
  35. # Liquid Soap inner workings, do NOT change unless
  36. # you know what you're doing!
  37.  
  38. # Change the log file path to somewhere accessible
  39. set("log.file.path", "/tmp/liquidsoap.log")
  40.  
  41. # Function to connect System capture to Liquid Soap
  42. # Handles mono and stereo
  43. def jackConnect()
  44.   system("jack_connect system:capture_1 liquidsoapstereo:in_0")
  45.   system("jack_connect system:capture_2 liquidsoapstereo:in_1")
  46. end
  47.  
  48. # Get the input from JACK
  49. liveStereo = (input.jack(id="liquidsoapstereo"):source(2,0,0))
  50.  
  51. # Silence Detection, plays after 5 seconds of silence
  52. liveStereo = strip_blank(liveStereo, length=5.0)
  53. liveStereo = fallback(track_sensitive=false, [liveStereo, emergencyFile])
  54.  
  55. # Compress it
  56. liveStereo = compress(ratio=3.0, attack=38.0, release=85.0, threshold=-20.0, knee=0.5, gain=8.0, liveStereo)
  57.  
  58. # Limit it
  59. liveStereo = limit(ratio=3.0, attack=38.0, release=85.0, threshold=-3.0,knee=0.5, liveStereo)
  60.  
  61. #Provide Output to JACK for monitoring purposes
  62. output.jack(liveStereo, id="soapstereo")
  63.  
  64. #Output to Local IceCast Server (Mono)
  65. liveMono = mean(liveStereo) #Convert Live Stereo to Mono
  66. output.icecast(%mp3(stereo=false, samplerate=44100, bitrate=64),liveMono, description=icecastDescription, genre=icecastGenre, url=icecastURL, name=icecastTitle, mount=icecastMountPoint, host=icecastHost, password=icecastPassword, port=icecastPort, on_start=jackConnect)
  67.  
  68. #Output to Local IceCast Server (Stereo)
  69. output.icecast(%mp3(stereo=true, samplerate=44100, bitrate=128),liveStereo, description=icecastDescription, genre=icecastGenre, url=icecastURL, name=icecastTitle, mount=icecastMountPointStereo, host=icecastHost, password=icecastPassword, port=icecastPort, on_start=jackConnect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement