LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2788|回复: 42

mpd&&mpc播放音乐声音断断续续,卡,是怎么回事?

[复制链接]
发表于 2009-9-2 11:55:37 | 显示全部楼层 |阅读模式
昨天刚装好的时候能用阿!今天一开机就不行了    而且我把mpd加入开机daemon中怎么没用? 不能开机启动    我自己手动启动    虽然可以启动但有如下错误:
  1. cannot touch /var/run/daemon/mpd  permission denied
复制代码
..  郁闷死了
发表于 2009-9-2 12:04:02 | 显示全部楼层
不要把mpd加入daemon, 没必要给一个音乐播放器这种权限
读wiki(比较后边的部分), 以普通用户启动mpd.
我所有的mpd设置都放在~/.mpd
  1. ~/.mpd
  2. |-- config
  3. |-- mpd.db
  4. |-- mpd.error
  5. |-- mpd.log
  6. |-- mpd.pid
  7. |-- mpd.state
  8. `-- playlists
复制代码

启动mpd:
  1. $ mpd ~/.mpd/config
复制代码
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-9-2 12:33:50 | 显示全部楼层
我想开机启动啊!  懒得手动了   那就加到  /etc/rc.local?   我也是把这些文件都改在了 家目录,不过我没有config这个文件啊
可否贴一下你的配置文件呢?  我是照网上介绍的配置的  而且昨天还可以   怎么一重启就不行了呢?    找了好久没找到原因
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-9-2 12:42:19 | 显示全部楼层
我的/etc/mpd.conf如下:
  1. # An example configuration file for MPD
  2. # See the mpd.conf man page for a more detailed description of each parameter.
  3. # Files and directories #######################################################
  4. #
  5. # This setting controls the top directory which MPD will search to discover the
  6. # available audio files and add them to the daemon's online database. This
  7. # setting defaults to the XDG directory, otherwise the music directory will be
  8. # be disabled and audio files will only be accepted over ipc socket (using
  9. # file:// protocol) or streaming files over an accepted protocol.
  10. #
  11. music_directory                "~/music"
  12. #
  13. # This setting sets the MPD internal playlist directory. The purpose of this
  14. # directory is storage for playlists created by MPD. The server will use
  15. # playlist files not created by the server but only if they are in the MPD
  16. # format. This setting defaults to playlist saving being disabled.
  17. #
  18. playlist_directory "/home/linuxfish/mpd/playlists"
  19. #
  20. # This setting sets the location of the MPD database. This file is used to
  21. # load the database at server start up and store the database while the
  22. # server is not up. This setting defaults to disabled which will allow
  23. # MPD to accept files over ipc socket (using file:// protocol) or streaming
  24. # files over an accepted protocol.
  25. #
  26. db_file "/home/linuxfish/mpd/mpd.db"
  27. #
  28. # These settings are the locations for the daemon log files for the daemon.
  29. # These logs are great for troubleshooting, depending on your log_level
  30. # settings.
  31. #
  32. # The special value "syslog" makes MPD use the local syslog daemon. This
  33. # setting defaults to logging to syslog, otherwise logging is disabled.
  34. #
  35. log_file "/home/linuxfish/mpd/mpd.log"
  36. #
  37. # This setting sets the location of the file which stores the process ID
  38. # for use of mpd --kill and some init scripts. This setting is disabled by
  39. # default and the pid file will not be stored.
  40. #
  41. pid_file "/home/linuxfish/mpd/mpd.pid"
  42. #
  43. # This setting sets the location of the file which contains information about
  44. # most variables to get MPD back into the same general shape it was in before
  45. # it was brought down. This setting is disabled by default and the server
  46. # state will be reset on server start up.
  47. #
  48. state_file "/home/linuxfish/mpd/mpdstate"
  49. #
  50. ###############################################################################
  51. # General music daemon options ################################################
  52. #
  53. # This setting specifies the user that MPD will run as. MPD should never run as
  54. # root and you may use this setting to make MPD change its user ID after
  55. # initialization. This setting is disabled by default and MPD is run as the
  56. # current user.
  57. #
  58. user "linuxfish"
  59. #
  60. # This setting sets the address for the daemon to listen on. Careful attention
  61. # should be paid if this is assigned to anything other then the default, any.
  62. # This setting can deny access to control of the daemon.
  63. #
  64. # For network
  65. bind_to_address                "Arch"
  66. #
  67. # And for Unix Socket
  68. #bind_to_address                "~/.mpd/socket"
  69. #
  70. # This setting is the TCP port that is desired for the daemon to get assigned
  71. # to.
  72. #
  73. #port                                "6600"
  74. #
  75. # This setting controls the type of information which is logged. Available
  76. # setting arguments are "default", "secure" or "verbose". The "verbose" setting
  77. # argument is recommended for troubleshooting, though can quickly stretch
  78. # available resources on limited hardware storage.
  79. #
  80. #log_level                        "default"
  81. #
  82. # If you have a problem with your MP3s ending abruptly it is recommended that
  83. # you set this argument to "no" to attempt to fix the problem. If this solves
  84. # the problem, it is highly recommended to fix the MP3 files with vbrfix
  85. # (available from <http://www.willwap.co.uk/Programs/vbrfix.php>), at which
  86. # point gapless MP3 playback can be enabled.
  87. #
  88. #gapless_mp3_playback                        "yes"
  89. #
  90. # This setting enables MPD to create playlists in a format usable by other
  91. # music players.
  92. #
  93. #save_absolute_paths_in_playlists        "no"
  94. #
  95. # This setting defines a list of tag types that will be extracted during the
  96. # audio file discovery process. Optionally, 'comment' can be added to this
  97. # list.
  98. #
  99. #metadata_to_use        "artist,album,title,track,name,genre,date,composer,performer,disc"
  100. #
  101. ###############################################################################
  102. # Symbolic link behavior ######################################################
  103. #
  104. # If this setting is set to "yes", MPD will discover audio files by following
  105. # symbolic links outside of the configured music_directory.
  106. #
  107. #follow_outside_symlinks        "yes"
  108. #
  109. # If this setting is set to "yes", MPD will discover audio files by following
  110. # symbolic links inside of the configured music_directory.
  111. #
  112. #follow_inside_symlinks                "yes"
  113. #
  114. ###############################################################################
  115. # Zeroconf / Avahi Service Discovery ##########################################
  116. #
  117. # If this setting is set to "yes", service information will be published with
  118. # Zeroconf / Avahi.
  119. #
  120. #zeroconf_enabled                "yes"
  121. #
  122. # The argument to this setting will be the Zeroconf / Avahi unique name for
  123. # this MPD server on the network.
  124. #
  125. #zeroconf_name                        "Music Player"
  126. #
  127. ###############################################################################
  128. # Permissions #################################################################
  129. #
  130. # If this setting is set, MPD will require password authorization. The password
  131. # can setting can be specified multiple times for different password profiles.
  132. #
  133. #password                        "password@read,add,control,admin"
  134. #
  135. # This setting specifies the permissions a user has who has not yet logged in.
  136. #
  137. #default_permissions             "read,add,control,admin"
  138. #
  139. ###############################################################################
  140. # Input #######################################################################
  141. #
  142. input {
  143.         plugin "curl"
  144. #       proxy "proxy.isp.com:8080"
  145. #       proxy_user "user"
  146. #       proxy_password "password"
  147. }
  148. #
  149. ###############################################################################
  150. # Audio Output ################################################################
  151. #
  152. # MPD supports various audio output types, as well as playing through multiple
  153. # audio outputs at the same time, through multiple audio_output settings
  154. # blocks. Setting this block is optional, though the server will only attempt
  155. # autodetection for one sound card.
  156. #
  157. # See <http://mpd.wikia.com/wiki/Configuration#Audio_Outputs> for examples of
  158. # other audio outputs.
  159. #
  160. # An example of an ALSA output:
  161. #
  162. audio_output {
  163.         type                "alsa"
  164.         name                "My ALSA Device"
  165.         auto_resample    "no"
  166. #        device                "hw:0,0"        # optional
  167. #        format                "44100:16:2"        # optional
  168. #        mixer_device        "default"        # optional
  169. #        mixer_control        "PCM"                # optional
  170. #        mixer_index        "0"                # optional
  171. }
  172. #
  173. # An example of an OSS output:
  174. #
  175. #audio_output {
  176. #        type                "oss"
  177. #        name                "My OSS Device"
  178. #        device                "/dev/dsp"        # optional
  179. #        format                "44100:16:2"        # optional
  180. #        mixer_device        "/dev/mixer"        # optional
  181. #        mixer_control        "PCM"                # optional
  182. #}
  183. #
  184. # An example of a shout output (for streaming to Icecast):
  185. #
  186. #audio_output {
  187. #        type                "shout"
  188. #        encoding        "ogg"                        # optional
  189. #        name                "My Shout Stream"
  190. #        host                "localhost"
  191. #        port                "8000"
  192. #        mount                "/mpd.ogg"
  193. #        password        "hackme"
  194. #        quality                "5.0"
  195. #        bitrate                "128"
  196. #        format                "44100:16:1"
  197. #        protocol        "icecast2"                # optional
  198. #        user                "source"                # optional
  199. #        description        "My Stream Description"        # optional
  200. #        genre                "jazz"                        # optional
  201. #        public                "no"                        # optional
  202. #        timeout                "2"                        # optional
  203. #}
  204. #
  205. # An example of a httpd output (built-in HTTP streaming server):
  206. #
  207. #audio_output {
  208. #        type                "httpd"
  209. #        name                "My HTTP Stream"
  210. #        encoder                "vorbis"                # optional, vorbis or lame
  211. #        port                "8000"
  212. #        quality                "5.0"                        # do not define if bitrate is defined
  213. #        bitrate                "128"                        # do not define if quality is defined
  214. #        format                "44100:16:1"
  215. #}
  216. #
  217. # An example of a pulseaudio output (streaming to a remote pulseaudio server)
  218. #
  219. #audio_output {
  220. #        type                "pulse"
  221. #        name                "My Pulse Output"
  222. #        server                "remote_server"                # optional
  223. #        sink                "remote_server_sink"        # optional
  224. #}
  225. #
  226. ## Example "pipe" output:
  227. #
  228. #audio_output {
  229. #        type                "pipe"
  230. #        name                "my pipe"
  231. #        command                "aplay -f cd 2>/dev/null"
  232. ## Or if you're want to use AudioCompress
  233. #        command                "AudioCompress -m | aplay -f cd 2>/dev/null"
  234. ## Or to send raw PCM stream through PCM:
  235. #        command                "nc example.org 8765"
  236. #        format                "44100:16:2"
  237. #}
  238. #
  239. ## An example of a null output (for no audio output):
  240. #
  241. #audio_output {
  242. #        type                "null"
  243. #        name                "My Null Output"
  244. #}
  245. #
  246. # This setting will change all decoded audio to be converted to the specified
  247. # format before being passed to the audio outputs. By default, this setting is
  248. # disabled.
  249. #
  250. #audio_output_format                "44100:16:2"
  251. #
  252. # If MPD has been compiled with libsamplerate support, this setting specifies
  253. # the sample rate converter to use.  Possible values can be found in the
  254. # mpd.conf man page or the libsamplerate documentation. By default, this is
  255. # setting is disabled.
  256. #
  257. #samplerate_converter                "Fastest Sinc Interpolator"
  258. #
  259. ###############################################################################
  260. # Volume control mixer ########################################################
  261. #
  262. # These are the global volume control settings. By default, this setting will
  263. # be detected to the available audio output device, with preference going to
  264. # hardware mixing. Hardware and software mixers for individual audio_output
  265. # sections cannot yet be mixed.
  266. #
  267. # An example for controlling an ALSA, OSS or Pulseaudio mixer; If this
  268. # setting is used other sound applications will be affected by the volume
  269. # being controlled by MPD.
  270. #
  271. #mixer_type                        "hardware"
  272. #
  273. # An example for controlling all mixers through software. This will control
  274. # all controls, even if the mixer is not supported by the device and will not
  275. # affect any other sound producing applications.
  276. #
  277. #mixer_type                        "software"
  278. #
  279. # This example will not allow MPD to touch the mixer at all and will disable
  280. # all volume controls.
  281. #
  282. #mixer_type                        "disabled"
  283. #
  284. ###############################################################################
  285. # Normalization automatic volume adjustments ##################################
  286. #
  287. # This setting specifies the type of ReplayGain to use. This setting can have
  288. # the argument "album" or "track". See <http://www.replaygain.org> for more
  289. # details. This setting is disabled by default.
  290. #
  291. #replaygain                        "album"
  292. #
  293. # This setting sets the pre-amp used for files that have ReplayGain tags. By
  294. # default this setting is disabled.
  295. #
  296. #replaygain_preamp                "0"
  297. #
  298. # This setting enables on-the-fly normalization volume adjustment. This will
  299. # result in the volume of all playing audio to be adjusted so the output has
  300. # equal "loudness". This setting is disabled by default.
  301. #
  302. #volume_normalization                "no"
  303. #
  304. ###############################################################################
  305. # MPD Internal Buffering ######################################################
  306. #
  307. # This setting adjusts the size of internal decoded audio buffering. Changing
  308. # this may have undesired effects. Don't change this if you don't know what you
  309. # are doing.
  310. #
  311. #audio_buffer_size                "2048"
  312. #
  313. # This setting controls the percentage of the buffer which is filled before
  314. # beginning to play. Increasing this reduces the chance of audio file skipping,
  315. # at the cost of increased time prior to audio playback.
  316. #
  317. #buffer_before_play                "10%"
  318. #
  319. ###############################################################################
  320. # Resource Limitations ########################################################
  321. #
  322. # These settings are various limitations to prevent MPD from using too many
  323. # resources. Generally, these settings should be minimized to prevent security
  324. # risks, depending on the operating resources.
  325. #
  326. #connection_timeout                "60"
  327. #max_connections                "10"
  328. #max_playlist_length                "16384"
  329. #max_command_list_size                "2048"
  330. #max_output_buffer_size                "8192"
  331. #
  332. ###############################################################################
  333. # Character Encoding ##########################################################
  334. #
  335. # If file or directory names do not display correctly for your locale then you
  336. # may need to modify this setting. After modification of this setting mpd
  337. # --create-db must be run to change the database.
  338. #
  339. filesystem_charset                "UTF-8"
  340. #
  341. # This setting controls the encoding that ID3v1 tags should be converted from.
  342. #
  343. id3v1_encoding                        "UTF-8"
  344. #
  345. ###############################################################################
复制代码
回复 支持 反对

使用道具 举报

发表于 2009-9-2 13:01:28 | 显示全部楼层
不想手动开启就加到~/.xinitrc里面

还有, 我的~/.mpd/config
  1. bind_to_address       localhost
  2. port                  6600
  3. music_directory       "~/pod/music"
  4. playlist_directory    "~/.mpd/playlists"
  5. db_file               "~/.mpd/mpd.db"
  6. log_file              "~/.mpd/mpd.log"
  7. error_file            "~/.mpd/mpd.error"
  8. pid_file              "~/.mpd/mpd.pid"
  9. state_file            "~/.mpd/mpd.state"
  10. user                  "me"
  11. filesystem_charset    "UTF-8"
  12. id3v1_encoding        "GBK"
复制代码

只想说, 为什么不读官方wiki...Alternative Setup那段
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-9-2 13:04:11 | 显示全部楼层
Post by lolilolicon;2023061
不想手动开启就加到~/.xinitrc里面

还有, 我的~/.mpd/config

  1. bind_to_address       localhost
  2. port                  6600
  3. music_directory       "~/pod/music"
  4. playlist_directory    "~/.mpd/playlists"
  5. db_file               "~/.mpd/mpd.db"
  6. log_file              "~/.mpd/mpd.log"
  7. error_file            "~/.mpd/mpd.error"
  8. pid_file              "~/.mpd/mpd.pid"
  9. state_file            "~/.mpd/mpd.state"
  10. user                  "me"
  11. filesystem_charset    "UTF-8"
  12. id3v1_encoding        "GBK"
复制代码


只想说, 为什么不读官方wiki...Alternative Setup那段


我想读来着啊   可我这里官方网站死活打不开啊?你那里能开吗?
回复 支持 反对

使用道具 举报

发表于 2009-9-2 13:15:17 | 显示全部楼层
...能...
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-9-2 13:32:23 | 显示全部楼层
汗~~   可以给个链接吗?
回复 支持 反对

使用道具 举报

发表于 2009-9-2 13:38:10 | 显示全部楼层
好吧... 其实过程非常简单

1.
  1. mkdir ~/.mpd && cd ~/.mpd && mkdir playlists
  2. touch config mpd.db mpd.error mpd.log mpd.pid mpd.state
复制代码

2.
编辑~/.mpd/config, 按我的例子就好了

3.
启动
  1. mpd ~/.mpd/config
复制代码

4.
开始放歌
  1. mpc update ; mpc clear ; mpc listall | mpc add ; mpc play
复制代码
回复 支持 反对

使用道具 举报

发表于 2009-9-2 13:40:58 | 显示全部楼层
问下,我执行mpc listall的时候出现错误

error: ACK [50@0] {listall} directory or file not found



而我确认
music_directory                "~/Music"
其中Music中是有音乐文件的
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表