[pulseaudio-tickets] [Bug 95021] LFE channel not synthesized properly

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon May 2 18:10:22 UTC 2016


https://bugs.freedesktop.org/show_bug.cgi?id=95021

--- Comment #3 from Ahmed S. Darwish <darwish.07 at gmail.com> ---
#!/bin/bash

#
# generate_waveform.sh - Record from a PulseAudio sink monitor and
# plot the resulting waveform using sox and gnuplot
#
# usage:
#   - generate_waveform.sh alsa - Plot from ALSA sink monitor
#   - generate_waveform.sh null - Plot from NULL sink monitor
#
# notes:
#   - Before usage, set ALSA_SINK_NAME to system-appropriate value
#   - If not available, a NULL_5.1 sink is automatically created
#

set -o errexit
set -o nounset

PACTL=pactl
PACAT=pacat
PAREC=parec

NULL_SINK_NAME=NULL_5.1
NULL_SINK_MONITOR=${NULL_SINK_NAME}.monitor

ALSA_SINK_NAME=alsa_output.pci-0000_00_14.2.analog-stereo
ALSA_SINK_MONITOR=${ALSA_SINK_NAME}.monitor

OUTPUT_WAV_FILE=audio.wav
OUTPUT_DAT_FILE=audio.dat
OUTPUT_PLOT_FILE=audio.plot
OUTPUT_PNG_FILE=audio.png
GNUPLOT_SCRIPT=plot_audio.gp

RECORD_PERIOD=10s

usage() {
    echo "usage: $0 [null|alsa]" >& 2
    exit -1
}

[[ "$#" != "1" ]] && usage
case "$1" in
    "null") RECORD_SINK_MONITOR=$NULL_SINK_MONITOR;;
    "alsa") RECORD_SINK_MONITOR=$ALSA_SINK_MONITOR;;
    *) usage
esac

null_sink_exists() {
    $PACTL list sinks | grep --silent $NULL_SINK_NAME
}

create_null_sink() {
    echo "Creating NULL sink $NULL_SINK_NAME"
    $PACTL load-module module-null-sink sink_name=$NULL_SINK_NAME  \
         channels=6                                                \
        
channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe    
}

null_sink_exists || create_null_sink

$PAREC -d $RECORD_SINK_MONITOR --file-format=wav $OUTPUT_WAV_FILE &
_pid=$!

echo "Recording audio, from $RECORD_SINK_MONITOR, for ${RECORD_PERIOD} .."
sleep $RECORD_PERIOD
kill $_pid

echo "Generating signal amplitude values .."
sox $OUTPUT_WAV_FILE $OUTPUT_DAT_FILE
tail -n+3 $OUTPUT_DAT_FILE > $OUTPUT_PLOT_FILE    # Remove comments

cat > $GNUPLOT_SCRIPT <<EOF
set terminal pngcairo enhanced size 640,480 font 'Verdana,10'
set output "$OUTPUT_PNG_FILE"
set yrange [-1:1]
set ytics -1,0.1,1        # 0.1 jumps
plot "$OUTPUT_PLOT_FILE" with lines
EOF

echo "Plotting audio .."
gnuplot $GNUPLOT_SCRIPT

echo "Success! .. please check audio waveform at $OUTPUT_PNG_FILE"

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-bugs/attachments/20160502/74cadafd/attachment.html>


More information about the pulseaudio-bugs mailing list