peppyalsa - ALSA plugin for VU Meters and Spectrum Analyzers

Looking at your multi config: The equal plugin requires stereo. The first plug plugin upstream the equal is still in the common branch. Did you try separating the equal from the common branch with another plug? That one could do the mono-> stereo conversion and your hardware branch would not be affected.
 
Hi rpi, hi Phofman,
I'm back....
Sorry to bore you with another "story". In the moOde community there is a nice solution (mpd_oled) which, like Peppyalsa, needs to be configured at the MPD level to work. The moOde system automatically creates the mdp.conf file so the person who integrates mpd_oled and I had to modify the programs that creates the mpd.conf file. Due to the continuous evolution of the moOde platform, we have to change the program at each platform change. So he decided to interface mpd_oled at the ALSA level. I'm trying to do the same and after more than a week of testing I found you were talking about it 3 years ago.
I am happy that the current configuration (the last one I created) is very similar to one of yours, but it does not work.
The situation is that I divide the data path into three equalizer ways:
1. the first goes to the output.
2. the second goes to peppyalsa.
3. the third goes to mpd_oled.

By analyzing the path you can see that due to compatibility issues, I convert to 16 bit. As I said, after a lot of testing I got that Peppyalsa creates FIFO, but it looks empty.
In other words everything (music and mpd_oled) works but the alsa client shows the L: and R: channels without any signal. It looks like the volume is 0.
Would you be kind enough to try to suggest some ideas?
Find below asound.conf.

Code:
pi@moOde-FdA-Test:~ $ cat /etc/asound.conf
pcm.!eqfa12p {
    type copy
    slave.pcm "eqfa12p_and_copy"
}

pcm.eqfa12p_and_copy {
    type plug
    slave.pcm {
        type multi
        slaves {
            a { channels 2 pcm "plug_eqfa12p" }       # the original output
            b { channels 2 pcm "plughw:Loopback,0" }  # the loopback driver
        }
        bindings {
            0 { slave a channel 0 }
            1 { slave a channel 1 }
            2 { slave b channel 0 }
            3 { slave b channel 1 }
        }
    }
    ttable [
        [ 1 0 1 0 ]   # left  -> a.left,  b.left
        [ 0 1 0 1 ]   # right -> a.right, b.right
    ]
}
pcm.!alsaequal {
    type copy
    slave.pcm "alsaequal_and_copy"
}

pcm.alsaequal_and_copy {
    type plug
    slave.pcm {
        type multi
        slaves {
            a { channels 2 pcm "plug_alsaequal" }     # the original output
            b { channels 2 pcm "plug_peppyalsa" }     # to the PeppyAlsa
            c { channels 2 pcm "plughw:Loopback,0" }  # the loopback driver

        }
        bindings {
            0 { slave a channel 0 }
            1 { slave a channel 1 }
            2 { slave b channel 0 }
            3 { slave b channel 1 }
            4 { slave c channel 0 }
            5 { slave c channel 1 }
        }
    }
    ttable [
        [ 1 0 1 0 1 0 ]   # left  -> a.left,  b.left,  c.left
        [ 0 1 0 1 0 1 ]   # right -> a.right, b.right, c.right
    ]
}

# CONFIG for PeppyAlsa

pcm.plug_peppyalsa {
       type lfloat
       slave {
           pcm "peppyalsa"
           format S16_LE
#           rate 44100
       }
}

pcm.peppyalsa {
       type meter
       slave.pcm "pippo"
       scopes.0 peppyalsa
}

pcm.pippo {
        type null
}

pcm_scope.peppyalsa {
       type peppyalsa
       decay_ms 400
       meter "/var/tmp/peppyfifo"
       meter_max 100
       meter_show 0
       spectrum "/var/tmp/peppyfifosa"
       spectrum_max 100
       spectrum_size 30
}

pcm_scope_type.peppyalsa {
       lib /usr/local/lib/libpeppyalsa.so
}

Best regards and thanks,
Francesco
 
The new version of the peppyalsa plugin was released today.
Included the code implemented by Tobias Dyballa. The changes improve the Spectrum Analyzer functionality:
* The signal amplitude and horizontal scale can be either linear or logarithmic now.
* The signal can be smoothed across frequency bands by changing the smoothing factor configuration parameter.
* The FFT window function can be selected from three types: Hann, Hamming and Blackman.
 
Hi Francesco,

Here is the project location on Github:
GitHub - project-owner/peppyalsa

Here are the project wiki pages:
Home * project-owner/peppyalsa.doc Wiki * GitHub

Here is the table describing the new Spectrum Analyzer plugin parameters:
Spectrum Analyzer * project-owner/peppyalsa.doc Wiki * GitHub

I hope eventually create a stand-alone Spectrum Analyzer UI app similar to the PeppyMeter. At the moment it's available as a screensaver in the Peppy Player:
Spectrum Analyzer * project-owner/Peppy.doc Wiki * GitHub
Though you can read spectrum data from the named pipe and use it for your needs.

Best regards
 
I’ve been trying to get PeppyMeter and PeppySpectrum running in Moode 8.1.1. I can get either the meter or spectrums running (sort of), but I can’t for the life of me get both pipes active on both L and R channels.

I’ve followed the great guide by fdealexa and adapted the Moode 7.2 instructions to 8.1.1 and peppyalsa runs and shows both L and R channels active with pipe “peppyfifo”. PeppyMeter runs after a bit of tinkering. The first time it breaks with a message about segmentation fault. Running it again, gets further but sticks until I enter Control C at which point the meter displays on screen and is active.

The second pipe “peppyfifosa” only shows activity on the L channel. I can’t seem to get both pipes active with both L and R channels.
Any thoughts on what I’m missing?
 
Hi,

There is no left/right channel for spectrum, it's combined signal - 4 bytes per frequency band. The picture in the doc is wrong:
https://github.com/project-owner/peppyalsa.doc/wiki/Spectrum-Analyzer-Usage
it shows 2 bytes but in reality it's 4 bytes.
Here is example of using both meter and spectrum for Volumio player:

Best regards
doh.. :) i've been chasing ghosts. I had mistakenly assumed peppyalsa would populate both L and R channels irrespective and peppyspectrum would do the merge.

Turns out the reason I was having problems with segmentation fault and having to force a break with keying in <control-c> was because I needed to explicitly direct the command to the right screen - "DISPLAY=:0 sudo python3 peppymeter.py" and "DISPLAY=:0 sudo python3 spectrum.py"

all working in Moode 8.1.1 full screen on a 7" touchscreen. Touching the screen exits and resumes back to the original Moode screen.

Thanks RPI for sharing your excellent work and fdealexa for your very helpful instruction on getting peppymeter running in Moode.
 
  • Like
Reactions: 1 user
Hopefully the ALSA experts on this forum can answer the question about using peppyalsa together with dmix ALSA plugin:
https://github.com/project-owner/peppyalsa.doc/issues/2

I have to use more than one application and I want a vumeter on the mixed stream.
My original asound.conf works with : 3 "plug" devices -> "dmix" device -> "hw " device
I now have to add "meter" device from peppyalsa but as "dmix" needs a "hw" slave, I can't use "meter" as "dmix" slave.
I have tried many configurations but I am not competent enough with ALSA to make peppyalsa work with dmix.
Has anybody managed to set up such a configuration ?
Thank you!