YCSTOA

From OpenSourceRadio
Jump to: navigation, search

This is an open source project to develop a profanity delay/dump for community radio broadcasters. The eventual goal is to use time decompression to refill the delay buffer after a dump, though the initial version will simply playout a pre-recorded file to cover the offending audio.

Current Status

The current plan is to use liquidsoap scripting language to produce a delay in the live audio. A shell script will watch for an interrupt on the parallel port or a gpio interface to trigger a variable change in liquidsoap via the telnet or unix socket interface. The following example liquidsoap script is working for the delay and dump audio switching. Still to be done is auto switching back to live audio feed, likely by implementing to playlist.reload.

#!/usr/local/bin/liquidsoap

## Liquidsoap script to process realtime audio from soundcard input, via
## alsa, create a delay in the audio, if instructed dump the buffer and
## playout a pre-recorded file while rebuilding buffer and then output,
## via alsa, to the soundcard

# Allow remote access on telnet
set("server.telnet", true)

# Set up logging
set("log.file.path", "/home/dragon/p-delay.log")
set("log.stdout", true)

# Set alsa buffer and frame size to prevent underruns
#set("alsa.buffer_length", 0)
# set("frame.size",882)
# set("frame.duration",0.005)

# Define file to play on buffer dump
dumpfile = single("~/Music/notsafeforair.wav")

# Define standard input source, alsa, stream, etc.
live = mksafe(
  input.alsa(bufferize=false)
)

# Pass live audio input through delay filter
live = ladspa.delay_60s(
  delay = 10.0,
  dry_wet_balance = 1.0,
  live
)

# Create server variable for source select
dump = interactive.bool("dump", false)


# Set output based on selected source
audio = switch(track_sensitive=false,[(dump,dumpfile), ({true},live)])

# Output to the soundcard
output.alsa(bufferize=false, audio)

To Do...

  • create shell script to watch for parallel port interrupt and issue dump command to liqiuidsoap instance
  • move from telnet to unix socket interface to increase security
  • create webui for:
    • audio file upload
    • duration setting
    • trigger button
    • enable/disable trigger
    • arm/disarm delay
    • trigger signal feedback monitoring
  • Implement a time stretching option instead of replacement audio
    • Option 1
      • use gsteamer 'pitch' (pitch=1 tempo=0.x) plugin at multiple rates to slowly increase speed while buffer fills back up
      • possibly implement the above with two main stages so that you have a short and long dump
      • in addition to two dump lengths add a third stage with replacement audio fallback
    • Option 2
      • use jack and lv2 plugins
      • control script simply moves the jack connections to bypass the different stages of tempo adjust
    • Option 3
      • investigate the sliding time and pitch shift effect in the latest versions of Audacity
      • would need to play with the start and end “tempo”
    • Option 4
  • Test with low power hardware
    • rPi
    • cubieboard
    • banana-Pi
    • lowpower PC with PCI audio interface
      • PCI audio interface best likely solution as balanced analog I/O and digital exist as well as higher bit depth/sample rates
  • reassess and define hardware requirements
  • Create software installation images for DIY
  • design and offer turnkey solution