### Audio woes ### Problem: pianod won't play audio when started via init.d or systemd at boot-time. * Does pianod play okay when started manually? If not, troubleshoot that first. Use the TEST AUDIO OUTPUT command to generate test tones. * Does pianod play okay when started as root with the same options? I.e., su - root -c "/usr/local/bin/pianod", adding options to match how pianod is being started from init.d/systemd. If not, troubleshoot this. Try adding "-n root" to the pianod command; if that works, there's an audio permissions problem. Use "-n {user}" to match pianod to the user that owns the audio device, or chmod the device to enable access. You can launch pianod at boot using -n root, but that increases risks should pianod be compromised/exploited. * If you issue a shutdown and pianod respawns, and plays successfully: Add a delay before starting pianod. ### Connections ### Use this procedure if you've got a fresh pianod install, and are experiencing trouble connecting to it with the web client. #### Step 1: Verify pianod is up #### First, verify pianod is working as expected. You can use telnet or nc to connect:

$ '''telnet house 4445'''
Trying 10.69.69.1...
Connected to house.localnet.
Escape character is '^]'.
200 Connected
100 pianod 149. Welcome!
141 Volume: 0
109 SelectedStation: auto QuickMix
103 Stopped
The parameters are the hostname (or IP) and port where pianod is running. * If you get the above output, move to step 2. * If you get connection refused here, then either pianod isn't running or you've got the wrong host/port names. * If the hostname is wrong, you'll an error like: nodename nor servname provided, or not known #### Step 2: Verify the admin user #### Once you're able to connect, you should be able to authenticate as the admin user. In the '''telnet''' or '''nc''' session:
'''user admin admin'''
132 admin signed in
200 Success
136 Privileges: admin owner service influence tuner present
* If you get the above output, enter '''quit''' and move to step 3. * If you get 406 Invalid login or password, the admin user doesn't exist. Since you're just setting up, you could remove the user database, which will be recreated with just the admin user: ``` $ '''rm ~/.config/pianod/passwd''' (BSD) $ '''killall -9 pianod''' or (Linux) $ '''pkill -9 pianod''' The killall or pkill commands restart pianod after removing the file, assuming init/systemd/launchd is set up to restart it when it exits. If you manually started pianod, you'll need to repeat that step. After restarting pianod repeat this procedure from step 1. #### Step 3: Verify the web server is up #### If you are hosting client files yourself, use a web server to verify pianod is serving its HTTP port. Browse to your host, such as: http://localhost:4446/pianod If you are not hosting the client, use the hosted one at http://deviousfish.com/pianod/client/ * If you get the client HTML, the web server is working. * Error 401 means the client files aren't readable by pianod. Check the file permissions; remember pianod drops root privileges when run as root. * Error 404 means the files were not found for serving. Check you typed it correct in the request, and that the '''-c''' ''client'' parameter matches the location you've put the files. * Error 415 means the browser you're using does not support RFC-compliant websockets. Upgrade. * Error 503 means you didn't get the location of client files with pianod's '''-c''' ''client'' parameter. * If the connection is refused, pianod isn't listening on that port. If you specified a port with -P, use that port number here; otherwise, something's blocking the port. Check firewall/network security settings. If you get something bizarre, try using '''telnet''' or '''nc''' to the HTTP port: ``` $ '''telnet house 4446''' Trying 10.69.69.1... Connected to house.localnet. Escape character is '^]'. '''HELO pianod''' 200 Connected 100 pianod 149. Welcome! 141 Volume: 0 109 SelectedStation: auto QuickMix 103 Stopped ``` * If something different happens, some other process is using the port. You can change pianod's HTTP port with the -P option. #### Step 4: Testing websockets #### WebSocket.org provides a useful websocket tester at ''http://www.websocket.org/echo.html'''. In ''location'', enter the URL: '''ws://house:4446/pianod''', substituting your pianod hostname/IP and port number. Click "Connect", and the log window should report: ``` CONNECTED RESPONSE: 200 Connected RESPONSE: 100 pianod 149. Welcome! RESPONSE: 141 Volume: 0 RESPONSE: 109 SelectedStation: auto QuickMix RESPONSE: 103 Stopped ``` If you get ERROR: undefined; DISCONNECTED: * Check you entered the URL correctly. * Ensure you are using at least Safari 6, Firefox 17, a non-ancient Chrome or another browser with proper WebSocket support. #### Step 5: Communicate over the websocket #### Continue to use the WebSocket echo tester from the previous test. In ''Message'', enter '''user admin admin''' and click "Send". The log window should report: ``` SENT: user admin admin RESPONSE: 132 admin signed in RESPONSE: 200 Success RESPONSE: 136 Privileges: admin owner service influence tuner present ``` * If this works, then the HTTP port is up and websocket communications are working. If you're still having trouble after all that, or encounter trouble or weirdness along the way, please provide details on the pianod mailing list.