Skip to content

Configuration

project-owner edited this page Apr 6, 2024 · 26 revisions

In order to make Audio Player and PeppyMeter work together the following steps should be done:

  1. Create named pipe.
  2. Configure peppyalsa plugin.
  3. Configure Audio Player.
  4. Configure PeppyMeter.

Create named pipe

To create the named pipe run the following command in the folder /home/pi:

mkfifo myfifo

Configure peppyalsa plugin

The details about peppyalsa plugin configuration can be found on its wiki pages

Configure Audio Player

The peppyalsa plugin should be specified as output device for the audio player. Here is the example for aplay player:

aplay -D peppyalsa audio_file.wav

Configure PeppyMeter

PeppyMeter functionality can be modified by changing properties in the configuration file - config.txt. This file is located in PeppyMeter root folder. It has four sections:

  1. Current. The properties in this section define the current meter and random meter update interval. Can be modified by user.
  2. SDL Environment. These properties define SDL environment variables.
  3. Serial interface configuration parameters.
  4. I2C configuration parameters.
  5. PWM configuration parameters.
  6. HTTP source parameters.
  7. Web Server parameters.
  8. Data Source. The properties in this section define the data source settings.

Current.

Here are the default properties in the current section:

[current]
meter = random
random.meter.interval = 20
base.folder =
meter.folder = 480x320
screen.width =
screen.height =
exit.on.touch = False
stop.display.on.touch = False
output.display = True
output.serial = False
output.i2c = False
output.pwm = False
output.http = False
use.logging = False
use.cache = True
cache.size = 20
frame.rate = 30

The 'meter' property defines the current meter name. Only this meter will be displayed in UI. For the 'small', 'medium' and 'large' meter size the name can be one of the following:

  • bar
  • black-white
  • blue
  • blue-2
  • compass
  • dash
  • emerald
  • gas
  • gold
  • grunge
  • orange
  • rainbow
  • red
  • royal
  • tube
  • vintage
  • white-red
  • vertical-linear
  • vertical-circular
  • big-bang
  • ring
  • random

For the 'wide' group the name can be one of these:

  • black-white
  • blue-2
  • emerald
  • gold
  • orange
  • red
  • tube
  • white-red
  • random

The name of any user-defined meter can be defined here as well. In this case the PeppyMeter will use files from the folder with the same name.

The 'random' meter is the default one. This meter periodically replaces current meter. The time interval when random meter replaces the current one is defined in the property 'random.refresh.interval'. This value should be defined in seconds. The default value is 20 seconds.

The meters to display can be also specified as a comma separated names. For example:

[current]
meter = blue, vintage

In this case only the specified meters will be displayed. The meters will be displayed in the defined order.

The property 'base.folder' defines the the base folder name where all meters have been stored.

The property 'meter.folder' defines the meter folder name which will be used. There is a naming convention for the meter folder names:

  • The meter folder name should start from the meter reolution e.g. 480x320
  • Any arbitrary text can be added after the resolution part.

Here are the meter folder name examples:

  • 480x320
  • 480x320new_version
  • 480x320-new-version

You can see how each default meter looks like in the Default Meters chapter

If the property exit.on.touch is True the touch on screen or mouse click will cause exit from the PeppyMeter.

The properties screen.width and screen.height can be used to embed PeppyMeter into larger screens.

Data Source.

The data source section of the configuration file has the following properties:

[data.source]
type = pipe
polling.interval = 0.033
pipe.name = /home/pi/myfifo
volume.constant = 80.0
volume.min = 0.0
volume.max = 100.0
volume.max.in.pipe = 100.0
step = 6
mono.algorithm = average
stereo.algorithm = new
smooth.buffer.size = 4

The first property 'type' defines the data source type. There are seven different data source types:

  1. pipe - named pipe/fifo data source. The name of the pipe can be defined using property pipe.name.
  2. constant - provides the fixed volume value which can be defined in another property of this section - constant.current. This data source is very useful for meters' calibration/tuning. There is no need to switch on audio player in this case. The data will be generated internally.
  3. noise - generates random volume values. This is the default data source. This data source is useful for checking the behavior of the user-defined meters.
  4. saw - generates volume values as the saw waveform.
  5. triangle - generates volume values distributed over time in a form of triangle.
  6. sine - generates signal in a form of sine waveform. It can be used for testing purposes.
  7. http - get volume data from HTTP requests sent to the Tornado web server started by PeppyMeter.

ds

The property polling.interval defines how often PeppyMeter retrieves data from the named pipe. The default value is 33 milliseconds. This is pretty reasonable value and probably should never be changed. It's calculated assuming that the frame rate is 30 fps. There is no sense to get the data more often than each frame is displayed in UI.

Using the volume.constant property user can define the constant volume level which doesn't change over time. This is very useful for meter adjusting during custom meter development. For example to adjust boundary meter needle positions such values as 0 and 100 can be specified and then corresponding start and stop angles could be defined for that meter.

The properties volume.min and volume.max define the minimum and maximum boundaries for testing signal. For example if data source type sine was selected and boundaries 20 and 80 were specified then the sine signal will change only in these boundaries.

The property smooth.buffer.size can be used to increase/decrease the animation smoothness. The default value is 4. Increasing the value will increase the animation smoothness and vice versa.

<<Previous | Next>>