SACD ISO playback in MPD

Discuss client development (or even MPD development if you feel so inclined), ask questions about the client libs, MPD feature requests from client developers, etc...
manisiutkin
Posts: 21
Joined: September 28th, 2014, 5:43 pm

SACD ISO playback in MPD

Post by manisiutkin » September 28th, 2014, 5:52 pm

Just in case someone is interested in this feature: http://git.musicpd.org/cgit/manisiutkin/mpd.git

afalout
Posts: 13
Joined: September 21st, 2014, 7:46 am

Re: SACD ISO playback in MPD

Post by afalout » September 29th, 2014, 1:55 am

manisiutkin wrote:Just in case someone is interested in this feature: http://git.musicpd.org/cgit/manisiutkin/mpd.git
Yes someone is :) THANK YOU Maxim for your work!

After sorting out the DSD related config in MPD, it works great for the best part.

BTW, I did not find any instructions/HOWTO for setting up DSD playback in MPD, and I think a lot of folks will be shooting themselves in the foot with settings like samplerate_converter, mixer_type, and Alsa device definitions (plughw anyone?). Where would be a good place for me to write something? Wiki on Wikia.com has the message "This wiki is obsolete" on the home page, so I guess that's not a good place?

Thanks,
Andrej

manisiutkin
Posts: 21
Joined: September 28th, 2014, 5:43 pm

Re: SACD ISO playback in MPD

Post by manisiutkin » September 29th, 2014, 7:41 pm

You can set up options in mpd.conf:

decoder {
plugin "sacdiso"
dstdec_threads "8"
edited_master "true"
lsbitfirst "false"
}

... and I'm going to add "playable_area" as well.

I'd like to have stereo and multichannel areas as subdirectories:

Some_folder
\
Album_name
\
Stereo_area
\
Track 01
Track 02
...
Multichannel_area
\
Track 01
Track 02
...

...but it's not clear how to implement.

As an interim solution I added 2CH,MCH to the end of ALBUM tag.

afalout
Posts: 13
Joined: September 21st, 2014, 7:46 am

Re: SACD ISO playback in MPD

Post by afalout » October 2nd, 2014, 7:06 am

manisiutkin wrote:You can set up options in mpd.conf:

decoder {
plugin "sacdiso"
dstdec_threads "8"
edited_master "true"
lsbitfirst "false"
}
Can you please explain this settings a bit?
manisiutkin wrote:As an interim solution I added 2CH,MCH to the end of ALBUM tag.
Thanks, that should be OK for most people, although I would expect that folks with stereo-only DACs probably do not want to see MCH variant at all (so playable_area would be a good idea anyway) Note that with subdir approach, even if you dont want to see MCH at all, you will still get a (sub)directory... so I actually prefer your "interim" sollution :)

What about Foobar "Store Tags with ISO" option, would it be possible to have that?

Also, how hard would it be to add the DVD-A functionality, from your Foobar DVD-a?

Now that we can play DSD both from files and ISOs, my next Christmass wish (appart from the DVD-A ISO playback :) is to be able to use my Onkyo receiver as a multi-channel DSD DAC, over HDMI. I know that no current video drivers on any OS, and for any chipset (Intel, nVidia, AMD) support this. Which once made sense, because there was no DSD music to be played on PCs. But now there is, and there is even increasing nuber of commertial DSD downloads available for purchase. And a LOT of people allready have DSD capable receivers!

So I wonder if anyone reading this has a suggestion how to acomplish this. I susspect that I would have much better chance with opensource drivers/developers, then asking nVidia/Intel/AMD? Did anyone look at this probelm allready? From what I see in specs, this is no different from HDMI audio driver perspective, then is to set a bitstream flag for AC3/DTS encoded passtrough...?

Thank you for your work on SACD ISO plugin!

manisiutkin
Posts: 21
Joined: September 28th, 2014, 5:43 pm

Re: SACD ISO playback in MPD

Post by manisiutkin » October 3rd, 2014, 4:26 pm

dstdec_threads - It's about how many parallel threads to use for DST->DSD decompression. By default it's 8 and should be not less than number of processor cores.

edited_master - some SACDs have "content" between the end of previous track and the beginning of the next track. When edited_master is true plugin plays this "content". Could be applause on live recording, for example.

lsbitfirst - I did it like in DSDIFF and DSF plugins :) Should be false because SACDs are MSB first.
afalout wrote:What about Foobar "Store Tags with ISO" option, would it be possible to have that?
Do you mean "Reading tags from XMLs, like in foobar"?
afalout wrote:Also, how hard would it be to add the DVD-A functionality, from your Foobar DVD-a?
Like SACD plugin, it's approximately the same volume of work.

I think, DoP over HDMI is the only reasonable way to get DSD over HDMI into receivers.

afalout
Posts: 13
Joined: September 21st, 2014, 7:46 am

Re: SACD ISO playback in MPD

Post by afalout » October 4th, 2014, 4:57 am

manisiutkin wrote:dstdec_threads - It's about how many parallel threads to use for DST->DSD decompression. By default it's 8 and should be not less than number of processor cores.
So for 2-core Intel Atom CPU with HT enabled, this should be 4, right?
manisiutkin wrote:Do you mean "Reading tags from XMLs, like in foobar"?
Yes, reading only of course, it does not make sense to edit those in MPD, which could be easily done in Foobar - if MPD could read it?
afalout wrote:Also, how hard would it be to add the DVD-A functionality, from your Foobar DVD-a?
manisiutkin wrote:Like SACD plugin, it's approximately the same volume of work.
So, do you take bribes? :) Please please, pretty please? :)
manisiutkin wrote:I think, DoP over HDMI is the only reasonable way to get DSD over HDMI into receivers.
Unfortunately, not a single receiver manufactured in last 13 years, that has DSD DAC, knows anything about DoP protocol. All devices with HDMI input expect raw uncompressed DSD stream (HDMI vesion 1.2 and later) and/or in bitstream DSD format (1.3a and later).

And there is a LOT of DSD capable receivers out there... Just Onkyo makes about 1 million receivers every year. I think conservatively, there would be some 30 million DSD multi-channel DACs/amps with HDMI input on the plannet right now.

Cheers,
Andrej

smoothquark
Posts: 16
Joined: November 2nd, 2014, 6:16 pm

Re: SACD ISO playback in MPD

Post by smoothquark » November 2nd, 2014, 6:27 pm

Hi! Thanks very much for your hard work. This is something I have been waiting for for some time.

However.... I cannot get SACD support to work. My SACD iso files are not recognised by mpd and not entered into the database. Is there a particular structure that I need ? I am currently storing them as below:

/Music/SACD/Artist/Album/

source from git://git.musicpd.org/manisiutkin/mpd.git

./configure:

########### MPD CONFIGURATION ############

Archive support:
(-bzip2) (-ISO9660) (+SACDISO) (-ZIP)
Client support:
(+IPv6) (+TCP) (+UNIX Domain Sockets)
File format support:
(-AAC) (-AdPlug) (-C64 SID) (-FFMPEG) (+FLAC) (-FluidSynth) (-GME)
(+libsndfile) (-MikMod) (-MODPLUG) (-MP4V2) (-MAD) (-MPG123) (-Musepack)
(-Opus) (-OggTremor) (-OggVorbis) (-WAVE) (-WavPack) (-WildMidi)
Other features:
(+libsamplerate) (-libsoxr) (-libmpdclient) (+inotify) (+SQLite)
Metadata support:
(+ID3)
Playback support:
(+ALSA) (+FIFO) (+File Recorder) (+HTTP Daemon) (-JACK)
(-libao) (+OSS) (-OpenAL) (-OS X) (-Pipeline)
(-PulseAudio) (-ROAR) (-SHOUTcast) (-Solaris) (-WinMM)
Streaming encoder support:
(+FLAC) (-LAME) (-Shine) (-Ogg Vorbis) (-Opus) (-TwoLAME) (+WAVE)
Streaming support:
(-CDIO_PARANOIA) (-CURL) (-SMBCLIENT) (-Despotify) (-Soundcloud)
(-MMS)
Event loop:
epoll

mpd --version

Database plugins:
simple

Storage plugins:
local

Decoders plugins:
[oggflac] ogg oga
[flac] flac
[sndfile] wav aiff aif au snd paf iff svx sf voc w64 pvf xi htk caf sd2
[dsdiff] dff
[dsf] dsf
[pcm]

Output plugins:
null fifo alsa oss httpd recorder

Encoder plugins:
null wave flac

Input plugins:
file alsa

Playlist plugins:
extm3u m3u pls cue embcue

Protocols:
file:// alsa://


/etc/mpd.conf:

decoder {
plugin "sacdiso"
dstdec_threads "8"
edited_master "true"
lsbitfirst "false"
}

/var/log/mpd.log:

Nov 02 18:13 : config: option 'dstdec_threads' on line 51 was not recognized
Nov 02 18:13 : config: option 'edited_master' on line 52 was not recognized
Nov 02 18:13 : config: option 'lsbitfirst' on line 53 was not recognized

Strange that mpd --version does not show SACD support and I do not understand why the logs show that the sacd options are not recognised ? Any help is much appreciated.

smoothquark
Posts: 16
Joined: November 2nd, 2014, 6:16 pm

Re: SACD ISO playback in MPD

Post by smoothquark » November 3rd, 2014, 8:44 pm

Looks like I made a school boy error! I did not have --enable-iso9660 in my configure. I thought this would get added on automatically, but does not appear to be the case. By the way, is there a patch against version 0.18.16? If I am not mistaken manisiutkin's fork is based on the 0.19 series - I would like to avoid using icu if possible - my compile with the dependencies is running quite large for some reason I am not clear.

Ran
Posts: 144
Joined: February 25th, 2013, 3:47 am

Re: SACD ISO playback in MPD

Post by Ran » November 3rd, 2014, 9:32 pm

If this ting works, can some one suggests a merge to the 0.19.x branch.

manisiutkin
Posts: 21
Joined: September 28th, 2014, 5:43 pm

Re: SACD ISO playback in MPD

Post by manisiutkin » November 4th, 2014, 10:12 pm

SACD ISO support is not enabled in default configuration. Please, use:
./configure --enable-sacdiso

smoothquark
Posts: 16
Joined: November 2nd, 2014, 6:16 pm

Re: SACD ISO playback in MPD

Post by smoothquark » November 7th, 2014, 5:42 pm

I was already using ./configure --enable-sacdiso. Needed --enable-iso9660 as well (which makes sense I suppose). --disable-icu disable icu and keeps my distribution quite small. A few little annoying things left to sort out but seems to be working fine. Anyway, where can I put up bug reports? I think mantis is only for the main mpd branch and not any of its forks.

manisiutkin
Posts: 21
Joined: September 28th, 2014, 5:43 pm

Re: SACD ISO playback in MPD

Post by manisiutkin » November 7th, 2014, 9:36 pm

smoothquark wrote:Anyway, where can I put up bug reports? I think mantis is only for the main mpd branch and not any of its forks.
I have no decent idea. Here, probably?

smoothquark
Posts: 16
Joined: November 2nd, 2014, 6:16 pm

Re: SACD ISO playback in MPD

Post by smoothquark » November 7th, 2014, 10:00 pm

I have to say.. your work is fantastic!

However, I think I may have found a bug (or could be an error on my part somewhere). I have noticed that some sacd iso files are not parsed correctly:

Looking at 2 Bob Dylan SACD iso's:

Slow Train Coming and Street-Legal

in src/lib/sacdiso/sacd_disc.cpp (void sacd_disc_t::get_info(uint32_t track_index, const struct tag_handler *handler, void *handler_ctx)

sb->master_text.album_title correctly points to the album name in the Street-Legal iso but remains blank in Slow Train Coming.

Slow Train Coming is a 2CH/MCH SACD whilst Street-Legal is 2CH only. I don't think this is the cause of the problem as some of my other 2CH only sacd isos work OK as do some of my other 2CH/MCH isos. Also tried re-compiling with --enable-icu but this does not solve the problem. Any suggestions on how I can debug this?

I have enclosed info from sacd_extract...

Disc Information:

Version: 1.20
Creation date: 2003-06-18
Catalog Number: CH90322
Category: General
Genre: Pop Music
Locale: en
Title: Slow Train Coming
Artist: Bob Dylan

Album Information:

Catalog Number:
Sequence Number: 1
Set Size: 1
Locale: en
Title: Slow Train Coming
Artist: Bob Dylan

Area count: 2
Area Information [0]:

Version: 1.20
Track Count: 9
Speaker config: 2 Channel
Track list [0]:
Title[0]: Gotta Serve Somebody
Performer[0]: Bob Dylan
Title[1]: Precious Angel
Performer[1]: Bob Dylan
Title[2]: I Believe In You
Performer[2]: Bob Dylan
Title[3]: Slow Train
Performer[3]: Bob Dylan
Title[4]: Gonna Change My Way Of Thinking
Performer[4]: Bob Dylan
Title[5]: Do Right To Me Baby (Do Unto Others)
Performer[5]: Bob Dylan
Title[6]: When You Gonna Wake Up
Performer[6]: Bob Dylan
Title[7]: Man Gave Names To All The Animals
Performer[7]: Bob Dylan
Title[8]: When He Returns
Performer[8]: Bob Dylan
ISRC Track [0]:
Country: US, Owner: SM1, Year: 03, Designation: 07270
ISRC Track [1]:
Country: US, Owner: SM1, Year: 03, Designation: 07271
ISRC Track [2]:
Country: US, Owner: SM1, Year: 03, Designation: 07272
ISRC Track [3]:
Country: US, Owner: SM1, Year: 03, Designation: 07273
ISRC Track [4]:
Country: US, Owner: SM1, Year: 03, Designation: 07274
ISRC Track [5]:
Country: US, Owner: SM1, Year: 03, Designation: 07275
ISRC Track [6]:
Country: US, Owner: SM1, Year: 03, Designation: 07276
ISRC Track [7]:
Country: US, Owner: SM1, Year: 03, Designation: 07277
ISRC Track [8]:
Country: US, Owner: SM1, Year: 03, Designation: 07278
Area Information [1]:

Version: 1.20
Track Count: 9
Speaker config: 6 Channel
Track list [1]:
Title[0]: Gotta Serve Somebody
Performer[0]: Bob Dylan
Title[1]: Precious Angel
Performer[1]: Bob Dylan
Title[2]: I Believe In You
Performer[2]: Bob Dylan
Title[3]: Slow Train
Performer[3]: Bob Dylan
Title[4]: Gonna Change My Way Of Thinking
Performer[4]: Bob Dylan
Title[5]: Do Right To Me Baby (Do Unto Others)
Performer[5]: Bob Dylan
Title[6]: When You Gonna Wake Up
Performer[6]: Bob Dylan
Title[7]: Man Gave Names To All The Animals
Performer[7]: Bob Dylan
Title[8]: When He Returns
Performer[8]: Bob Dylan
ISRC Track [0]:
Country: US, Owner: SM1, Year: 03, Designation: 07279
ISRC Track [1]:
Country: US, Owner: SM1, Year: 03, Designation: 07280
ISRC Track [2]:
Country: US, Owner: SM1, Year: 03, Designation: 07281
ISRC Track [3]:
Country: US, Owner: SM1, Year: 03, Designation: 07282
ISRC Track [4]:
Country: US, Owner: SM1, Year: 03, Designation: 07283
ISRC Track [5]:
Country: US, Owner: SM1, Year: 03, Designation: 07284
ISRC Track [6]:
Country: US, Owner: SM1, Year: 03, Designation: 07285
ISRC Track [7]:
Country: US, Owner: SM1, Year: 03, Designation: 07286
ISRC Track [8]:
Country: US, Owner: SM1, Year: 03, Designation: 07287

and

Disc Information:

Version: 1.20
Creation date: 2003-06-18
Catalog Number: CH90338
Category: General
Genre: Pop Music
Locale: en
Title: Street-Legal
Artist: Bob Dylan

Album Information:

Catalog Number:
Sequence Number: 1
Set Size: 1
Locale: en
Title: Street-Legal
Artist: Bob Dylan

Area count: 1
Area Information [0]:

Version: 1.20
Track Count: 9
Speaker config: 2 Channel
Track list [0]:
Title[0]: Changing Of The Guards
Performer[0]: Bob Dylan
Title[1]: New Pony
Performer[1]: Bob Dylan
Title[2]: No Time To Think
Performer[2]: Bob Dylan
Title[3]: Baby, Stop Crying
Performer[3]: Bob Dylan
Title[4]: Is Your Love In Vain?
Performer[4]: Bob Dylan
Title[5]: Señor (Tales Of Yankee Power)
Performer[5]: Bob Dylan
Title[6]: True Love Tends To Forget
Performer[6]: Bob Dylan
Title[7]: We Better Talk This Over
Performer[7]: Bob Dylan
Title[8]: Where Are You Tonight? (Journey Through Dark Heat)
Performer[8]: Bob Dylan
ISRC Track [0]:
Country: US, Owner: SM1, Year: 03, Designation: 07695
ISRC Track [1]:
Country: US, Owner: SM1, Year: 03, Designation: 07696
ISRC Track [2]:
Country: US, Owner: SM1, Year: 03, Designation: 07697
ISRC Track [3]:
Country: US, Owner: SM1, Year: 03, Designation: 07699
ISRC Track [4]:
Country: US, Owner: SM1, Year: 03, Designation: 07700
ISRC Track [5]:
Country: US, Owner: SM1, Year: 03, Designation: 07702
ISRC Track [6]:
Country: US, Owner: SM1, Year: 03, Designation: 07704
ISRC Track [7]:
Country: US, Owner: SM1, Year: 03, Designation: 07705
ISRC Track [8]:
Country: US, Owner: SM1, Year: 03, Designation: 07707

manisiutkin
Posts: 21
Joined: September 28th, 2014, 5:43 pm

Re: SACD ISO playback in MPD

Post by manisiutkin » November 8th, 2014, 5:19 pm

smoothquark wrote: However, I think I may have found a bug (or could be an error on my part somewhere). I have noticed that some sacd iso files are not parsed correctly:

Looking at 2 Bob Dylan SACD iso's:

Slow Train Coming and Street-Legal

in src/lib/sacdiso/sacd_disc.cpp (void sacd_disc_t::get_info(uint32_t track_index, const struct tag_handler *handler, void *handler_ctx)

sb->master_text.album_title correctly points to the album name in the Street-Legal iso but remains blank in Slow Train Coming.
I've tested with this Slow Train Coming ISO and album title has been read correctly. Could you please re-check with the new version (it handles strings differently).

smoothquark
Posts: 16
Joined: November 2nd, 2014, 6:16 pm

Re: SACD ISO playback in MPD

Post by smoothquark » November 8th, 2014, 7:03 pm

Thanks once again.

Updated but now it gets even stranger! Works fine on my debian box but when cross-compiled for viaC3, some tracks are rrecognised and others are not. I get lines like this in mpd.log:

sacdiso: subsong index is out of range

Need to investigate more... must be something within my cross-compiled environment as it is otherwise working OK on the debian box.

manisiutkin
Posts: 21
Joined: September 28th, 2014, 5:43 pm

Re: SACD ISO playback in MPD

Post by manisiutkin » November 8th, 2014, 7:14 pm

smoothquark wrote:Thanks once again.

Updated but now it gets even stranger! Works fine on my debian box but when cross-compiled for viaC3, some tracks are rrecognised and others are not. I get lines like this in mpd.log:

sacdiso: subsong index is out of range

Need to investigate more... must be something within my cross-compiled environment as it is otherwise working OK on the debian box.
Sorry, that must be case sensitivity issue (.iso/.ISO). I've just fixed that.

smoothquark
Posts: 16
Joined: November 2nd, 2014, 6:16 pm

Re: SACD ISO playback in MPD

Post by smoothquark » November 8th, 2014, 8:31 pm

Nope, has not helped. There is something about the amd64 (my debian box) and viaC3 compile that has confused the issue. The logs show this for Bob Dylan's Slow Train Coming....

update: starting
Nov 08 20:22 : sacdiso: subsong index is out of range
Nov 08 20:22 : update: added /2C_AUDIO__TRACK001.iso
Nov 08 20:22 : sacdiso: subsong index is out of range
Nov 08 20:22 : update: added /2C_AUDIO__TRACK002.iso
Nov 08 20:22 : sacdiso: subsong index is out of range
Nov 08 20:22 : update: added /2C_AUDIO__TRACK003.iso
Nov 08 20:22 : sacdiso: subsong index is out of range
Nov 08 20:22 : update: added /2C_AUDIO__TRACK004.iso
Nov 08 20:22 : sacdiso: subsong index is out of range
Nov 08 20:22 : update: added /2C_AUDIO__TRACK005.iso
Nov 08 20:22 : sacdiso: subsong index is out of range
Nov 08 20:22 : update: added /2C_AUDIO__TRACK006.iso
Nov 08 20:22 : sacdiso: subsong index is out of range
Nov 08 20:22 : update: added /2C_AUDIO__TRACK007.iso
Nov 08 20:22 : sacdiso: subsong index is out of range
Nov 08 20:22 : update: added /2C_AUDIO__TRACK008.iso
Nov 08 20:22 : sacdiso: subsong index is out of range
Nov 08 20:22 : update: added /2C_AUDIO__TRACK009.iso
Nov 08 20:22 : update: added /MC_AUDIO__TRACK001.iso
Nov 08 20:22 : update: added /MC_AUDIO__TRACK002.iso
Nov 08 20:22 : update: added /MC_AUDIO__TRACK003.iso
Nov 08 20:22 : update: added /MC_AUDIO__TRACK004.iso
Nov 08 20:22 : update: added /MC_AUDIO__TRACK005.iso
Nov 08 20:22 : update: added /MC_AUDIO__TRACK006.iso
Nov 08 20:22 : update: added /MC_AUDIO__TRACK007.iso
Nov 08 20:22 : update: added /MC_AUDIO__TRACK008.iso
Nov 08 20:22 : update: added /MC_AUDIO__TRACK009.iso

and on gmclient ....

2C AUDIO TRACK001
2C AUDIO TRACK002
2C AUDIO TRACK003
2C AUDIO TRACK004
2C AUDIO TRACK005
2C AUDIO TRACK006
2C AUDIO TRACK007
2C AUDIO TRACK008
2C AUDIO TRACK009

2C - 09 - When He Returns | Slow Train Coming (2CH-DST) | Bob Dylan
2C - 09 - When He Returns | Slow Train Coming (2CH-DST) | Bob Dylan
2C - 09 - When He Returns | Slow Train Coming (2CH-DST) | Bob Dylan
2C - 09 - When He Returns | Slow Train Coming (2CH-DST) | Bob Dylan
2C - 09 - When He Returns | Slow Train Coming (2CH-DST) | Bob Dylan
2C - 09 - When He Returns | Slow Train Coming (2CH-DST) | Bob Dylan
2C - 09 - When He Returns | Slow Train Coming (2CH-DST) | Bob Dylan
2C - 09 - When He Returns | Slow Train Coming (2CH-DST) | Bob Dylan
2C - 09 - When He Returns | Slow Train Coming (2CH-DST) | Bob Dylan
2C - 09 - When He Returns | Slow Train Coming (2CH-DST) | Bob Dylan

But works fine on my debian box. It is weird that Track 9 is recognised but not the others. I presume something to do with offsets? In build ea809b the tracks names just simply did not come up but were not messed up as above.

smoothquark
Posts: 16
Joined: November 2nd, 2014, 6:16 pm

Re: SACD ISO playback in MPD

Post by smoothquark » November 9th, 2014, 12:47 am

Managed to make some progress...

Looks like the problem is in src/decoder/plugins/SacdIsoDecoderPlugin.cxx line 92:

Changing char suffix[3]; to char suffix[4]; gets it working on my cross-compiled environment and debian box. Not sure why this works though!

There are still a few iso's not recognised, for example, Björk: Vespertine. To be fair, sacd_extract does not provide an album name or track list - don't know why!

manisiutkin
Posts: 21
Joined: September 28th, 2014, 5:43 pm

Re: SACD ISO playback in MPD

Post by manisiutkin » November 9th, 2014, 6:50 am

smoothquark wrote:Managed to make some progress...

Looks like the problem is in src/decoder/plugins/SacdIsoDecoderPlugin.cxx line 92:

Changing char suffix[3]; to char suffix[4]; gets it working on my cross-compiled environment and debian box. Not sure why this works though!

There are still a few iso's not recognised, for example, Björk: Vespertine. To be fair, sacd_extract does not provide an album name or track list - don't know why!
That's my dull mistake. Should be suffix[4] at least, of course.

I remember, foo_input_sacd plugin had problems with Björk's discs too because texts are not in English code page. I'll try to figure out when I find this album.

smoothquark
Posts: 16
Joined: November 2nd, 2014, 6:16 pm

Re: SACD ISO playback in MPD

Post by smoothquark » November 9th, 2014, 8:28 am

Thanks.

Post Reply