adding debug logs. I don't see any problem with the logs below but still I can see in the recorded data there are missing frames or corruption.
# cat /proc/asound/Loopback/cable#0 Cable 0 substream 0: valid: 3 running: 3 pause: 0 Playback buffer_size: 96000 buffer_pos: 72576 silent_size: 0 period_size: 24000 bytes_per_sec: 192000 sample_align: 4 rate_shift: 100000 update_pending: 0 irq_pos: 576000 period_frac: 24000000 last_jiffies: 4613492552 (4613492610) timer_expires: 4613492674 Capture buffer_size: 96000 buffer_pos: 73152 silent_size: 0 period_size: 24000 bytes_per_sec: 192000 sample_align: 4 rate_shift: 100000 update_pending: 0 irq_pos: 1152000 period_frac: 24000000 last_jiffies: 4613492552 (4613492610) timer_expires: 4613492671 Cable 0 substream 1: inactive Cable 0 substream 2: inactive Cable 0 substream 3: inactive Cable 0 substream 4: inactive Cable 0 substream 5: inactive Cable 0 substream 6: inactive Cable 0 substream 7: inactive # cat /proc/asound/Loopback/cable#0 Cable 0 substream 0: valid: 3 running: 3 pause: 0 Playback buffer_size: 96000 buffer_pos: 48768 silent_size: 0 period_size: 24000 bytes_per_sec: 192000 sample_align: 4 rate_shift: 100000 update_pending: 0 irq_pos: 768000 period_frac: 24000000 last_jiffies: 4613494928 (4613495026) timer_expires: 4613495049 Capture buffer_size: 96000 buffer_pos: 49344 silent_size: 0 period_size: 24000 bytes_per_sec: 192000 sample_align: 4 rate_shift: 100000 update_pending: 0 irq_pos: 1344000 period_frac: 24000000 last_jiffies: 4613494928 (4613495026) timer_expires: 4613495046 Cable 0 substream 1: inactive Cable 0 substream 2: inactive Cable 0 substream 3: inactive Cable 0 substream 4: inactive Cable 0 substream 5: inactive Cable 0 substream 6: inactive Cable 0 substream 7: inactive # cat /proc/asound/Loopback/cable#0 Cable 0 substream 0: valid: 3 running: 3 pause: 0 Playback buffer_size: 96000 buffer_pos: 48768 silent_size: 0 period_size: 24000 bytes_per_sec: 192000 sample_align: 4 rate_shift: 100000 update_pending: 0 irq_pos: 768000 period_frac: 24000000 last_jiffies: 4613495928 (4613495963) timer_expires: 4613496049 Capture buffer_size: 96000 buffer_pos: 49344 silent_size: 0 period_size: 24000 bytes_per_sec: 192000 sample_align: 4 rate_shift: 100000 update_pending: 0 irq_pos: 1344000 period_frac: 24000000 last_jiffies: 4613495928 (4613495963) timer_expires: 4613496046 Cable 0 substream 1: inactive Cable 0 substream 2: inactive Cable 0 substream 3: inactive Cable 0 substream 4: inactive Cable 0 substream 5: inactive Cable 0 substream 6: inactive Cable 0 substream 7: inactive # cat /proc/asound/Loopback/cable#0 Cable 0 substream 0: valid: 3 running: 3 pause: 0 Playback buffer_size: 96000 buffer_pos: 1152 silent_size: 0 period_size: 24000 bytes_per_sec: 192000 sample_align: 4 rate_shift: 100000 update_pending: 0 irq_pos: 1152000 period_frac: 24000000 last_jiffies: 4613496680 (4613496783) timer_expires: 4613496799 Capture buffer_size: 96000 buffer_pos: 1728 silent_size: 0 period_size: 24000 bytes_per_sec: 192000 sample_align: 4 rate_shift: 100000 update_pending: 0 irq_pos: 1728000 period_frac: 24000000 last_jiffies: 4613496680 (4613496783) timer_expires: 4613496796 Cable 0 substream 1: inactive Cable 0 substream 2: inactive Cable 0 substream 3: inactive Cable 0 substream 4: inactive Cable 0 substream 5: inactive Cable 0 substream 6: inactive Cable 0 substream 7: inactive # cat /proc/asound/Loopback/cable#0 Cable 0 substream 0: valid: 3 running: 3 pause: 0 Playback buffer_size: 96000 buffer_pos: 72576 silent_size: 0 period_size: 24000 bytes_per_sec: 192000 sample_align: 4 rate_shift: 100000 update_pending: 0 irq_pos: 576000 period_frac: 24000000 last_jiffies: 4613497552 (4613497610) timer_expires: 4613497674 Capture buffer_size: 96000 buffer_pos: 73152 silent_size: 0 period_size: 24000 bytes_per_sec: 192000 sample_align: 4 rate_shift: 100000 update_pending: 0 irq_pos: 1152000 period_frac: 24000000 last_jiffies: 4613497552 (4613497610) timer_expires: 4613497671 Cable 0 substream 1: inactive Cable 0 substream 2: inactive Cable 0 substream 3: inactive Cable 0 substream 4: inactive Cable 0 substream 5: inactive Cable 0 substream 6: inactive Cable 0 substream 7: inactive # cat /proc/asound/Loopback/cable#0 Cable 0 substream 0: valid: 3 running: 3 pause: 0 Playback buffer_size: 96000 buffer_pos: 49536 silent_size: 0 period_size: 24000 bytes_per_sec: 192000 sample_align: 4 rate_shift: 100000 update_pending: 0 irq_pos: 1536000 period_frac: 24000000 last_jiffies: 4613498432 (4613498501) timer_expires: 4613498549 Capture buffer_size: 96000 buffer_pos: 50112 silent_size: 0 period_size: 24000 bytes_per_sec: 192000 sample_align: 4 rate_shift: 100000 update_pending: 0 irq_pos: 2112000 period_frac: 24000000 last_jiffies: 4613498432 (4613498501) timer_expires: 4613498546 Cable 0 substream 1: inactive Cable 0 substream 2: inactive Cable 0 substream 3: inactive Cable 0 substream 4: inactive Cable 0 substream 5: inactive Cable 0 substream 6: inactive Cable 0 substream 7: inactive # cat /proc/asound/Loopback/cable#0 Cable 0 substream 0: valid: 3 running: 3 pause: 0 Playback buffer_size: 96000 buffer_pos: 25152 silent_size: 0 period_size: 24000 bytes_per_sec: 192000 sample_align: 4 rate_shift: 100000 update_pending: 0 irq_pos: 1152000 period_frac: 24000000 last_jiffies: 4613499305 (4613499373) timer_expires: 4613499424 Capture buffer_size: 96000 buffer_pos: 25728 silent_size: 0 period_size: 24000 bytes_per_sec: 192000 sample_align: 4 rate_shift: 100000 update_pending: 0 irq_pos: 1728000 period_frac: 24000000 last_jiffies: 4613499305 (4613499373) timer_expires: 4613499421 Cable 0 substream 1: inactive Cable 0 substream 2: inactive Cable 0 substream 3: inactive Cable 0 substream 4: inactive Cable 0 substream 5: inactive Cable 0 substream 6: inactive Cable 0 substream 7: inactive # cat /proc/asound/Loopback/cable#0 Cable 0 substream 0: valid: 3 running: 3 pause: 0 Playback buffer_size: 96000 buffer_pos: 384 silent_size: 0 period_size: 24000 bytes_per_sec: 192000 sample_align: 4 rate_shift: 100000 update_pending: 0 irq_pos: 384000 period_frac: 24000000 last_jiffies: 4613500176 (4613500195) timer_expires: 4613500299 Capture buffer_size: 96000 buffer_pos: 960 silent_size: 0 period_size: 24000 bytes_per_sec: 192000 sample_align: 4 rate_shift: 100000 update_pending: 0 irq_pos: 960000 period_frac: 24000000 last_jiffies: 4613500176 (4613500195) timer_expires: 4613500296 Cable 0 substream 1: inactive Cable 0 substream 2: inactive Cable 0 substream 3: inactive Cable 0 substream 4: inactive Cable 0 substream 5: inactive Cable 0 substream 6: inactive Cable 0 substream 7: inactive # cat /proc/asound/Loopback/cable#0 Cable 0 substream 0: valid: 3 running: 3 pause: 0 Playback buffer_size: 96000 buffer_pos: 48768 silent_size: 0 period_size: 24000 bytes_per_sec: 192000 sample_align: 4 rate_shift: 100000 update_pending: 0 irq_pos: 768000 period_frac: 24000000 last_jiffies: 4613500928 (4613500964) timer_expires: 4613501049 Capture buffer_size: 96000 buffer_pos: 49344 silent_size: 0 period_size: 24000 bytes_per_sec: 192000 sample_align: 4 rate_shift: 100000 update_pending: 0 irq_pos: 1344000 period_frac: 24000000 last_jiffies: 4613500928 (4613500964) timer_expires: 4613501046 Cable 0 substream 1: inactive Cable 0 substream 2: inactive Cable 0 substream 3: inactive Cable 0 substream 4: inactive Cable 0 substream 5: inactive Cable 0 substream 6: inactive Cable 0 substream 7: inactive
On Fri, Jun 14, 2024 at 7:50 PM noman pouigt variksla@gmail.com wrote:
Hello Folks,
I wanted to use aloop driver to dump playback audio data to a file in userspace for debugging without data being sent to hardware (just as a debug feature for future use).
Command flow is this:
- aloop capture device is started using below command
first: "arec -D hw:0,1 /data/rec.wav &"
- using aplay, userspace sends the playback data.
"aplay -D hw:0,0 /data/test.wav"
Using jiffies. Wondering if changing rate_shift (don't know what is that for) will help?
However, even in this simple setup I can see aloop driver is corrupting the data and sinetone sent from playback has glitches. I have tried different period sizes as well but nothing worked. Wondering if this is by design i.e. if the aloop driver shouldn't be used for this purpose? Any debug steps will be highly appreciated.
Thanks for your help,