/internet-radio

an internet radio player for monome norns

Primary LanguageLuaGNU General Public License v3.0GPL-3.0

currentscreenshot

stream internet radio from norns

inspired by @mlogger 's idea from the lines thread - "norns ideas"

* visit llllllll.com/internet-radio for discussion, ideas, and help


  • requires internet connection and mpv - not installed by default
    • disclaimer: this script, unlike most other scripts, internet-radio requires adding not only mpv, but also its dependency packages to your norns. doing so has the potential to cause unforeseen issues down the line with norns updates as your system would deviate from the base norns image.

  • to install this script, enter the following into maiden:

    • ;install https://github.com/tapecanvas/internet-radio
  • to install mpv on your norns (required), use one of the methods below:

    • install mpv from maiden:
      • in maiden,
        • run os.execute('sudo apt -y update') before installing mpv (refreshes package list) - no need to upgrade
        • then enter os.execute('sudo apt -y install mpv')
        • enter 'Y' when prompted and then hit 'enter' to continue the installation
        • will take a minute or so to install
        • if successful, you should see something like true exit 0 and <ok> in the matron window in maiden
    • or install mpv over ssh
      • ssh into norns ssh we@norns.local
      • run sudo apt update to refresh package list
      • run sudo apt install mpv
      • press enter when asked if you want to continue with install
      • wait for the install to complete (will return to prompt after successful install)
  • *the order that you install internet-radio and mpv does not matter

  • restart your norns after both internet-radio and mpv have been installed

controls:

  • if you aren't hearing anything, make sure your monitor and input volumes in norns mixer are turned up!

main controls:

  • e2 - scrolls through list of streams
  • e3 - favorites/unfavorites a stream
  • k3 - plays stream
  • k2 - stops playback

params menu:

  • stream list - choose a file containing a list of links to internet streams
  • exit option - how should mpv behave when you select another script?
    • close (default) - kill mpv if another script is selected
    • open - leave mpv running to run through effects scripts, etc
  • *pitch - adjust the pitch (and speed) of the stream (requires restarting stream to hear effect)
  • *speed - adjust the speed of the stream without altering pitch (requires restarting the stream)
    • *pitch and speed are not real-time controls, they insert their values into the mpv play command
    • *the stream will need to be re-started to hear the effect of changes to pitch and speed
      • the way mpv scaletempo works is weird and the documentation for it is even stranger.. (still trying to wrap my head around it honestly)
      • the pitch param mostly does pitch, but also speed.
      • the speed param works as expected + or - with pitch left untouched
      • *since streams are broadcast in real time, increasing speed or pitch will cause gaps in audio while the stream catches up, you can work around this in creative ways though, experiment

add your own streams:

DO NOT edit /code/internet-radio/lib/ files! This folder only exists to easily package/update the default stream lists with the script changes made to it will prevent updating the script from Maiden

  1. direct your browser of choice to maiden (http://norns.local/maiden/ or yournornsip/maiden)
  2. go to the /data/internet-radio/streams/ directory in the left side pane
  3. copy and rename template.lua or create your own filename.lua list
  4. follow the format:
return {
{name = "stream name", address = "streamurl"},
{name = "stream name", address = "streamurl"},
}

make a m3u stream of your tape folder:

also works for any other folder containing audio on your norns

  • in the data/internet-radio folder in maiden and make a new file
  • add the following lines inside that file:
#EXTM3U
/home/we/dust/audio/tape/

if you want to use a folder other than tape, use that folder name instead

  • save the file as yourfilename.m3u
  • then go to the "streams" file you want to add your tape stream to (can be one of the default streams lists, or make a new one based off the included template)
  • add the following line to the streams file:
    {name = "tapestream", address = "/home/we/data/internet-radio/yourfilename.m3u"},
  • reload the script and navigate to your newly updated stream file and listen to an endless stream of your tape folder!

supported stream formats:

  • MPV uses ffmpeg to decode everything, so any streaming format that ffmpeg supports should work.

    you will mainly see .m3u .mp3 and .pls streams

stream sources:

community streams:

  • if you make a custom list of streams that you want to share, submit a pull request to this repo and I will include it in the project for others to use!

to-do:

  • favorite selection control needs work still
  • add loop flag to mpv play call (not needed for typical streams, but for tape stream, or other non-infinite stream sources it would be nice to have)
  • bug fix: play icons sometimes show when they shouldn't
  • detach mpv activity from terminal - currently makes glitchy beep sound when switching streams if I try to do this with --no-terminal
  • look into making this a mod (would be much easier to switch streams when processing audio through other scripts if it was a mod)
  • beta test phase (currently)
  • look into radio garden api
  • demo video
  • add to norns.community when v1.0.0 is ready

archive:

  • mpv rubberband works much better for pitch manipulation
  • add instructions for making local tape folder stream creation
  • fixed mono streams to play through both inputs
  • rework favorite sort screen behavior
  • test with norns update 240221
  • quick fix accidental mass-favorite selection bug
  • pitch/speed param? https://mpv.io/manual/master/#audio-filters
  • fix favorite state saving bug
    • favorites get overwritten (should have seen this coming..) - also causes playing index to be off by num of favorites when reopen app if exit_option is open
  • revert /lib streams overwriting /data stream files
    • this will require a slightly different approach to pushing out new stream lists, but that's worth having more stability and better saving of user changes
  • remove params (add, edit, delete) - these were kind of redundant and would cause problems since default streams overwrite user changes
  • move /data/internet-radio/streams to prevent "local changes" preventing script updates
  • figure out update issue again
  • figure out update issue
  • add lines link to script header and readme
  • add BBC streams to /lib
  • rename and modify /lib/default.lua (make a template file) and update streams.lua
  • clean up code / comment / streams list (rename/remove default.lua)
  • clean up readme
  • update readme again
  • update script header controls
  • test everything thoroughly
    • state saving, adding streams in all manners, stream edits, etc
    • test install steps / use on other norns shields
    • exerything worked as expected on my a 2nd shield (mpv install and all current features)
  • fix: moving from one stream list to another while a stream is playing result in the play icon showing up in same index on new list but that index is not playing
  • think about community stream lists
  • add stream list select parameter to choose a file containing streams to use
  • MAJOR problem: comment hidden streams get removed from streams.lua after sort
    • DO NOT TRY to temporarily hide a stream from your station list by removing it from this steams.lua - it will be deleted from the table
  • add tips on finding streams / links to stream lists?
  • proper screenshot (see monome screenshot notes)
  • more diverse default streams
  • fix playing highlight issue when re-loading after close
  • move streams.lua to /code/internet-radio/lib folder
  • add supported stream format details to README and streams.lua
  • link to mpv docs in README
  • add grey now-playing highlight
  • state saving functionality (retains exit option and if set to open, updates screen to reflect currently playing stream)
  • add default exit parameter option (close - kill mpv on new script load, or open - allow to keep playing and use as input for other scripts)
  • update version in script header
  • change order of maiden and ssh instruction in readme
  • way to favorite streams / bump to top of list
  • delete current stream option in params
  • update streams.lua documentation comments
  • verify add script from params page works (:
  • change scroll from e3 to e2
  • change streams.txt to streams.lua - easier to hide and add streams
  • radio as script / tape input (https://llllllll.co/t/norns-ideas/17625/1332) ty @infinitedigits as always (:
    • without doing this: mpv runs as a separate process(doesn't register in norns mixer or get recorded to tape)
    • doing this means you have to use 'monitor' mix to listen to radio as an input source - but I might have a way around this.. (simple in -> out engine, or leverage softcut somehow?)
      • have decided against doing this for now.
    • makes sense since radio is not an engine, but a process that you're running on device.
  • modify / rename option in params
  • keyboard/encoder input to add streams