Open shamgargreat opened 7 years ago
sham, I did something similar, but w/ raspi default soundcard. On google virtual machine (no soundcard...) i couldn't figure out how to handle audio.
With this change I can play audio from the patiobar page if i wanted instead of just control piano bar from the web interface.
I followed different guides to get darkice/icecast running - and just embedded the stream into the patiobar html page. Maybe I can fork the project to show the change if you want. After getting icecast stream working (see https://w7apk.com/streaming-radio) I added this to patiobar/views/index.html
<div style="margin:0 auto;text-align:center"><div>
<audio controls autoplay>
<source src="http://yourradio.duckdns.org/stream" type:"audio/ogg">
</audio>
</div>
Clearly - update your icecast URL / IP as needed. Also beware icecast runs ~12sec latency, for me, so you click a new station or skip song, and it takes 12s to get through to the speakers.
(i also set the size of the thumbnail smaller to everything fit on my screens better).
<img class="center-block img-rounded img-responsive" id="coverArt" ng-src="{{src}}" alt="{{alt}}" width="300" height="300">
Thanks hatcreek, this would do the trick.
Great! Sending audio to icecast took me days. I could never figure out the right combo of snd-aloop command (device call out, my darkice now sends hw:1,1 and i'm not totally sure why) and the right .asoundrc file.
It only started working after i installed piStreamRadio, and the audio made it to youtube, then suddenly i got icecast working w/ hw:1,1. hw:loopback,1,0 sends to youtube but fails to send to icecast, go figure.
I'm just rambling as a heads up that getting icecast working was "fun"; i can share files from my setup as needed if you want, but my hint was installing piStreamRadio just for the simple fact it helped get my configuration files sorted out. The downside is the audio jack doesn't work anymore by default, because everything is sent to the loopback (there should be other solutions to loop AND have local sound w/ a more complicated .asoundrc file) but i only cared about having remote sound.
Here's my modified pbstart, and my crontab, so that my radio always starts up on pi reboot.
snd-aloop starts here rather than at boot b/c at boot can flip-flop the sound card order, i always want my loop to be 2nd soundcard, not the 1st; i also start darkice inside the pbstart.
crontab
@reboot sleep 15 && /home/pi/bin/pbstart
pbstart mod
#!/bin/bash
sudo modprobe snd-aloop pcm_substreams=1
cd /home/pi/Patiobar
# Kill any old Patiobar processes running
pbstop 1> /dev/null
screen -S pianobar -d -m bash -c 'pianobar'
# The "patiobar" in the end is not needed and is used as an identifier so we can kill it when stopping.
# Otherwise, we might kill other "node index.js" processes.
node index.js patiobar > /dev/null 2>&1 &
darkice -c /etc/darkice.cfg
echo "Go to http://$(hostname):3000/ to launch the Web interface."
and here is the asoundrc that i THINK piStreamRadio created:
pcm.!default { type plug slave.pcm "hw:Loopback,0,0" }
I hope you're less of a rookie than me, and that you get it sorted out. I'm enjoying my ad free radio.
My next challenge is changing the patiobar website to HTTPS so i can add a password, and access it from WAN w/o having too big of a security hole in my LAN.... but that isn't going well yet.
My next challenge is changing the patiobar website to HTTPS so i can add a password, and access it from WAN w/o having too big of a security hole in my LAN.... but that isn't going well yet.
What problems are you having with that?
I tried using letsencrypt/certbot certonly and I got stuck at "server only speaks HTTP not TLS" or something like that, and it fails to continue. I'm also guessing that /home/pi/Patiobar/ is the webroot for patiobar, and not /home/pi/Patiobar/view/?
I think /home/pi/Patiobar/index.js has to be changed / re-written to include HTTPS headers and such to allow HTTPS? And then I'll need to figure out how/where to put SSL or CA certs.
I'm a rookie programmer so things like this don't happen unless i find a blog that spells it out very clearly.
I changed this line in index.js to https and of coarse chrome won't allow opening the page anymore b/c it can't find the certs and issues a security warning w/o option to continue to the site, but i did not try to re-run certbot after making the https change yet b/c i hit the rate limit for the week (didn't know about the --staging command until it was too late).
var server = require('http').createServer(app);
You are crosslinking both articles to eachother - are you suggesting one way is better/proper? or just linking in general?
~Patrick
On Sat, Apr 14, 2018 at 11:26 AM, USAFPride notifications@github.com wrote:
Check this https://github.com/PromyLOPh/pianobar/issues/467 out.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kylejohnson/Patiobar/issues/13#issuecomment-381336840, or mute the thread https://github.com/notifications/unsubscribe-auth/AcTu5y6lUG5C1JsdAdmWv1Ol7Hki-eu1ks5tohUagaJpZM4O59z8 .
Streaming is not a Patiobar issue. I've linked this back to pianobar in general.
Well it COULD be a patiobar feature... there's at least two of us that wanted to play music from the patiobar website - my icecast solution is up and running and I love it. But I hear what you're saying - it's not in the original patiobar scope, and involves both pianobar and patiobar to implement.
~Patrick
On Sat, Apr 14, 2018 at 11:53 AM, USAFPride notifications@github.com wrote:
Streaming is not a Patiobar issue. I've linked this back to pianobar in general.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kylejohnson/Patiobar/issues/13#issuecomment-381338759, or mute the thread https://github.com/notifications/unsubscribe-auth/AcTu54LYdL5ZxJ-L8dSmXsNsSVlbjgdWks5tohtkgaJpZM4O59z8 .
You might want to check out https://www.github.com/badaix/snapcast instead of icecast. I see about a second lag between command/response - and some of that could be data buffered in pianobar itself, and it manages multiroom latency nicely.
I configured pianobar (or more properly the underlying sound system) to use snapcast for music playing & distribution. Have a few raspberry pi's and some android devices running snapclient. I feed snapserver on the main pi from pianobar, OR from another player (mpd based). No safety net yet... if both are playing, it sounds very ugly...
I'm kicking around some ideas for controlling this remotely - could be an adjunct program, or maybe something that @kylejohnson would be interested in adding as a feature. Lots of things that 'could be done', but where is the line between "patiobar as a controller for pianobar", and "a program to control pianobar and many other things"? Items I'm thinking about that tie to the original feature request of stream output include:
~paul
Off-topic, but related in spirit to the original discussion of getting a stream to work in the first place... Hopefully this might provide some "google term hints" if someone else is spelunking in this area:
The pcm.!default{...} setting mentioned by @hatcreek68 above may be part of a streaming solution, but be aware some systems expect to play through pcm.!front. In my asound.conf file:
Is it possible to feed the stream into Icecast (no to actual soudcard) to stream it over local network? Some hint would be greatly appreciated. Thanks!