Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 4 123 ... LastLast
Results 1 to 10 of 36
  1. #1

    piCorePlayer with cava and tmux (so far)

    I have pCP running on a Pi 3 B+ connected via HDMI to my Denon receiver which then connects via HDMI to my TV. I had jivelite going which is cool but the TV isn't a touchscreen so the "now playing" info was all I was really interested in. I've been messing around this weekend with a console style status screen. Still in its' infancy and it took some head banging to get the alsa config correct. Just thought I'd show you what I'm working on and use this thread to keep some notes - I'm usually pretty bad about doing that.

    tmux let's you carve up the screen (amongst a bunch of other things) which is something I thought would be critical for this effort. So far I've only got cava working and haven't really investigate what other console apps would be useful. Converting album art to ascii art for display in one of the console sections would be cool.

    cava is a console based audio visualizer.

    Let's see if the .gif works. This is captured via an ssh session but it works on the locally attached monitor also (but not at the same time yet.)

    Last edited by sodface; 2018-11-04 at 13:50.

  2. #2
    Had to compile tmux and cava from source and made a .tcz package for each, the contents of which may need to change. This is what I have in my .dep files for each thus far:

    cava:
    fftw.tcz
    mylocale.tcz

    tmux:
    libevent.tcz
    ncurses.tcs
    mylocale.tcz

    So far everything has been in the piCore 9.x repo (except tmux and cava).

    Changes I've made so far:
    cmdline.txt - added lang=en_US.UTF-8
    config.txt - added hdmi_force_hotplug=1 and hdmi_drive=2 so audio/video would still work if Pi boots up without the stereo on (doesn't see the hdmi otherwise)
    modprobe snd_aloop (needed to create the loopback device for cava)
    /usr/local/sbin/config.cfg - changed OUTPUT="default" (not sure if this is necessary yet, still experimenting but this is working)
    changed /etc/asound.conf - see below, this sends the squeezelite output to the HDMI interface and to the loopback simultaneously, cava uses the loopback
    created /home/tc/config - cava config, start with cava -p /home/tc/config
    TERM - this environment variable was set to "xterm" in the above gif otherwise you don't get colors and the bars are made up of numbers, tmux explicitly tells you TERM should be "screen" or you could get unexpected results, but cava didn't understand "screen", need to sort that out still.

    For the cava config file, the only thing I've changed from the example config is to uncomment the ALSA loopback lines:
    Code:
    method = alsa
    source = hw:Loopback,1
    Here's the working /etc/asound.conf - will be edited further since I took out some stuff pCP had in there by default.
    Code:
    pcm.multi {
        type route;
        slave.pcm {
            type multi;
            slaves.a.pcm "output";
            slaves.b.pcm "loopin";
            slaves.a.channels 2;
            slaves.b.channels 2;
            bindings.0.slave a;
            bindings.0.channel 0;
            bindings.1.slave a;
            bindings.1.channel 1;
            bindings.2.slave b;
            bindings.2.channel 0;
            bindings.3.slave b;
            bindings.3.channel 1;
        }
    
        ttable.0.0 1;
        ttable.1.1 1;
        ttable.0.2 1;
        ttable.1.3 1;
    }
    
    pcm.!default {
            type plug
            slave.pcm "multi"
    }
    
    pcm.output {
            type hw
            card ALSA
    }
    
    pcm.loopin {
            type plug
            slave.pcm "plughw:Loopback,0,0"
    }
    
    pcm.loopout {
            type plug
            slave.pcm "plughw:Loopback,1,0"
    }
    Last edited by sodface; 2018-11-04 at 15:08.

  3. #3
    Still jacking around with the framebuffer. Been kind of fun so far and I've learned a few things. So far I'm using:

    - tmux for dividing the display
    - cava for the audio visualization
    - tty-clock, which I edited the source code to add a count up timer option so I can use it as an elapsed time display rather than a clock
    - imagemagick to convert cover art to .bgra format
    - dd to write the cover art to the framebuffer without disturbing the other applications
    - expect to manage the telnet connection to LMS for player status updates

    Things to do:

    - still need to work out the best method for duct taping all the pieces together
    - work on a tmux config, need to get rid of the status bar and hopefully the pane dividers, I want the divisions but I don't want them to be visible
    - as part of the tmux config, need to work out a good screen layout and pane dimensions
    - need a good method for displaying song info, going to look at figlet for this

    The attached screenshot was just me testing things, mostly writing the cover art to the framebuffer, the tty-clock timer isn't currently wired to the actual elapsed time of the currently playing song which is why it's showing 30 minutes and 8 seconds. As part of adding the timer functionality to tty-clock, I added a timer pause function in the key press detection code so I can send a key press via script and pause the timer and start it again or I can set the timer to start at any arbitrary value, not just 0.

    The image can be resized of course and placed anywhere in the display, jamming it up in the corner was just for easy testing with dd.
    Attached Images Attached Images  
    Last edited by sodface; 2018-11-17 at 20:05.

  4. #4
    Still goofing around. Tmux pane dividers hidden, Figlet fonts (not sure I really like them). I'm able to write the album cover art to /dev/fb0 with imagemagick directly without converting and then using dd, still trying different methods with that to get fast draws without overwriting anything in the other panes.
    Attached Images Attached Images  

  5. #5
    I shifted my approach a little, now heading in the direction as seen below. I think I like the look of this the best so far. I spent way too much time trying to figure out either:

    1. Globally set the alpha channel of all pixels for /dev/fb0 to get some transparency in the linux frame buffer.
    2. Globally set the alpha channel of all pixels on a dispmanx layer to get some transparency and then apply it to the layer assigned to linux (-127).

    I never got either of those methods working. Basically I wanted to get blurred, full screen background image in a dispmanx layer behind the semi-transparent linux console layer then the full resolution cover art in a dispmanx layer above the linux console:

    blurred background layer ==> semi-transparent linux console layer ==> cover art layer

    I threw in the towel on both 1 and 2 above and now have this order as seen in the screenshots below:

    linux console layer ==> semi-transparent blurred background layer ==> cover art layer

    The semi-transparent background layer allows the cava audio visualizer running in the console to show through, though the colors are a bit muted because the background image is on top of the console instead of underneath it, which might actually be a good thing. I've managed to get the time needed to download, convert, manipulate and display the images to about 2.5s. I'd like it a bit faster but it's better than the 9+ seconds I was getting initially before I started to optimize the graphicsmagick conversion steps.
    Attached Images Attached Images    
    Last edited by sodface; 2018-11-22 at 22:04.

  6. #6
    Here's the last one with the background removed.
    Attached Images Attached Images  

  7. #7
    Senior Member Greg Erskine's Avatar
    Join Date
    Sep 2006
    Location
    Sydney, Australia
    Posts
    1,491
    I am watching....

  8. #8
    I've spent a lot of time on this today and I'm no further than I was this morning. All I need is the ability to do basic image manipulations on just a couple of file types AND the ability to add text to the image. I can't believe the amount of baggage that ImageMagick and GraphicsMagick bring with them. GraphicsMagick is much faster at the image manipulation steps so I decided pretty quickly to scrap ImageMagick. GraphicsMagick's documentation isn't as good though. I figured adding text to the images for album and song info was going to be easy (and it is if you bring in a ton of dependencies like the stock repo package does). I figured I'd recompile myself and strip out most everything. What a nightmare.

    I also tried to build the gmic cli utility thinking it would do what I need but I can't get it to compile.

    Convert to png and add some text? Does it really take 25 different packages?? Any suggestions?
    Last edited by sodface; 2018-11-23 at 19:50.

  9. #9
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    778
    Quote Originally Posted by sodface View Post
    I figured adding text to the images for album and song info was going to be easy (and it is if you bring in a ton of dependencies like the stock repo package does). I figured I'd recompile myself and strip out most everything. What a nightmare.
    I also tried to build the gmic cli utility thinking it would do what I need but I can't get it to compile.
    Convert to png and add some text? Does it really take 25 different packages?? Any suggestions?
    ImageMagick and GraphicsMagick actually seem to have very few hard dependencies for what you need if you build it yourself:
    libltdl
    freetype (needs zlib)
    fontconfig (needs expat)

    since gmic depends on GraphicsMagick and doesn't add anything you need, I don't see the advantage of using it.

  10. #10
    Quote Originally Posted by Roland0 View Post
    ImageMagick and GraphicsMagick actually seem to have very few hard dependencies for what you need if you build it yourself:
    libltdl
    freetype (needs zlib)
    fontconfig (needs expat)

    since gmic depends on GraphicsMagick and doesn't add anything you need, I don't see the advantage of using it.
    Thanks for the reply Roland0, the GraphicsMagick webpage make it seem like GhostScript is an optional component but I don't think it really is, at least I couldn't figure out how to compile it so the gm executable wouldn't moan about it being missing. Below is one of my many configure runs, see how there's no default option for Ghostscript? I happened to have the GhostScript extension loaded for this run which is why it picked up the version info I guess. I tried to compile without GS loaded and also with a couple of different configure options, like --with-GhostScript=no and it would just say unknown option:

    Code:
    Option            Configure option              Configured value
    -----------------------------------------------------------------
    Shared libraries  --enable-shared=no            no
    Static libraries  --enable-static=yes           yes
    GNU ld            --with-gnu-ld=yes             yes
    Quantum depth     --with-quantum-depth=16       16
    Modules           --with-modules=no             no
    
    Delegate Configuration:
    BZLIB             --with-bzlib=no               no
    DPS               --with-dps=no                 no
    FlashPIX          --with-fpx=no                 no
    FreeType 2.0      --with-ttf=yes                yes
    Ghostscript       None                          gs (9.22)
    Ghostscript fonts --with-gs-font-dir=default    /usr/local/share/ghostscript/fonts/
    JBIG              --with-jbig=no                no
    JPEG v1           --with-jpeg=yes               yes
    JPEG-2000         --with-jp2=no                 no
    LCMS v2           --with-lcms2=no               no
    LZMA              --with-lzma=no                no
    Magick++          --with-magick-plus-plus=no    no
    PERL              --with-perl=no                no
    PNG               --with-png=yes                yes (-lpng16)
    TIFF              --with-tiff=no                no
    TRIO              --with-trio=no                no
    WEBP              --with-webp=no                no
    Windows fonts     --with-windows-font-dir=      none
    WMF               --with-wmf=no                 no
    X11               --with-x=                     no
    XML               --with-xml=no                 no
    ZLIB              --with-zlib=no                yes
    For reference, here's all the junk that gets pulled in with the GraphicsMagick.tcz from the official repo:

    Code:
    libjpeg-turbo.tcz
    libtiff.tcz
    libpng.tcz
    giflib.tcz
    libwebp.tcz
    libICE.tcz
    libSM.tcz
    lcms2.tcz
    icu.tcz
    graphite2.tcz
    libmount.tcz
    gcc_libs.tcz
    pcre.tcz
    libelf.tcz
    gamin.tcz
    glib2.tcz
    harfbuzz.tcz
    GraphicsMagick.tcz
    freetype.tcz
    libXdmcp.tcz
    libXau.tcz
    libxcb.tcz
    libX11.tcz
    libXext.tcz
    fontconfig.tcz
    libtasn1.tcz
    p11-kit.tcz
    gmp.tcz
    nettle.tcz
    libidn.tcz
    gnutls.tcz
    dbus.tcz
    libavahi.tcz
    libcups.tcz
    ghostscript.tcz
    I compiled netpbm and have been testing with that over the last several days. It's mostly working. I figured I could just pick out the few tools I needed from it which would keep the footprint down. It's just a bit slow at the moment, like 4.5 seconds to wget, copy, blur, resize and composite into a single semi-transparent full screen image.

    I keep going down rabbit holes of different tools and losing days just jacking around with transparency and resizing. I think my wife's about to strangle me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •