0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

mpg123のラッパースクリプト

Last updated at Posted at 2022-07-21

こんな感じのスクリプトにしています。

jazz.sh
#!/bin/sh

if [ $# -eq 0 ]; then
        echo "jazz.sh [wbgo|wwoz|wayo|sakura]"
        exit 1
fi

while getopts bk option
do
  case $option in
    b)
     BG="yes"
     ;;
    k)
     KI="yes"
     ;;
    \?)
      exit 1
  esac
done

shift `expr "${OPTIND}" - 1`
if [ $# -ge 1 ]; then
case $@ in
        "wbgo" )
ST="http://wbgo.streamguys.net/wbgo128"
SR="48000"
        ;;
        "wwoz" )
ST="http://wwoz-sc.streamguys1.com/wwoz-hi.mp3"
SR="44100"
        ;;
        "wayo" )
ST="http://streaming.wayofm.org/wayo-192"
SR="48000"
        ;;
        "sakura" )
ST="http://kathy.torontocast.com:3330/stream"
SR="44100"
        ;;
        * )
echo "station incorrect"
        ;;
esac
else
  killall mpg123
fi

if [ -n "${ST}" ]; then
N=`awk '/default/{gsub("pcm","");gsub(":","");print $1}' /dev/sndstat`
sysctl dev.pcm.${N}.bitperfect=1 > /dev/null
sysctl dev.pcm.${N}.play.vchanrate=${SR} > /dev/null
if [ -n "${BG}" ]; then
/usr/local/bin/mpg123 --no-control --utf8 ${ST} > /tmp/jazz.log 2>&1 &
else
/usr/local/bin/mpg123 --utf8 ${ST}
fi

fi

sakuraは日本のJAZZステーションです。けっこういいですよ。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?