Linux Audio the way to go!?

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Member
Joined 2004
Paid Member
24 bit MPD

Here is the version info

pds@MusicServer:~$ mpd --version
mpd (MPD: Music Player Daemon) 0.14.2

Copyright (C) 2003-2007 Warren Dukes <warren.dukes@gmail.com>
Copyright (C) 2008 Max Kellermann <max@duempel.org>
This is free software; see the source for copying conditions. There is NO
warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Supported formats:

mp3 mp2 ogg oga ogg oga flac wav au aiff aif aac m4a mp4 wma asf wmv mpeg mpg avi vob mov qt swf rm swf mp1 mp2 mp3 mp4 m4a flac ogg wav au aiff aif ac3 aac mpc ape tta

Supported outputs:

null fifo alsa oss pulse







Here is my asound.conf
Code:
asym_spdif {
         type asym
         playback.pcm "plughw:0,1"
         capture.pcm "plughw:0" } 
pcm.!default asym_spdif

And the relevant section of mpd.conf

Code:
audio_output {
         type                    "alsa"
         name                    "Juli@"
         device                  "plughw:0,1"
# optional         auto_
resample           "no"   # this is ALSA telling not to touch the stream }

How do I enable debug? I'll be happy to post any info.
 
Hi there.

Debugging is IMO not appropriate at this stage. I just updated my source tree with git pull. Everything seems to be fine.

1. Checkout the "Makefile" in the source-dir. "grep 0.15 Makefile" If you see 0.15~git the checkout went OK. If this says 0.14-something, something went wrong with the git checkout. You might want to try first " git pull" for an
update and then "git checkout master" to switch to the master branch.
"git tag" will show you the official releases which you can also checkout.
0.15~git it is not in there - it is "master"!

Don't forget the "make clean" before you start the build process. ;)

2. Did you check, if you have more then one mpd binary in the system?
If you don't set the --prefix=/usr properly on autogen.sh , you might end up with a new binary
in /usr/local/bin and the original in /usr/bin . This way you'd always start the old binary in
/usr/bin .
Try also "sudo find / -name "mpd" -print" to find multiple mpd binaries - delete them afterwards.

Cheers
 
Member
Joined 2004
Paid Member
I tried it again and was very careful about the steps. I still have the old one starting. The new binary is in usr/bin, the old one in usr/local/bin. Could that be the problem? Should I copy the new one to usr/local/bin? I want to be careful I don't trash the system accidentally.
 
1audio said:
I took a chance and copied the new version to usr/local/bin and its working. However I'm still getting 16 bit playback. Any suggestions? Could something be enabled in the setup that is causing this? Some library that can't process 24 bit audio correctly?

OK. One step further! ;)

I guess that on "mpd --version" you'll see a "0.15~git " somewhere ?!?! ;)
I also guess that you ran a "mpd --kill" to kill the old deamon.

Let's checkout further potential configuration problems.

Your config for the 24/96 output looks similar to below I guess:

audio_output {
type "alsa"
name "M-Audio-Transit-hw 96/24"
device "hw:1,0" # optional
format "96000:24:2" # optional
auto_resample "no"
}


And finally your 24bit output should also be activated!!!
(You can do it with mpc or e.g. Minion: To install mpc: "sudo apt-get install mpc")

Type "mpc outputs"

Now you should see all outputs as configured in /etc/mpd.conf
with a leading index number ( called x and y below)

with

mpc disable <x> or
mpc enable <y>

You can control (enable/disable) the outputs

You need to activate the 24bit output and you need to disable the 16bit output in case both entries still exist in mpd.conf

Let us know if this solved your problem.

Cheers
 
Member
Joined 2004
Paid Member
I discovered the following this morning-
wave files at higher than 48 seem to be truncated. Wave files at 48 or 44 do not. BUT FLAC files are all treated properly even at 176.4 KHz I get the full 24 bits. I will do some more research later as well as forward the other details. I did build from GIT successfully.

I'm trying to make sure the file is sent out at its native rate and let the DAC (a BADA in this case) handle sample rate and level conversions.

Using brutefir etc. is for later with a different implementation.

#
audio_output {
type "alsa"
name "Juli@"
device "plughw:0,1" # optional
auto_resample "no" # this is ALSA telling not to touch the stream
}
#





pds@MusicServer:~$ mpd --version
mpd (MPD: Music Player Daemon) 0.15~git

Copyright (C) 2003-2007 Warren Dukes
<warren.dukes@gmail.com>
Copyright (C) 2008 Max Kellermann <max@duempel.org>
This is free software; see the source for copying conditions. There is NO
warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Supported formats:

mp3 mp2 ogg oga ogg oga flac wav au aiff aif aac m4a mp4 wv 16sv 3g2 3gp 4xm 8svx aa3 aac ac3 afc aif aifc aiff al alaw amr anim apc ape asf atrac au aud avi avm2 avs bap bfi c93 cak cin cmv cpk daud dct divx dts dv dvd dxa eac3 film flac flc fli fll flx flv g726 gsm gxf iss m1v m2v m2t m2ts m4a m4v mad mj2 mjpeg mjpg mka mkv mlp mm mmf mov mp+ mp1 mp2 mp3 mp4 mpc mpeg mpg mpga mpp mpu mve mvi mxf nc nsv nut nuv oga ogm ogv ogx oma ogg omg psp pva qcp qt r3d ra ram rl2 rm rmvb roq rpl rvc shn smk snd sol son spx str swf tgi tgq tgv thp ts tsp tta xa xvid uv uv2 vb vid vob voc vp6 vmd wav wma wmv wsaud wsvga wv wve

Supported decoders:

mad vorbis oggflac flac audiofile faad mp4 wavpack ffmpeg

Supported outputs:

null fifo alsa oss
pds@MusicServer:~$
 
Member
Joined 2004
Paid Member
Further checking suggests something isn't working right between the wav library and MPD. WAV files in 24 bits all get truncated to 16 bits it seems. However FLAC files are played correctly. I will try to make a short AIFF file and see if that works right. My guess from what I'm seeing is some internal problem or a problem with the library that has the wave routines, which looks to be libao. Interesting that it isn't recommended under dependencies with ALSA but nothing else is listed for wave support.

I'll make note of these results on the MPD forum.
 
1audio said:
Further checking suggests something isn't working right between the wav library and MPD. WAV files in 24 bits all get truncated to 16 bits it seems. However FLAC files are played correctly. I will try to make a short AIFF file and see if that works right. My guess from what I'm seeing is some internal problem or a problem with the library that has the wave routines, which looks to be libao. Interesting that it isn't recommended under dependencies with ALSA but nothing else is listed for wave support.

I'll make note of these results on the MPD forum.

Interesting. I'd expect that flacs are converted to wav on-the-fly.

You might want to try to force mpd to go for a certain format:
e.g.
format "96000:24:2" # optional

You can also try - what I'd recommend anyhow - to route the traffic to hw:0,1 instead of plughw:0,1

If you run Ubuntu, try my ALSA Upgrade script (see signature) to install ALSA 1.0.19.
It's always a good idea to have ALSA up2date.

Cheers
 
Member
Joined 2004
Paid Member
I'm already running lsa 1.0.19, thanks to your script.

I'll try the hw:0,1 but from aplay with wave it didn't work before the alsa upgrade. Pavel, who wrote the driver for the card said it might not for some reason but plughw would.

I'll see what happens when I force the sample rate but the goal is to keep the processing minimal in the pc and the output at native rate, which is working well.
 
Hi folks.

I think quite some people will like these news!!

MPD is able to pipe raw data into Pipe! This feature is not (yet?) documented.

Install latest git ( see my MPD-Wiki) with options:

Code:
./autogen.sh --prefix=/usr --enable-ao --enable-mms --enable-pipe-output


Then you need to configure the pipe output in /etc/mpd.conf

Configuration looks like that:


Code:
audio_output {        
      type    		"pipe"        
      name               "Pipe"        
      command      "ecasound -q -f:16,2,44100 -b 256 -i:stdin -o:alsahw,1 2>/dev/null" 
}

Turn on this output and the other you turn off. Enjoy!!!

You can use any application such as brutefir ( I havn't tested it yet) of course. Just
change the "command" section accordingly.


What I didn't get to work until now is something like this:


Code:
sox -t raw -b16 -c2 -r44100 - -b16 -c2 -t raw - rate -s -v 96000  | ecasound -q -f:16,2,96000 -i:stdin -o:alsahw,1 2>/dev/null
(phofman: any ideas?)


We are almost there! Have fun . ;)

Cheers
 
Hi soundcheck,

did you try to run the command separately? You can always wrap it into a script should MPD dislike pipe characters. The source code looks OK though, you can check the final command to be run by putting

printf("DEBUG - command: %s\n", pd->cmd);

on line 70 of pipe_output_plugin.c

There is no need to be afraid of this simple debugging, you are compiling from your source tree anyway.

They could add the sample rate, format, ... keys support, it is useful. Most of the code could be taken from http://git.alsa-project.org/?p=alsa-lib.git;a=blob_plain;f=src/pcm/pcm_file.c;hb=HEAD

BTW, when installing from sources without proper packages, you might want to look at e.g. stow http://www.ibm.com/developerworks/library/l-stow/index.html . It is trivial to use and very useful for keeping the system clean.

The device plughw is nothing to be afraid of, it just gives more freedom to the calling application, especially for cards supporting a wide range of sample rates. I do not want to always keep in mind all output to plain hw:X must be converted to 32bit first, such as in Demian's ice1724 Juli.
 
It's me again!

I just tested brutefir!

Guess what? It works. :D It's actually pretty easy (now) to setup.

Do following:

Change

/etc/mpd.conf the PIPE device

Code:
command                 "brutefir -nodefault /your/directory/to/brutefirconf 2>/dev/null"

Change your brutefir input config section in your "brutefirconf"


Code:
     device: "file" {path: "/dev/stdin";  };

That's it. Restart MPD and you gotta great (network) player and brutefir frontend.
If you use my MPD RAMDIR tweak , you can even push the setup to its limits.

Note: You'll experience a slight latency when playing with the MPD controls. That's normal,
since you run two separate applications now. Perhaps we need to play with the MPD output buffer.

Enjoy.

Cheers
 
And are you sure MPD outputs the raw format? If it is wav, then the first configuration will work (ecasound accepts wav), while in the second case sox would output raw, potentially confusing ecasound. Since its error output is being dropped to /dev/null, you would not get any error message. Just my 2 cents.
 
Yep - no wav. I just fixed it.

Sox needs the encoding ( here signed-integer) defined, see below "-e si".

The working pipe-command line in mpd.conf looks like:

Code:
sox -t raw -e si -b16 -c2 -r44100 - -b16 -c2 -t raw - rate -s -v 96000  | ecasound -q -f:16,2,96000 -b 256 -i:stdin -o:alsahw,1 2>/dev/null

All this looks like a great playground to me! Endless options using great software with a nice (html) frontend. :D


Cheers
 
checkinstall!

phofman said:

BTW, when installing from sources without proper packages, you might want to look at e.g. stow http://www.ibm.com/developerworks/library/l-stow/index.html . It is trivial to use and very useful for keeping the system clean.


IMHO even better, use CheckInstall. That way you'll be creating custom deb packages that you can manage using your distribution package manager, handling file clashes, etc.

Here is an easy deb how-to: https://help.ubuntu.com/community/CheckInstall
 
Re: checkinstall!

UnixMan said:


IMHO even better, use CheckInstall. That way you'll be creating custom deb packages that you can manage using your distribution package manager, handling file clashes, etc.

Here is an easy deb how-to: https://help.ubuntu.com/community/CheckInstall

It's a good point. I have a similar discussion ongoing over at Ubuntuforums, to build-in something like checkinstall into the alsa-upgrade script.

Cheers
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.