PulseAudio: Play samples at a set volume - pulseaudio

I have built a Raspberry Pi music player, with volume control. The issue is that when the volume is very low or very high, the sound effects (button press bleeps, etc.) are also too weak or too loud. The Raspberry Pi uses PulseAudio (system daemon), and this is its PulseAudio set-up:
# pactl list short
0 module-udev-detect
1 module-alsa-card device_id="0" name="platform-soc_sound" card_name="alsa_card.platform-soc_sound" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module-udev-detect.discovered=1"
2 module-native-protocol-unix auth-cookie-enabled=0
3 module-stream-restore
4 module-device-restore
5 module-default-device-restore
6 module-bluetooth-policy
7 module-bluetooth-discover
8 module-bluez5-discover
9 module-rescue-streams
10 module-always-sink
11 module-switch-on-connect
0 alsa_output.platform-soc_sound.analog-stereo module-alsa-card.c s16le 2ch 44100Hz RUNNING
0 alsa_output.platform-soc_sound.analog-stereo.monitor module-alsa-card.c s16le 2ch 44100Hz IDLE
1 0 0 protocol-native.c s24-32le 2ch 44100Hz
0 protocol-native.c mpd
48 protocol-native.c pactl
0 startup float32le 2ch 44100Hz 3.279
1 beep_60 float32le 1ch 44100Hz 0.119
2 beep_70 float32le 1ch 44100Hz 0.119
3 beep_60_70 float32le 1ch 44100Hz 0.166
4 error float32le 2ch 44100Hz 0.702
5 bt float32le 1ch 44100Hz 0.264
0 alsa_card.platform-soc_sound module-alsa-card.c
I play the samples, using:
pactl play-sample startup
This command can take an additional parameter, namely the PulseAudio sink on which to play.
The solution seems to, somehow, create a sink, attach it to the Alsa card and use that to play the samples. I assume this sink would have its own volume control.

Related

Do /cat/proc/partitions in 'cygwin' directly correspond to specific wmic entries?

Here's the output from cygwin
> cat /proc/partitions
8 0 500107608 sda
8 1 266240 sda1
8 2 16384 sda2
8 3 472585216 sda3 C:\
8 4 26214400 sda4 D:\
8 5 1024000 sda5
Here's the output from wmic in Powershell
> wmic diskdrive get Name,Model,SerialNumber,Size,Status
Model Name SerialNumber Size Status
NVMe SAMSUNG MZVLW512 \\.\PHYSICALDRIVE0 0025_38BB_1410_1481. 512105932800 OK
Is 'sda' in cat/proc/partitions a 1:1 equivalence with '\.\PHYSICALDRIVE0'
Followup - here I only have 1 disk drive. If I had multiple drives attached would there be an easy command to tell which 'wmic' entry corresponds to which 'proc/partitions' entry?
I expect the sequence maintained. On my system the
SDA is PhysicalDrive0
SDB is PhysicalDrive1
and the dimensions in byte vs KB is almost matching
wmic diskdrive get Name,Model,SerialNumber,Size,Status
Model Name SerialNumber Size Status
ST1000LM035-1RK172 \\.\PHYSICALDRIVE0 WL10S143 1000202273280 OK
SAMSUNG MZNLN256HAJQ-000H1 \\.\PHYSICALDRIVE1 S3T6NE0JC13444 256052966400 OK
$ cat /proc/partitions
major minor #blocks name win-mounts
8 0 976762584 sda
8 1 960658432 sda1 D:\
8 2 16102400 sda2 E:\
8 16 250059096 sdb
8 17 266240 sdb1
8 18 16384 sdb2
8 19 248765440 sdb3 C:\
8 20 1003520 sdb4

ddrescue read non tried blocks

I'm trying to rescue a 1TB disk which has read errors. Because I didn't have a free 1TB drive, I created a raid 0 of two 500GB drives.
I used the command line from Wikipedia for the first run:
sudo ddrescue -f -n /dev/sdk /dev/md/md_test /home/user/rescue.map
ddrescue already completed this run after approximately 20 hours and more than 7000 read errors.
Now I'm trying to do a second run
sudo ddrescue -d -f -v -r3 /dev/sdk /dev/md/md_test /home/user/rescue.map
and read the non tried blocks but ddrescue gives me this:
GNU ddrescue 1.23
About to copy 1000 GBytes from '/dev/sdk' to '/dev/md/md_test'
Starting positions: infile = 0 B, outfile = 0 B
Copy block size: 128 sectors Initial skip size: 19584 sectors
Sector size: 512 Bytes
Press Ctrl-C to interrupt
Initial status (read from mapfile)
rescued: 635060 MB, tried: 0 B, bad-sector: 0 B, bad areas: 0
Current status
ipos: 1000 GB, non-trimmed: 0 B, current rate: 0 B/s
opos: 1000 GB, non-scraped: 0 B, average rate: 0 B/s
non-tried: 365109 MB, bad-sector: 0 B, error rate: 0 B/s
rescued: 635060 MB, bad areas: 0, run time: 0s
pct rescued: 63.49%, read errors: 0, remaining time: n/a
time since last successful read: n/a
Copying non-tried blocks... Pass 1 (forwards)
ddrescue: Write error: Invalid argument
I can't figure out what this write errors means, already searched the manual for answers.
Any help is appreciated! Thx!
After a while I found the cause for the write error, the capacity of the corrupt drive is 931,5G but the total capacity of the raid 0 was just 931,3G.
Realized it, while I took a closer look to the output of lsblk command.
So I rebuild the raid 0 array with 3 500G drives and ddrescue now works as expected.

TechWell TW6869 driver does not generate interrupts on embedded device

I'm trying to get a Techwell TW6869 driver to work. This PCIe-chip is able to capture analog video signals. Therefore I'm using a driver which can be found here: GitHub
The chip is connected to a Freescale imx.6 processor which is running Angström distribution. The driver already worked on the target but I didn't use it for some time and somehow it doesn't do it's job anymore.
So what I did, was implementing kernel messages in the beginning of each function so I know what does happen exactly. Finally I found out, that no PCIe Interrupt is generated anymore. Though the interrupt is registered which I found out here:
root#freescaleimx6:~# cat /proc/interrupts | grep tw6869
155: 0 0 0 0 GIC tw6869
Running something on the videodevice unfortunately does not generate an interrupt.
root#freescaleimx6:~# gst-launch-1.0 v4l2src device=/dev/video2 ! imxipuvideosink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:08.992961001
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
root#freescaleimx6:~#
This could also possibly help (does it?)
root#freescaleimx6:~# cat /proc/bus/pci/devices
0000 16c3abcd 180 1000000 0 0 0 0 0 1200000 100000 0 0 0 0 0 10000 pcieport
0100 17976869 9b 1100008 0 0 0 0 0 0 1000 0 0 0 0 0 0 tw6869
Does anyone have an idea?

Save file in eclipse makes processor works hard

I am using eclipse juno. Every time i save a file, eclipse consume 100% processor.
Here are the snapshot from top command :
Tasks: 303 total, 1 running, 301 sleeping, 1 stopped, 0 zombie
%Cpu(s): 31,2 us, 1,4 sy, 0,0 ni, 65,6 id, 0,4 wa, 0,0 hi, 1,4 si, 0,0 st
KiB Mem: 8077332 total, 5122068 used, 2955264 free, 509476 buffers
KiB Swap: 8252412 total, 0 used, 8252412 free, 2242736 cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3816 iwan 20 0 1141m 410m 35m S 100,9 5,2 59:00.47 eclipse
3882 iwan 20 0 594m 162m 52m S 2,3 2,1 6:09.30 skype
2646 iwan 20 0 309m 82m 32m S 2,0 1,0 9:05.18 compiz
3894 iwan 20 0 851m 171m 42m S 2,0 2,2 3:00.66 thunderbird
1305 root 20 0 266m 68m 55m S 1,3 0,9 7:55.87 Xorg
any ideas ?
Apply any available updates. If problems continue, keep an eye on http://bugs.eclipse.org/402018 .

Comprehensive methods of viewing memory usage on Solaris [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 7 years ago.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
On Linux, the "top" command shows a detailed but high level overview of your memory usage, showing:
Total Memory, Used Memory, Free Memory, Buffer Usage, Cache Usage, Swap size and Swap Usage.
My question is, what commands are available to show these memory usage figures in a clear and simple way? Bonus points if they're present in the "Core" install of Solaris. 'sar' doesn't count :)
Here are the basics. I'm not sure that any of these count as "clear and simple" though.
ps(1)
For process-level view:
$ ps -opid,vsz,rss,osz,args
PID VSZ RSS SZ COMMAND
1831 1776 1008 222 ps -opid,vsz,rss,osz,args
1782 3464 2504 433 -bash
$
vsz/VSZ: total virtual process size (kb)
rss/RSS: resident set size (kb, may be inaccurate(!), see man)
osz/SZ: total size in memory (pages)
To compute byte size from pages:
$ sz_pages=$(ps -o osz -p $pid | grep -v SZ )
$ sz_bytes=$(( $sz_pages * $(pagesize) ))
$ sz_mbytes=$(( $sz_bytes / ( 1024 * 1024 ) ))
$ echo "$pid OSZ=$sz_mbytes MB"
vmstat(1M)
$ vmstat 5 5
kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr rm s3 -- -- in sy cs us sy id
0 0 0 535832 219880 1 2 0 0 0 0 0 -0 0 0 0 402 19 97 0 1 99
0 0 0 514376 203648 1 4 0 0 0 0 0 0 0 0 0 402 19 96 0 1 99
^C
prstat(1M)
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
1852 martin 4840K 3600K cpu0 59 0 0:00:00 0.3% prstat/1
1780 martin 9384K 2920K sleep 59 0 0:00:00 0.0% sshd/1
...
swap(1)
"Long listing" and "summary" modes:
$ swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 256,1 16 1048560 1048560
$ swap -s
total: 42352k bytes allocated + 20192k reserved = 62544k used, 607672k available
$
top(1)
An older version (3.51) is available on the Solaris companion CD from Sun, with the disclaimer that this is "Community (not Sun) supported".
More recent binary packages available from sunfreeware.com or blastwave.org.
load averages: 0.02, 0.00, 0.00; up 2+12:31:38 08:53:58
31 processes: 30 sleeping, 1 on cpu
CPU states: 98.0% idle, 0.0% user, 2.0% kernel, 0.0% iowait, 0.0% swap
Memory: 1024M phys mem, 197M free mem, 512M total swap, 512M free swap
PID USERNAME LWP PRI NICE SIZE RES STATE TIME CPU COMMAND
1898 martin 1 54 0 3336K 1808K cpu 0:00 0.96% top
7 root 11 59 0 10M 7912K sleep 0:09 0.02% svc.startd
sar(1M)
And just what's wrong with sar? :)
# echo ::memstat | mdb -k
Page Summary Pages MB %Tot
------------ ---------------- ---------------- ----
Kernel 7308 57 23%
Anon 9055 70 29%
Exec and libs 1968 15 6%
Page cache 2224 17 7%
Free (cachelist) 6470 50 20%
Free (freelist) 4641 36 15%
Total 31666 247
Physical 31256 244
"top" is usually available on Solaris.
If not then revert to "vmstat" which is available on most UNIX system.
It should look something like this (from an AIX box)
vmstat
System configuration: lcpu=4 mem=12288MB ent=2.00
kthr memory page faults cpu
----- ----------- ------------------------ ------------ -----------------------
r b avm fre re pi po fr sr cy in sy cs us sy id wa pc ec
2 1 1614644 585722 0 0 1 22 104 0 808 29047 2767 12 8 77 3 0.45 22.3
the colums "avm" and "fre" tell you the total memory and free memery.
a "man vmstat" should get you the gory details.
Top can be compiled from sources or downloaded from sunfreeware.com. As previously posted, vmstat is available (I believe it's in the core install?).
The command free is nice. Takes a short while to understand the "+/- buffers/cache", but the idea is that cache and buffers doesn't really count when evaluating "free", as it can be dumped right away. Therefore, to see how much free (and used) memory you have, you need to remove the cache/buffer usage - which is conveniently done for you.