SOLVED - Spdif output

General discussion relating to the O2 Joggler, from the default O2 setup, to alternative operating systems and applications.
papaiannis
Posts: 66
Joined: Tue May 15, 2012 9:53 pm

SOLVED - Spdif output

Post by papaiannis »

A tip for diy'ers who made the spdif output mod.
To enable spdif output it is sufficient to add the following line to /etc/rc.local, just before the line with "exit 0":
amixer -q -c 0 sset 'IEC958',0 unmute

This command instruct the alsa mixer to enable spdif, which is muted by default.
Internal speakers remain active. If you want to disable speaker, be sure that in /etc/asound.conf the device 1 of card 0 is selected by default. Setting should look like this:
pcm.!default {
type hw
card 0
device 1
}

If /etc/asound.conf does not exist, create one.
Restart the joggler...et voila!

My joggler is connected to my HiFi gear and I use it as my main digital source. It works like a charm.

Have fun.
Alekos
Last edited by papaiannis on Mon May 28, 2012 11:21 pm, edited 1 time in total.
User avatar
Positivity
Posts: 35
Joined: Tue May 08, 2012 8:49 pm

Re: SOLVED - Spdif output

Post by Positivity »

Hi - I have been considering this mod as it looks fairly straightforward even for my soldering skills. However I cannot source a SPDIF socket. Can you tell me where you got yours from? Thanks.
papaiannis
Posts: 66
Joined: Tue May 15, 2012 9:53 pm

Re: SOLVED - Spdif output

Post by papaiannis »

As a coaxial output you could simply use a RCA connector (altough one should use the 75 ohm type). This is what I use.
For TOSLINK you could check at farnell, digikey or rs-components.
Good luck!
themystical
Posts: 81
Joined: Mon Sep 17, 2012 2:55 pm

Re: SOLVED - Spdif output

Post by themystical »

papaiannis wrote:A tip for diy'ers who made the spdif output mod.
To enable spdif output it is sufficient to add the following line to /etc/rc.local, just before the line with "exit 0":
amixer -q -c 0 sset 'IEC958',0 unmute
Alekos
Okay, I have spent a nervous couple of hours and fitted the Coax SPDIF socket on my Joggler. Soldering to the audio chip without short circuiting adjacent legs is nerve racking to say the least.
I am currently running Openpeak software with PnP111.
What exactly do I need to type in once I ssh and log in to edit as recommended by Alekos above? Sorry I have no idea about Debian/Linux and the various tutorials on Youtube are just making me more confused.
I tried "Sudo nano /etc/rc.local " bu this did not open the file for editing.
Any help appreciated
Wilberforce
Posts: 134
Joined: Sun Apr 15, 2012 4:52 pm

Re: SOLVED - Spdif output

Post by Wilberforce »

try vi, if nano isn't availabe:

Code: Select all

vi /etc/rc.local 
no sudo on openpeak as you login as root (if memory serves ;D).

ps you may want to look at a vi cheat sheet
themystical
Posts: 81
Joined: Mon Sep 17, 2012 2:55 pm

Re: SOLVED - Spdif output

Post by themystical »

Wilberforce wrote:try vi, if nano isn't availabe:

Code: Select all

vi /etc/rc.local 
no sudo on openpeak as you login as root (if memory serves ;D).
ps you may want to look at a vi cheat sheet
Thanks tried that but it seemed to open up a new file without any existing text? Perhaps the file doesn't exist in the Openpeak software? Is there a command I can use to see the directory structure and whether this file exists?
Sorry for these silly questions but I am not sure where to view a tutorial that will bring me up to speed.
Wilberforce
Posts: 134
Joined: Sun Apr 15, 2012 4:52 pm

Re: SOLVED - Spdif output

Post by Wilberforce »

use

Code: Select all

 cd /etc 

Code: Select all

ls
Wilberforce
Posts: 134
Joined: Sun Apr 15, 2012 4:52 pm

Re: SOLVED - Spdif output

Post by Wilberforce »

check http://www.jogglerwiki.com/wiki/Internal_SPDIF_output . It has instructions for o2 OS at the bottom.

reposting here:

Code: Select all

Note : If you are using O2 stock firmware, you have to edit one more file to unmute digital output at startup.

Edit check_snd() function in /etc/init.d/boot.d/S07boot.loadmodules :

 check_snd()
 {
   local LOG="/openpeak/tango/amixer.out"
   echo $* > ${LOG}
   (amixer -c 0 sget 'IEC958',0 | tail -2) >> ${LOG} 2>&1
   local IS_MUTED=`grep "off" ${LOG} | wc -l`
   if [ ${IS_MUTED} -gt 0 ]; then
     echo "Error: Muted Audio!" >> ${LOG}
     amixer -q -c 0 sset 'IEC958',0 unmute
     if [ $? -ne 0 ]; then
       echo "-- Failed to recover --" >> ${LOG}
     else
       echo "++ Recovered ++" >> ${LOG}
     fi
   fi
 }

Reboot the Joggler and enjoy digital sound ;) 

ctrl+shift+v will come in useful for pasting that in
themystical
Posts: 81
Joined: Mon Sep 17, 2012 2:55 pm

Re: SOLVED - Spdif output

Post by themystical »

Thanks Wilberforce, your short tutorial was very helpful and I now have sound from the SPDIF (but none from the internal speakers). I had to use Vi as Nano does not seem to work with the stock OS and your hint to use a Cheatsheet (which I hadn't heard of before yesterday) helped me to do the mods. I tried 44.1k (CD quality) which works fine. My sole 96k file also played without any mods although I am not sure whether the LMS server on my laptop was resampling this down to 44.1/48k or not as my DAC (which is 192k capable) does not display the incoming frequency. My one 192k audio file did not emit sound although my DAC displayed signal lock throughout.
In terms of sound quality, the Joggler as a transport seemed a bit bass light compared to streaming via the PS3 to the same DAC but also appears to be clearer. Need to do some more critical listening before I can be sure but this may be because the signal transfer from the Joggler is not asynchronous?
Anyway on to the next task which is to put the SqpOS (which should play WMA) on to a stick and dedicate this Joggler to the hifi.
Wilberforce
Posts: 134
Joined: Sun Apr 15, 2012 4:52 pm

Re: SOLVED - Spdif output

Post by Wilberforce »

Myabe you need to use a plug device (in alsa) to get it to resample the 192khz to 96khz (if indeed the server was streaming it without resampling).

Is it possible the PS3 is performing some sort of signal processing before outputing the audio?
User avatar
JimbobVFR400
Posts: 264
Joined: Fri Jul 20, 2012 8:39 pm

Re: SOLVED - Spdif output

Post by JimbobVFR400 »

I believe asynchronous is with USB and not relevant to the optical output?
If you want to use SqPOS, which I highly recommend by the way, did you know you can place your stick internally in place of the wifi adapter? Makes a much cleaner install and leaves the external USB free for other use. I use mine for charging various portable devices including my phone.
Alternatively if you have usb on your dac it leaves a free port for the dac.

SqPOS can run the play wma plugin if you use it to run your LMS on it as well. If you are already running LMS on another machine then simply enable playwma on LMS (unless it's a NAS with insufficient grunt) and they will play on stock OS
themystical
Posts: 81
Joined: Mon Sep 17, 2012 2:55 pm

Re: SOLVED - Spdif output

Post by themystical »

Installed the SqPOS system on to a stick and it booted up great (except there was no sound from the internal speakers - still not solved that yet). I tried out the mods to the /etc/rc.local suggested in the first post but that didn't unmute the SPDIF although it was showing a lock on the DAC all the way through. However, trying the unmuting through the Alsamixer suggested by JimbobVFR400 worked and I had sound from the SPDIF. The volume is also controlled by the volume slider on the Joggler and at full volume the sound distorts. Is the volume digitally controllable from the Joggler for everybody who has made the SPDIF mod?
The other thing that I noticed was this configuration played all my files including the 192k file. I suspect that the Alsa mixer is processing and downsampling all audio to 44.1k as this parameter is stated in the asound.conf file. One reason why this Joggler sounds different from my PS3 might be due to the processing within the Alsamixer; is there any way of configuring the software (particularly the asound.conf file) so that the Joggler SPDIF outputs the PCM unaltered at the native frequency and without any extra processing? The audio chip is obviously capable of outputting up to 96k via the SPDIF so this would be the ideal unadultered source of the SPDIF to the DAC?
User avatar
JimbobVFR400
Posts: 264
Joined: Fri Jul 20, 2012 8:39 pm

Re: SOLVED - Spdif output

Post by JimbobVFR400 »

Yes my onscreen volume works on the digital output too. Although mine doesn't distort on full. Funnily enough a real SBT is the same in that the volume works for the digital output.
I can't fathom why you would be getting distortion, I thought the volume control was digitally reducing the volume, in fact on the Squeezebox forums its recommended to use 100% for sound quality. What kit are you feeding the digital to? Is it a DAC or DAC/preamp or an amp with digital in
themystical
Posts: 81
Joined: Mon Sep 17, 2012 2:55 pm

Re: SOLVED - Spdif output

Post by themystical »

Aahh.... so a Touch has digital volume control as well.... this might be something to do with the Squeezeplayer software then rather than the Joggler? I play the SPDIF into a Buffalo Sabre DAC (Twisted Pear Kit) via a coax in which then feeds valve pre and power amps and there is definitely distortion at full Joggler volume. Any ideas as to how to get the pure unadultarated chip SPDIF output?
Wilberforce
Posts: 134
Joined: Sun Apr 15, 2012 4:52 pm

Re: SOLVED - Spdif output

Post by Wilberforce »

A minimal asound.conf like this:

Code: Select all

pcm.!default {
   type hw
   card 0
   device 1
}
ctl.!default {
   type hw
   card 0
   device 1
}

will avoid any resampling and also bypass the mixer volume adjustment (I think).
User avatar
JimbobVFR400
Posts: 264
Joined: Fri Jul 20, 2012 8:39 pm

Re: SOLVED - Spdif output

Post by JimbobVFR400 »

I've replaced what I had in my asound.conf with your suggestion and it definitely works. I'm thinking it may sound better than what I had before but really not sure. I'm going to try changing back and see if I can tell.
Maybe themysticals system is "more resolving" as Audiophiles are want to say, My own Joggler is connected to a more modest system (Arcam AVR200 used in stereo, Linn Sekrit in Walls and a small Mission active sub connected to the sub out on the Arcam)

The on-screen volume in squeezeplay still works, alsamixer no longer opens though, you get an error "cannot open mixer: Invalid argument" which possibly indicates it is by passing alsamixer?
Wilberforce
Posts: 134
Joined: Sun Apr 15, 2012 4:52 pm

Re: SOLVED - Spdif output

Post by Wilberforce »

I think you should still be able to open alsamixer with:

Code: Select all

alsamixer -c 0
, but adjusting the PCM volume seems to have no effect on the digital out (whereas before it would)
themystical
Posts: 81
Joined: Mon Sep 17, 2012 2:55 pm

Re: SOLVED - Spdif output

Post by themystical »

JimbobVFR400 wrote:I've replaced what I had in my asound.conf with your suggestion and it definitely works. I'm thinking it may sound better than what I had before but really not sure. I'm going to try changing back and see if I can tell.
The on-screen volume in squeezeplay still works, alsamixer no longer opens though, you get an error "cannot open mixer: Invalid argument" which possibly indicates it is by passing alsamixer?
Yep I mirror this....definitely works and sounds better to my ears too and in my system (could be placebo!). However the distortion has definitely gone so a very positive step. Digital volume control works too - ala the original Touch. Haven't tried opening the Alsa mixer - don't need to as this Joggler is exclusively connected to my HiFi via the SPDIF. Also to note that both the 96k and the 192k file played so there must be some downsampling somewhere as the stated chip spec says max 96k only via SPDIF? The normal spec is 96k via optical and 192k via coax and since I am using coax it could actually be the 192k file, can't say because I have no way of knowing what my DAC sees. Is there anybody with one of these new fangled DAC's who can read whether the files reaching it are the same as the original and whether it is bit perfect?
User avatar
JimbobVFR400
Posts: 264
Joined: Fri Jul 20, 2012 8:39 pm

Re: SOLVED - Spdif output

Post by JimbobVFR400 »

Weirdly I've been doing some pratting about.

My previous asound.conf was

Code: Select all

pcm.!default {
        type plug
        slave.pcm "dmixer"
}

pcm.dmixer  {
        type dmix
        ipc_key 1024
        slave {
                pcm "hw:0,1"
                period_time 0
                period_size 1024
                buffer_size 4096
                rate 44100
        }
        bindings {
                0 0
                1 1
        }
}

ctl.dmixer {
        type hw
        card 0
        device 1
}
Which I've managed to get working using the Shairport option in SqPOS streaming from itunes and Airfoil on my PC. This is under additional features and uses the joggler as an airport receiver, very handy for playing music in iTunes I don't want to add to my Library or playing the Spotify Free Desktop app via Airfoil through my stereo. Also handy for use when a mate who has an iPhone comes round.
With this configuration only muting the Digital output in alsamixer makes any difference, the master volume makes no difference at all to the digital output.

Using the simplified asound.conf above:

Alsamixer volume also doesn't make any difference, however while I can connect to shairport and it appears to be playing I get no audio at all through the digital output.

I need to do some proper comparison. If I can't tell any difference I may go back to the original config for convenience. Airplay can be handy
Wilberforce
Posts: 134
Joined: Sun Apr 15, 2012 4:52 pm

Re: SOLVED - Spdif output

Post by Wilberforce »

I think LMS downsamples anything above 96khz by default (without patches). I imagine this downsampling is a lot better than the default alsa resampling algorithm (which is more design for speed). It is possible to change to to a better quality (more cpu intensive) setting though.

Maybe you could add an option in interface configuration to switch between the two jimbob? I think you need the plug device to allow sharing of sound card between programs (sqeezeplay and shairport).

Also, I dont think there is anything necessarily wrong with using the plug as it should only resample when required. Whereas, if you address the device directly (hw) with a signal it will not accept, it will refuse to play.

edit: it is the dmix plugin that allows the sharing of the sound card
Post Reply