标签: mpd

  • Increasing the amount of inotify watchers for debian

    sudo cat /proc/sys/fs/inotify/max_user_watches

    sudo sh -c “echo fs.inotify.max_user_watches=524288 >> /etc/sysctl.conf”

    sudo sysctl -p

    sudo cat /proc/sys/fs/inotify/max_user_watches

  • Setup Home WiFi Audio System

    Build home MPD wifi audio system, by combine:

    • Active Speaker
    • Wifi Router with usb port, and support openwrt
    • USB sound card

    Upgrade openwrt to the latest version

    SSH log into openwrt

    ######################################
    ######### Repository #################
    
    cp /etc/opkg/distfeeds.conf  /etc/opkg/distfeeds.conf.bak
    sed -i "s#downloads.openwrt.org#mirrors.ustc.edu.cn/openwrt#g" /etc/opkg/distfeeds.conf
    #sed -i "s#downloads.openwrt.org#mirrors.tuna.tsinghua.edu.cn/openwrt#g" /etc/opkg/distfeeds.conf
    #sed -i "s#downloads.openwrt.org#mirrors.aliyun.com/openwrt#g" /etc/opkg/distfeeds.conf
    #sed -i "s#downloads.openwrt.org#mirrors.cloud.tencent.com/openwrt#g" /etc/opkg/distfeeds.conf
    
    opkg update
    
    
    ######################################
    ########## pulseaudio ################
    
    opkg install kmod-input-core
    opkg install kmod-sound-core
    opkg install kmod-usb-audio
    opkg install pulseaudio-daemon
    
    
    #########################################
    ########## Sound Blaster ################
    # opkg install kmod-ac97
    # opkg install kmod-sound-ens1371
    
    
    ########## AC 97 ########################
    #opkg install kmod-sound-cs5535audio 
    
    
    ####### Motherboard Sound Card ##########
    #opkg install  kmod-sound-i8x0
    
    ############ Soc Sound Card #############
    #opkg install  kmod-sound-soc-core 
    
    
    
    ##### Editor ############################ 
    # opkg install nano
    
    
    ###########  Utility  ###################
    #opkg install usbutils
    #opkg install alsa-utils
    
    
    ### Allow module load ###
    sed -i "s/--disallow-module-loading//"   /etc/init.d/pulseaudio
    
    ### Load TCP module ###
    sed -i "s/load-module module-native-protocol-unix/load-module module-native-protocol-tcp auth-anonymous=1/"  /etc/pulse/system.pa
    
    
    
    
    
    ### Firewall ###
    sh -c " cat >/etc/config/firewall " << EOF
    
    
    ######  ssh port ##################
    config redirect
           option src              wan
           option src_dport        22
           option dest             lan
           option dest_ip          192.168.1.1
           option dest_port        22
           option proto            tcp
    
    ###### pulseaudio port ############
    config redirect
           option src              wan
           option src_dport        4713
           option dest             lan
           option dest_ip          192.168.1.1
           option dest_port        4713
           option proto            tcp
    
    ###### Http Port ##################
    onfig redirect
            option src 'wan'
            option src_dport '80'
            option dest 'lan'
            option dest_ip '192.168.1.1'
            option dest_port '80'
            option proto 'tcp'
    
    EOF
    
    
    
    /etc/init.d/firewall   restart
    /etc/init.d/pulseaudio restart
    
    
    
    
    ######################################
    ######################################
    ########## WiFI Relay ################
    opkg install relayd
    opkg install luci-proto-relay
    
    
    # From web admin portal, setup new wireless wan port for 5G and 2G separately:
    # http://192.168.1.1/cgi-bin/luci/
    ### Network
    ### Wireless
    ### Scan
    ### Selected your existed SSID, Joining Network
    ### ## Replace wireless configuration  = yes
    ### ## Create / Assign firewall-zone   = LAN
    ### Go to Network/Interface
    ### Set the IP of  wireless wan, as normal

    Login into your MPD system, add the following block into the the mpd.conf file:

    audio_output {
    
     type "pulse"
    
     name " Wifi Router"
    
     server "IP_OF_WIFI_ROUTER:4713" 
    
    }

    Now, you can find the “Wifi Router” option item, from Outputs/Server properties/M.A.L.P, suppose M.A.L.P apk installed android handset

  • Play DSD dff file within MPD daemon

    To support play DSD dff file inrealtime mode, we must add dsdiff plugin in mpd config file.

    decoder {
      plugin “ffmpeg”
      enable “yes”
    }

    decoder {
      plugin “dsdiff”
      enable “yes”
    }

    cat mpd.conf

    music_directory     “/music”
    playlist_directory “/opt/local/run/mpd/playlists”
    db_file            “/opt/local/run/mpd/database”
    log_file       “/opt/local/run/mpd/log”
    pid_file       “/opt/local/run/mpd/mpd.pid”
    state_file         “/opt/local/run/mpd/state”
    sticker_file      “/opt/local/run/mpd/sticker.sql”

    user           “root”
    group          “root”
    bind_to_address         “any”
    #bind_to_address       “localhost”
    bind_to_address         “/opt/local/run/mpd/socket”
    port           “6600”


    # default=notice
    # secure=info

    log_level      “default”
    #log_level              “secure”
    #log_level              “verbose”
    #log_level              “warning”
    #log_level              “error”



    restore_paused         “no”
    save_absolute_paths_in_playlists  “no”
    metadata_to_use  “artist,album,title,track,name,genre,date,composer,performer,disc”

    auto_update        “yes”
    auto_update_depth      “8”


    follow_outside_symlinks        “yes”
    follow_inside_symlinks      “yes”



    zeroconf_enabled       “yes”
    zeroconf_name          “Music Player @ %h”


    #password                        “password@read,add,control,admin”
    default_permissions         “read,add,control,admin”



    #database {
    #       plugin “proxy”
    #       host “other.mpd.host”
    #       port “6600”
    #}


    decoder {
      plugin “ffmpeg”
      enable “yes”
    }

    decoder {
      plugin “dsdiff”
      enable “yes”
    }


    #input {
    #        plugin “curl”
    #       proxy “proxy.isp.com:8080”
    #       proxy_user “user”
    #       proxy_password “password”
    #}


    #audio_output {
    #   type       “alsa”
    #   name       “ALSA”
    #   device     “hw:0,0”   # optional
    #   mixer_type      “hardware” # optional
    #   mixer_device   “default”  # optional
    #   mixer_control  “PCM”      # optional
    #   mixer_index “0”     # optional
    #}

    #audio_output {
    #    type                    “fifo”
    #    name                    “my_fifo”
    #    path                    “/tmp/mpd.fifo”
    #    format                  “44100:16:2”
    #}


    # creative usb card
    #audio_output {
    #        type            “alsa”
    #        name            “MP3”
    #        device          “hw:CARD=MP3,DEV=0”
    #        mixer_type      “software”      # optional
    #}


    #audio_output {
    #        type            “alsa”
    #        name            “TerraTec”
    #        device          “iec958:CARD=Device,DEV=0”
    #        mixer_type      “software”      # optional
    #}

    #audio_output {
    #        type            “alsa”
    #        name            “C-Media”
    #        device          “iec958:CARD=Set,DEV=0”
    #        mixer_type      “hardware”      # optional
    #}

    # Via Winner AD-86D amplifer
    audio_output {
            type            “alsa”
            name            “Audio”
            device          “hw:CARD=AUDIO,DEV=0”
            mixer_type      “software”    
    }



    # via Jack Daemon
    #audio_output {
    #        type “jack”
    #        name “My Jack Output”
    #        mixer_type      “software”
    #}



    #
    # An example of an OSS output:
    #
    #audio_output {
    #   type       “oss”
    #   name       “My OSS Device”
    ##  device     “/dev/dsp” # optional
    ##  mixer_type      “hardware” # optional
    ##  mixer_device   “/dev/mixer”   # optional
    ##  mixer_control  “PCM”      # optional
    #}
    #
    # An example of a shout output (for streaming to Icecast):
    #
    #audio_output {
    #   type       “shout”
    #   encoder    “vorbis”       # optional
    #   name       “My Shout Stream”
    #   host       “localhost”
    #   port       “8000”
    #   mount      “/mpd.ogg”
    #   password   “hackme”
    #   quality    “5.0”
    #   bitrate    “128”
    #   format     “44100:16:1”
    ##  protocol   “icecast2”     # optional
    ##  user       “source”       # optional
    ##  description “My Stream Description”    # optional
    ##  url     “http://example.com”   # optional
    ##  genre      “jazz”         # optional
    ##  public     “no”           # optional
    ##  timeout    “2”        # optional
    ##  mixer_type      “software”     # optional
    #}
    #
    # An example of a recorder output:
    #
    #audio_output {
    #   type       “recorder”
    #   name       “My recorder”
    #   encoder    “vorbis”       # optional, vorbis or lame
    #   path       “/opt/local/run/mpd/recorder/mpd.ogg”
    ##  quality    “5.0”          # do not define if bitrate is defined
    #   bitrate    “128”          # do not define if quality is defined
    #   format     “44100:16:1”
    #}
    #
    # An example of a httpd output (built-in HTTP streaming server):
    #
    #audio_output {
    #   type       “httpd”
    #   name       “My HTTP Stream”
    #   encoder    “vorbis”       # optional, vorbis or lame
    #   port       “8000”
    #   bind_to_address “0.0.0.0”      # optional, IPv4 or IPv6
    ##  quality    “5.0”          # do not define if bitrate is defined
    #   bitrate    “128”          # do not define if quality is defined
    #   format     “44100:16:1”
    #   max_clients “0”        # optional 0=no limit
    #}
    #
    # An example of a pulseaudio output (streaming to a remote pulseaudio server)
    #
    #audio_output {
    #   type       “pulse”
    #   name       “My Pulse Output”
    ##  server     “remote_server”    # optional
    ##  sink       “remote_server_sink”   # optional
    #}
    #
    # An example of a winmm output (Windows multimedia API).
    #
    #audio_output {
    #   type       “winmm”
    #   name       “My WinMM output”
    ##  device     “Digital Audio (S/PDIF) (High Definition Audio Device)” # optional
    #       or
    ##  device     “0”     # optional
    ##  mixer_type “hardware” # optional
    #}
    #
    # An example of an openal output.
    #
    #audio_output {
    #   type       “openal”
    #   name       “My OpenAL output”
    ##  device     “Digital Audio (S/PDIF) (High Definition Audio Device)” # optional
    #}
    #
    # An example of an sndio output.
    #
    #audio_output {
    #   type       “sndio”
    #   name       “sndio output”
    #   mixer_type “hardware”
    #}
    #
    # An example of an OS X output:
    #
    #audio_output {
    #   type       “osx”
    #   name       “My OS X Device”
    ##  device     “Built-in Output”  # optional
    ##  channel_map      “-1,-1,0,1”   # optional
    #}
    #
    ## Example “pipe” output:
    #
    #audio_output {
    #   type       “pipe”
    #   name       “my pipe”
    #   command    “aplay -f cd 2>/dev/null”
    ## Or if you’re want to use AudioCompress
    #   command    “AudioCompress -m | aplay -f cd 2>/dev/null”
    ## Or to send raw PCM stream through PCM:
    #   command    “nc example.org 8765”
    #   format     “44100:16:2”
    #}
    #
    ## An example of a null output (for no audio output):
    #
    #audio_output {
    #   type       “null”
    #   name       “My Null Output”
    #   mixer_type      “none”         # optional
    #}
    #
    ###############################################################################


    # Normalization automatic volume adjustments ##################################
    #
    # This setting specifies the type of ReplayGain to use. This setting can have
    # the argument “off”, “album”, “track” or “auto”. “auto” is a special mode that
    # chooses between “track” and “album” depending on the current state of
    # random playback. If random playback is enabled then “track” mode is used.
    # See <http://www.replaygain.org> for more details about ReplayGain.
    # This setting is off by default.
    #
    #replaygain        “album”
    #
    # This setting sets the pre-amp used for files that have ReplayGain tags. By
    # default this setting is disabled.
    #
    #replaygain_preamp     “0”
    #
    # This setting sets the pre-amp used for files that do NOT have ReplayGain tags.
    # By default this setting is disabled.
    #
    #replaygain_missing_preamp “0”
    #
    # This setting enables or disables ReplayGain limiting.
    # MPD calculates actual amplification based on the ReplayGain tags
    # and replaygain_preamp / replaygain_missing_preamp setting.
    # If replaygain_limit is enabled MPD will never amplify audio signal
    # above its original level. If replaygain_limit is disabled such amplification
    # might occur. By default this setting is enabled.
    #
    #replaygain_limit      “yes”
    #
    # This setting enables on-the-fly normalization volume adjustment. This will
    # result in the volume of all playing audio to be adjusted so the output has
    # equal “loudness”. This setting is disabled by default.
    #
    #volume_normalization      “no”
    #
    ###############################################################################

    # Character Encoding ##########################################################
    #
    # If file or directory names do not display correctly for your locale then you
    # may need to modify this setting.
    #
    #filesystem_charset        “UTF-8”
    #
    ###############################################################################