Friday, June 30, 2023

Re: "ticking" noise when recording audio

Sorry for the delay on this, it has been a busy month. I'm finding some
time to get to this.

I enabled UAUDIO_DEBUG and got some info. Here's what I got from
/var/log/messages when I started sndiod w/ debugging & started
running aucat

Jun 30 13:51:22 towerDefense /bsd: uaudio_set_params: rate 96000 ->
96000 (index 11)
Jun 30 13:51:22 towerDefense /bsd: uaudio_set_params: rate = 96000
Jun 30 13:51:22 towerDefense /bsd: uaudio_set_params: rate 48000 ->
48000 (index 8)
Jun 30 13:51:22 towerDefense /bsd: uaudio_set_params: rate = 96000
Jun 30 13:51:22 towerDefense /bsd: uaudio_set_params: rate 96000 ->
96000 (index 11)
Jun 30 13:51:22 towerDefense /bsd: uaudio_set_params: rate = 96000
Jun 30 13:51:22 towerDefense /bsd: uaudio_req: type = 0xa1, req = 0x81,
val = 0x200, index = 0x202, size = 2
Jun 30 13:51:22 towerDefense /bsd: uaudio_req: type = 0xa1, req = 0x81,
val = 0x100, index = 0x202, size = 1
Jun 30 13:51:22 towerDefense /bsd: uaudio_set_params: rate 48000 ->
48000 (index 8)
Jun 30 13:51:22 towerDefense /bsd: uaudio_set_params: rate = 48000
Jun 30 13:51:22 towerDefense /bsd: uaudio_set_params: rate 48000 ->
48000 (index 8)
Jun 30 13:51:22 towerDefense /bsd: uaudio_set_params: rate = 48000
Jun 30 13:51:22 towerDefense /bsd: uaudio_req: type = 0xa1, req = 0x81,
val = 0x201, index = 0x300, size = 2
Jun 30 13:51:22 towerDefense /bsd: uaudio_req: type = 0xa1, req = 0x81,
val = 0x202, index = 0x300, size = 2
Jun 30 13:51:22 towerDefense /bsd: uaudio_req: type = 0xa1, req = 0x81,
val = 0x100, index = 0x300, size = 1
Jun 30 13:51:22 towerDefense /bsd: uaudio_stream_open: rec: blksz =
1920, rate = 96000, fps = 1000
Jun 30 13:51:22 towerDefense /bsd: uaudio_stream_open: spf = 0x1e00000
in [0x1de2000:0x1e1e000]
Jun 30 13:51:22 towerDefense /bsd: uaudio_stream_open: nframes_max = 11,
nframes_mask = 0, maxpkt = 194
Jun 30 13:51:22 towerDefense /bsd: uaudio_stream_open: safe_blksz =
2048, nxfers = 8
Jun 30 13:51:22 towerDefense /bsd: uaudio_req: type = 0x22, req = 0x1,
val = 0x100, index = 0x82, size = 3
Jun 30 13:51:22 towerDefense /bsd: uaudio_trigger: preparing
Jun 30 13:51:22 towerDefense /bsd: uaudio_trigger: starting
Jun 30 13:51:22 towerDefense /bsd: uaudio2: 2 null frames out of 11:
incomplete record xfer
Jun 30 13:51:23 towerDefense /bsd: uaudio2: 1 null frames out of 10:
incomplete record xfer
Jun 30 13:51:23 towerDefense last message repeated 2 times
Jun 30 13:51:23 towerDefense /bsd: uaudio_stream_open: play: blksz =
1920, rate = 48000, fps = 1000
Jun 30 13:51:23 towerDefense /bsd: uaudio_stream_open: spf = 0xf00000 in
[0xef1000:0xf0f000]
Jun 30 13:51:23 towerDefense /bsd: uaudio_stream_open: nframes_max = 11,
nframes_mask = 0, maxpkt = 196
Jun 30 13:51:23 towerDefense /bsd: uaudio_stream_open: safe_blksz =
2048, nxfers = 8
Jun 30 13:51:23 towerDefense /bsd: uaudio_req: type = 0x22, req = 0x1,
val = 0x100, index = 0x1, size = 3
Jun 30 13:51:23 towerDefense /bsd: uaudio_trigger: preparing
Jun 30 13:51:23 towerDefense /bsd: uaudio_trigger: starting
Jun 30 13:51:23 towerDefense /bsd: uaudio2: 1 null frames out of 10:
incomplete record xfer


At the same time, here's the debug output from sndiod

sndiod -dd -f rsnd/0 -F rsnd/1 -f rsnd/3 -f rsnd/2
snd0.default: rec=0:1 play=0:1 vol=8388608 dup
snd0.0: rec=0:1 play=0:1 vol=8388608 dup
snd1.1: rec=0:1 play=0:1 vol=8388608 dup
snd2.2: rec=0:1 play=0:1 vol=8388608 dup
snd3.3: rec=0:1 play=0:1 vol=8388608 dup
default/server.device=0:0 at 1 -> opt_dev:default/0: added
default/server.device=1:1 at 2 -> opt_dev:default/1: added
default/server.device=2:0 at 3 -> opt_dev:default/2: added
default/server.device=3:0 at 4 -> opt_dev:default/3: added
app/aucat0.level=127 at 5 -> slot_level:aucat0: added
warning, device opened in rec-only mode
2/input0.level=104 at 6 -> hw:2/64: added
2/input0.mute=0 at 7 -> hw:2/96: added
snd2: software master level control enabled
2/output.level=127 at 8 -> dev_master:2: added
snd2: 96000Hz, s16le, rec 0:0, 16 blocks of 960 frames
app/aucat1.level=127 at 9 -> slot_level:aucat1: added
warning, device opened in play-only mode
1/output0.level=255 at 10 -> hw:1/0: added
1/output1.level=255 at 11 -> hw:1/1: added
1/output0.mute=0 at 12 -> hw:1/32: added
1/output1.mute=0 at 13 -> hw:1/33: added
snd1: 48000Hz, s16le, play 0:1, 16 blocks of 480 frames
snd2: device started
aucat0: attached at -7680 + 0/480
aucat0: 48000Hz, s24le4lsb, rec 0:1, 20 blocks of 480 frames
aucat1: 48000Hz, s24le4lsb, play 0:1, 20 blocks of 480 frames
snd1: device started
aucat1: attached at -7680 + 0/480
aucat0: detached at 0 + 0/960
snd2: device stopped
2/output.level=127 at 8 -> dev_master:2: removed
snd1: device stopped
snd1: software master level control enabled
1/output.level=127 at 10 -> dev_master:1: added
1/output.level=127 at 10 -> dev_master:1: removed


Courtney

On 6/2/23 02:39, Alexandre Ratchov wrote:
> On Thu, Jun 01, 2023 at 11:35:24AM -0700, Courtney Hicks wrote:
>> I hope this reaches you. I think my mail server is having troubles
>> communicating with the mailing list. I changed the rate and buffer
>> size using aucat, not sndiod, and that changed the rate. I have
>> the .wav attached. Also of note, I pasted the wrong aucat command
>> I ran. It should be
>>
>> $ aucat -f snd/1 -o - | aucat -i -
>> or
>> $ aucat -f snd/1 -o output.wav
>>
>> Courtney
>>
> To debug this, you really need to change sndiod options. There is
> buffering at every software (and hardware) layer and we need to tweak
> the uaudio(4) operating mode (I'm suspecting the driver, which is the
> only layer whick behavior depends on the hardware in use).
>
> To do so, I'd suggest to stop sndiod(8) and run in on a terminal with
> the '-dd' options. This allows to quickly tweak the device modes. Example:
>
> $ doas sndiod -dd -z 256 -f rsnd/1
> ^C
> $ doas sndiod -dd -z 320 -r 16000 -f rsnd/1
> ^C
> ...
>
> FWIW, you can see the hardware operating mode by running this command
> while the device is recording:
>
> $ doas audioctl -f /dev/audioctl1
> name=envy0
> mode=play,record
> pause=0
> active=1
> nblks=2
> blksz=240
> rate=48000
> encoding=s24le4msb
> play.channels=2
> play.bytes=5464320
> play.errors=0
> record.channels=2
> record.bytes=5464320
> record.errors=0
>
> Unless this shows what's going on, the next move will be to build a
> kernel with UAUDIO_DEBUG and see if there are warnings on the console.
>

No comments:

Post a Comment