Mele + DAC + MPD => the perfect bit-perfect setup

Mele is just a great little platform for so many usage.
Since 2 weeks, i’m using one of mine as a bit perfect audio player:

  • ultra low power consumption – always ready to play
  • usb2 or spdif
  • sata if you don’t have nas

I’m using a Micromega MyDac in usb2 (299 Euros, the best sounding sub-1KEuro DAC).
The setup is quite simple:
(NAS) -> (NFS or CIFS) -> (MELE/MPD) -> (DAC)

The mele is hosting mpd without resampling (because resampling is evil).
Choose ubuntu or debian headless and update the kernel.

I have create a share on my nas and mounted it in /nas (replace XXX with samba ShareName, login, password)

# /etc/fstab
//192.168.1.1/XXX /nas cifs username=XXX,password=XXX,_netdev 0 0

You can use nfs also or simply mount your sata disk with your music files in one directory.

Install:

apt-get install mpd alsa-utils

Check you device (this is the output with GFX version – hdmi is creating 2 cards).

# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sun4icodec [sun4i-CODEC], device 0: M1 PCM [sun4i PCM]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: sun4isndhdmi [sun4i-sndhdmi], device 0: SUN4I-HDMIAUDIO sndhdmi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: MYDAC [MICROMEGA MYDAC], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

MPD.CONF:

## Things on the nas
# keep my DB on the nas to index it with a mpd running on my nas, i have 2To
music_directory "/nas/mp3"
playlist_directory "/nas/mpd/playlists"
db_file "/nas/mpd/tag_cache"
log_file "/nas/mpd/mpd.log"
pid_file "/var/run/mpd/pid"
state_file "/var/lib/mpd/state"
sticker_file "/nas/mpd/sticker.sql"
user "root"
group "root"
bind_to_address "any"
save_absolute_paths_in_playlists "yes"
metadata_to_use "artist,album,title,track,name,genre,date,disc"
follow_inside_symlinks "yes"
zeroconf_enabled "no"
zeroconf_name "Music"
input {
plugin "curl"
}
audio_output {
type "alsa"
# Tune the device here. My dac is card 2. Will be '0' with headless.
device "hw:2,0"
name "MYDAC"
# For hardware mixer:
mixer_control "MICROMEGA Clock Selector"
auto_resample "no"
auto_channels "no"
auto_format "no"
use_mmap "yes"
}
connection_timeout "60"
max_connections "100"
max_playlist_length "16384"
max_command_list_size "2048"
max_output_buffer_size "8192"
filesystem_charset "UTF-8"
id3v1_encoding "UTF-8"

ASOUND.CONF

# /etc/asound.conf
# Put the card name listed with 'aplay -l'
pcm.!default { type hw card MYDAC }
ctl.!default { type hw card MYDAC }

It’s done. Restart alsa-utils and mpd. Refresh your file DB.

# service alsa-utils restart
# service mpd restart
# mpc update

You can now access your mele mpd with any mpd client, your choice. I’m using this:
– MPDRemote from my Nokia N9
– MPDroid from any android
Sonata from any linux
Client175 from any browser

For the Micromega MyDac, i can check the status directly here:

# cat /proc/asound/MYDAC/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S32_LE
subformat: STD
channels: 2
rate: 96000 (96000/1)
period_size: 12000
buffer_size: 48000

Yes!
Bit perfect studio master 96KHz 32bit from Lynn Record with a Mele at 0.3 of load, the Micromega MyDac (up to 192kHz) and an audio grade usb2 cable.

The best sub-$500 sound server package you could ever ear.

My final Setup !

39 thoughts on “Mele + DAC + MPD => the perfect bit-perfect setup

    • I didn’t try this one.
      I see gfx from NwAvGuy about the UCA222, i tried (and still have) an ODAC. Quite ok too.
      But for the tiny price difference with the mydac, and if you’re planning to use it in a fixed/home setup (like with a mele), just don’t blow $100 on it. Buy directly the Mydac. It’s night and day.

      • I like the Burr Browns sound and an UCA DAC is ~ $25,-, so if one doesnt have an audiophile amp its imho a good choice at a reasonable price.

        Of cause, if you want to play 192kHz audio the cirrus logic cs4351 dac is great.

    • It’s managed with the updated kernel 😉
      I will check at your wemac problem.
      Is it GFX or headless version you tried?

  • Hello, I’m new to this site. And I’m very interested.
    But I can’t figure out which hardware you exactly use make this bitperfect player. A2000? There are alot of Mele players on the market

  • Hi guillaume! Saw your comment on RaspyFi! I thought you told me the mycromega was working with RaspyFi! This could be due to a kernel upgrade, and missing modules… Which kernel are you using with the mele?

    Michelangelo

    • The Pi should work with the MyDac… at least at 44.1/16 rate with its buggy usb.
      With the mele, i’m only using the vanilla snd_usb_audio and working great at 192/32.

  • Hi Guillaume. I have a DAC with an optical input, so I want to use the SPDIF output on my Mele A2000. Can you tell me how to set this up in the mpd.conf and asound.conf files? Thanks!

  • To add some info to my last comment, I have your Ubuntu image with the latest kernel installed on the nand. Is using the SPDIF even possible with this? I don’t see a red light coming from the optical port and I also don’t see any mention of the SPDIF when I run ‘aplay -l’. Thanks for your help.

  • I’ve managed answer my last two comments with hours of trial and error. Here’s the additional steps I needed to finally get the SPDIF working. Hope it helps if someone else needs it… I take no responsibilty for you screwing anything up. I’m no expert.

    —–

    Edit /etc/modules by adding the following 4 lines at the bottom

    sun4i_spdif
    sun4i_spdma
    sun4i_sndspdif
    sndspdif

    ——

    Create a file at /etc/asound.conf with these two lines

    pcm.!default { type hw card sun4isndspdif }
    ctl.!default { type hw card sun4isndspdif }

    ——

    Fix a segmentatition fault issue with MPD and libmad by upgrading the libmad package to 0.15.1b-7ubuntu2. I downloaded these from the ‘precise’ PPA, which installed fine.

    wget https://launchpad.net/ubuntu/+source/libmad/0.15.1b-7ubuntu2/+build/4058270/+files/libmad0-dev_0.15.1b-7ubuntu2_armhf.deb

    dpkg -i libmad0-dev_0.15.1b-7ubuntu2_armhf.deb

    wget https://launchpad.net/ubuntu/+source/libmad/0.15.1b-7ubuntu2/+build/4058270/+files/libmad0_0.15.1b-7ubuntu2_armhf.deb

    dpkg -i libmad0_0.15.1b-7ubuntu2_armhf.deb

    * If you don’t have wget, install it with

    apt-get install wget

    ——

    Create a standard user account to run MPD under if you don’t already have one

    useradd mele

    Add this user to the ‘audio’ group

    usermod –groups –append audio mele

    Fix some permissions to let MPD access the soundcard without having to run it as root

    setfacl -m u:mele:rw /dev/snd/*

    chmod 770 /dev/snd -R && chgrp audio /dev/snd -R

    ——

    To let MPD run as the user ‘mele’, I set up the mpd.conf to store its data in that users home folder. Create these folders:

    mkdir /home/mele/mpd

    mkdir /home/mele/mpd/playlists

    Make sure they are owned by ‘mele’ and have the correct permissions

    chmod 755 /home/mele/mpd

    chmod 755 /home/mele/mpd/playlists

    chown mele:mele /home/mele/mpd

    chown mele:mele /home/mele/mpd/playlists

    ——

    Here are the settings that worked for me in /etc/mpd.conf

    music_directory “/nas/music”
    playlist_directory “/home/mele/mpd/playlists”
    db_file “/home/mele/mpd/tag_cache”
    log_file “/home/mele/mpd/mpd.log”
    pid_file “/home/mele/mpd/pid”
    state_file “/home/mele/mpd/state”
    sticker_file “/home/mele/mpd/sticker.sql”

    user “mele”
    group “audio”

    bind_to_address “any”

    audio_output {
    type “alsa”
    name “sun4isndspdif”
    device “hw:2,0”
    mixer_device “none”
    auto_resample “no”
    auto_channels “no”
    auto_format “no”
    use_mmap “yes”
    }

    ——

    That’s it! Thanks to Guillaume for the original info.

    • Unfortunately the SPDIF output seems to be limited to 16bit by the current linux-sunxi drivers. Not sure if this can or will change.

      • Hi!

        Thanks your research.
        I didn’t try to interface via spdif because the usb2 is just working flawlessly with the micromega mydac.
        I have check the code and the sun4i_sndspdif.c seems to have the code up to 32bits/192k.
        Which DAC are you using and does your test file is properly encoded?

        I will check on mine. I have just a low quality spdif cable… seems important to have a good one at this speed but it’s worth a try.

        Bye.

    • I have an issue with the volume control on the spdif toslink.
      This is an A10 media pc, not mele using debian
      Linux mpg 3.0.36+ #34 PREEMPT Sat Jul 21 11:34:33 IST 2012 armv7l GNU/Linux

      My second alsa card
      card 2: sun4isndspdif [sun4i-sndspdif], device 0: SUN4I-SPDIF sndspdif-0 []
      Subdevices: 1/1
      Subdevice #0: subdevice #0
      is connected to my amplifier via a fibre.

      The box is running mpd and working.
      However I can’t control output volume. alsamixer says there is no volume controll on that card.
      Does anybody has any clue about this?
      I think this wouldn’t be an issue if I would better understand alsa, but at this point I have ran out of options.
      Thanks
      Sebastian

      PS: you can check the device here:
      https://plus.google.com/photos/102461336643954769234/albums/5342575789424226145/5779294389999851122?banner=pwa

      • I have checked kernels 3.0.42 and 3.0.57
        I am not sure about 3.0.42 since didn’t manually load usb_storage
        but 3.0.57 doesn’t seem to have device_mapper compiled.
        Too late, will check tomorrow.
        THanks!

        • # amixer scontrols

          If you have nothing, you will have to use a software volume control.
          asound.conf:

          mixer_type “software”

          • Indeed amixer scontrols shows no device on spdif output.
            Putting mixer_type on the mpd.conf solved the issue.
            Thanks a lot.

    • Hi,
      I’ve done some test.
      16bit is running well and up to 192.

      For the others, if they want to active spdif:

      modprobe sun4i-spdif
      modprobe sun4i-spdma
      modprobe sun4i-sndspdif
      modprobe sndspdif

      or add these modules in /etc/modules.

      I have active more supported formats in the driver but i got only scratches at 24bit (which seems to be the max the mele spdif can support – sun4i_spdif.h – SUN4I_SPDIF_TXCFG_FMT24BIT).

      # cat /proc/asound/sun4isndspdif/pcm0p/sub0/hw_params
      access: RW_INTERLEAVED
      format: S24_LE
      subformat: STD
      channels: 2
      rate: 96000 (96000/1)
      period_size: 4096
      buffer_size: 16384

      I don’t have the spif registers and could only guess… but not enough time.

      If you can’t switch to an usb dac, i could only recommend to switch to alsa dmix and force dmix.format S16_LE.

      Sorry.

  • Excellent Post! Made me decide buying Micromega Mydac and Cubieboard.

    I’ve now made my own installation on your own image: http://guillaumeplayground.net/mele-a2000-ubuntu-12-10-armhf-nand-xbmc/

    Two things are giving me trouble:
    1. MyDac is mute by default in alsamixer. Found solution here : http://voyage-linux.34677.n3.nabble.com/ALIX-Voyage-MPD-and-new-MyDAC-td4025502.html
    2. Everything find per .flac files but .mp3 does crash mpd, without generating any errors in mpd.log. And whatever audio output i use un mpd (default o MyDac)

    Any idea on why mp3 files makes MPD crash ? Thanks.

    • Bonjour Francois,

      Heureux de participer surtout avec le MyDac qui est simplement excellent avec des bons cables de modulation.
      Je continue en anglais.

      I had the same problem before recompiling mpd and analysing the problem.
      Try these lines in your mpd.conf:

      decoder {
      plugin "mad"
      enabled "no"
      }
      decoder {
      plugin "mpg123"
      enabled "no"
      }

      It will switch the mp3 decoding to ffmpeg which is good.

  • Merci mille fois, Guillaume !

    It did the trick.

    PS: un conseil pour des cables de modulation corrects qui ne me coûtent pas plus que mon Cubieboard?

    • Je n’étais pas spécialement croyant avant.

      J’ai ces excellents cables:
      http://www.audiophonics.fr/sommercable-onyx-2025-cable-modulation-rca-p-2373.html
      et une paire de Choseal CRA-2020 (plus cher ceux-là).

      puis j’ai acheté en plus dans un moment d’égarement ceux-ci (qui devaient être excellent également) et qui étaient plus court:
      http://www.audiophonics.fr/dynavox-cable-modulation-hifi-rca-060m-p-4054.html

      Je suis passé sur les dynavox pendant une semaine et je n’y pensais plus… puis j’ai cherché pendant 3 jours pourquoi j’avais perdu en aigus et pourquoi mes basses étaient moins précises.
      Par désespoir, j’ai remis les sommercable et mon système est revenu à la normale.
      Je n’ai aucune différence entre les Choseal et les sommercable… mais un abime avec les dynavox.

      Grãce à la médiocrité des dynavox, je crois désormais dans la théorie des cables 😉

  • Guillaume,
    Maybe you can help me. I finally got hold of a Mele installed your ubuntu on it. Everything works. apart from the most important task. Driving my DAC. It’s based on a Hiface1. And got it working on a laptop using voyage mpd.

    everywhere on the internet they say this procedure should work:
    apt-get install kernel-headers-$(uname -r)
    apt-get install build-essential
    apt-get install git
    git clone git://github.com/panicking/snd-usb-asyncaudio.git
    cd snd-usb-asyncaudio
    make

    But the first fails and the last
    first command result:
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package kernel-headers-3.0.42
    E: Couldn’t find any package by regex ‘kernel-headers-3.0.42’
    Make command result:
    make -C /lib/modules/3.0.42/build SUBDIRS=/root/snd-usb-asyncaudio modules
    make: *** /lib/modules/3.0.42/build: No such file or directory. Stop.
    make: *** [default] Error 2

    I’ve updated the kernels FYI.

    Thanks

  • Salut Guillaume et merci bcp pour partager.

    I’ll continue in english, although I can speak french but writing is alwasy too difficult for me 🙂

    Currently I use foobar + jplay and previously mpdpup on intel atom, but I want to have a smaller & simpler solution. So, I’m interested to follow the same path but using Cubieboard A20.

    Before start doing anything, I would like to know if you have compare the sound quality of your solution with other type of player (cd player, network player, computer with foobar/jriver/etc) ?

    D’avance merci,
    rachmanto – indonesia

    • Hi rachmanto,

      Here is my final setup with a linear power supply:
      http://guillaumeplayground.net/audiophile-a10-bit-perfect-player/

      The sound is better than a desktop with any switching power supply (and i have a good and pricey one) and the same as a laptop on battery.
      If you have no problem with linux and mpd, i can only say: go for it 😉

      The biggest sound difference is the DAC you’re using.

      Against a CD player, it’s only depends on the N/A stage of your cd player against the DAC.
      I have done some tests with another owner of a Teac UD-501:
      – CDPlayer (cairn fog3): 6/10
      – CDPlayer -> coax -> UD-501: 8/10
      – Laptop Linux MPD/FLAC -> usb -> UD-501: 9/10
      – Laptop W$ Foobar/FLAC -> usb -> UD-501: 9/10

      MPD well configured is bit perfect. You can not go wrong with that.

      About the A20 (same clock as the A10), it has far enough speed to make the usb2 output scream. Nothing comparable with the guys trying to make the Rasp PI work flawlessly.

      PS: Je me suis arrêté à singapore, en indonésie puis à bali il y a deux ans. Magnifique. Quelques frayeurs en scooter mais les paysages, les sites et les gens sont géniaux. Continuez 😉

  • Salut Guillaume,

    I’ll go for it. A20 is on order to replace my existing foobar + jplay setup on intel D2800MT. I will use it with Amanero USB + ESS9018 DIY DAC + Hypex UCD180. I have high hope for it.

    I’ll let you know once it’s done.

    Hehe, Je travaille chez Total a Pau (64) pendant entre 2004 a 2007. Les montagnes + les plages sont magnifique. C’etait tres bonne experience.

  • Hi Guillaume, I am an absolute beginner when it comes to non Windows os’s and am having trouble getting my Cubieboard to work with the above instructions. I am using your Debian Wheezy and updated Kernel. I am using a usb hard drive for music storage rather than a NAS.
    Using fdisk -l my hard disk is shown as /dev/sda1. I have tried to rewrite your mpd.conf to use my hd but it is not working.
    Would you mind giving me a mpd.conf for a usb hd as above.
    Thanks in advance,
    Gordon

  • Gordon,
    You need to mount your usb device first, and then give that path to mdp.conf
    for instance, on my device my music_directory is:
    root@mpg:~# grep music_directory /etc/mpd.conf
    music_directory “/mnt/sda2/media/musica”

    /mnt/sda2 is a mount point for the partition where I hold the music:
    root@mpg:~# df -h /mnt/sda2/media/musica
    Filesystem Size Used Avail Use% Mounted on
    /dev/sda2 925G 869G 9.2G 99% /mnt/sda2

    to automatically mount it at boot time, I have and entry on my fstab.conf
    that looks as:
    root@mpg:~# grep sda2 /etc/fstab
    /dev/sda2 /mnt/sda2 auto ro 0 0

    send me an email to basurerosebita at gmail.com if you need further instructions. You seem to be having issues with the mount concept, not mpd.
    Regards,
    Sebastian

Leave a Reply to guillaume Cancel reply

Your email address will not be published. Required fields are marked *