At 192Khz sample rate clock runs at half speed recording speed doubled

When I record a jack stream at 192kHz rate the recording speed is doubled. That is when I play it back it plays at double speed. In addition, I have a clock display on the system and it shows that the recording time calculated by the -V switch is 1/2 the rate it should be. (e.g. 10 seconds wall clock is 5 seconds jack_capture -V clock)

If I use the jack_connect and connect the ports to other services the signal is correctly interpreted.

Experimentation reveals that the system is actually producing 96kHz.

Environment:

  • OS: Raspian
  • Uname -a: Linux cuimhne-bd4bc2f8 5.4.79-v7+ #1373 SMP Mon Nov 23 13:22:33 GMT 2020 armv7l GNU/Linux
  • Platform: Pi 3 A+
  • Soundcard: pisound
  • Jack start command: /usr/bin/jackd -t 2000 -R -P 95 -d alsa -d hw:pisound -r 192000 -p 1024 -n 2 -X seq -s (NOT using the systemctl mechanism)
  • Jack_capture command: jack_capture -V

I executed a timing of the capture and a snd-file info dump of the result. The wall clock agrees with the timing in that the 5 second recording took 10 seconds.

$ time jack_capture --disable-console -d 5 /recordings/5sec.wav
>>> Warning. Could not set higher priority for a SCHED_OTHER process using setpriority().
>>> 
>>> Recording to "/recordings/5sec.wav". The recording is going
>>> to last 5.000000 seconds Press <Ctrl-C> to stop before that.
>>> Please wait while writing all data to disk. (shouldn't take long)
Finished.

real	0m10.332s
user	0m0.269s
sys	0m0.185s

$ sndfile-info /tmp/5sec.wav

The results are:

sndfile-info /recordings/5sec.wav
========================================
File : /recordings/5sec.wav
Length : 7680088
RIFF : 7680080
WAVE
fmt  : 16
  Format        : 0x3 => WAVE_FORMAT_IEEE_FLOAT
  Channels      : 2
  Sample Rate   : 192000
  Block Align   : 8
  Bit Width     : 32
  Bytes/sec     : 1536000
fact : 4
  frames  : 960000
PEAK : 24
  version    : 1
  time stamp : 1610274863
    Ch   Position       Value
     0   0              0
     1   0              0
data : 7680000
End

----------------------------------------
Sample Rate : 192000
Frames      : 960000
Channels    : 2
Format      : 0x00010006
Sections    : 1
Seekable    : TRUE
Duration    : 00:00:05.000
Signal Max  : 0 (-inf dB)

Jack component versions

jack_capture --version
0.9.73

jackd --version
jackdmp version 1.9.12 tmpdir /dev/shm protocol 8

This information was originally provided in a jack_capture ticket: https://github.com/kmatheussen/jack_capture/issues/43
The result there was that Jack was reporting 192Khz but jack_capture was only receiving 96Khz from ALAS driver, so that ticket was closed an another opened with Jack (https://github.com/jackaudio/jack2/issues/702). However there is a belief that the issue is in the ALSA driver.

The output from PiSound sounds proper.

The path through the system is

guitar ----> pisound in ---> Jack ---> pisound out ---> amplifier
                                         |
                                         v
                                  jack_capture ---> disk

Hey, I couldn’t reproduce the jack_capture -d 5 taking 10 seconds, I had MODEP running, Jack set up with these settings:

/usr/bin/jackd -t 2000 -R -P 95 -d alsa -d hw:pisound -r 192000 -p 512 -n 3 -X seq -s -S

If you’d like to see what are the parameters currently enabled on Pisound, you can do so by printing this file (docs):

/proc/asound/card1/pcm0c/sub0/hw_params

You may have to edit the digits according to the aplay -l output.

$ cat /proc/asound/card1/pcm0c/sub0/hw_params
closed

same result for status and sw_params.

Please note that I am running -p 1024 -n 2

If you specify the paramaters as I listed above, and simply do the capture to send the input to the output on the pisound and then run jack_capture. The output of the jack_capture should show the problem.

Was jack turned off when you ran ‘cat’? Try running it while it is on, or maybe even when jack_capture is running.

Here’s what I tried now:

Jack is running like this: /usr/bin/jackd -t 2000 -R -P 95 -d alsa -d hw:pisound -r 192000 -p 1024 -n 2 -X seq -s -S

patch@patchbox:~ $ cat /proc/asound/card1/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 192000 (192000/1)
period_size: 1024
buffer_size: 2048
patch@patchbox:~ $ cat /proc/asound/card1/pcm0c/sub0/hw_params
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 192000 (192000/1)
period_size: 1024
buffer_size: 2048

patch@patchbox:~ $ jack_connect system:playback_1 system:capture_1
patch@patchbox:~ $ jack_connect system:playback_2 system:capture_2

patch@patchbox:~ $ jack_lsp -A
system:capture_1
   alsa_pcm:hw:pisound:out1
system:capture_2
   alsa_pcm:hw:pisound:out2
system:playback_1
   alsa_pcm:hw:pisound:in1
system:playback_2
   alsa_pcm:hw:pisound:in2
system:midi_capture_1
   alsa_pcm:Midi-Through/midi_playback_1
   Midi-Through:midi/playback_1
system:midi_playback_1
   alsa_pcm:Midi-Through/midi_capture_1
   Midi-Through:midi/capture_1
system:midi_capture_2
   alsa_pcm:pisound/midi_playback_1
   pisound:midi/playback_1
system:midi_playback_2
   alsa_pcm:pisound/midi_capture_1
   pisound:midi/capture_1
system:midi_capture_3
   alsa_pcm:MPK-mini/midi_playback_1
   MPK-mini:midi/playback_1
system:midi_playback_3
   alsa_pcm:MPK-mini/midi_capture_1
   MPK-mini:midi/capture_1
system:midi_capture_4
   alsa_pcm:pisound-ctl/midi_playback_1
   pisound-ctl:midi/playback_1
system:midi_playback_4
   alsa_pcm:pisound-ctl/midi_capture_1
   pisound-ctl:midi/capture_1
patch@patchbox:~ $ time jack_capture --disable-console -d 5
>>> Warning. Could not set higher priority for a SCHED_OTHER process using setpriority().
>>> Recording to "jack_capture_02.wav". The recording is going
>>> to last 5.000000 seconds Press <Ctrl-C> to stop before that.
>>> Please wait while writing all data to disk. (shouldn't take long)
Finished.

real    0m5.380s
user    0m0.001s
sys     0m0.414s
patch@patchbox:~ $ sndfile-info jack_capture_02.wav
========================================
File : jack_capture_02.wav
Length : 7680088
RIFF : 7680080
WAVE
fmt  : 16
  Format        : 0x3 => WAVE_FORMAT_IEEE_FLOAT
  Channels      : 2
  Sample Rate   : 192000
  Block Align   : 8
  Bit Width     : 32
  Bytes/sec     : 1536000
fact : 4
  frames  : 960000
PEAK : 24
  version    : 1
  time stamp : 1610377219
    Ch   Position       Value
     0   630978         0.00671407
     1   212809         0.00729392
data : 7680000
End

----------------------------------------
Sample Rate : 192000
Frames      : 960000
Channels    : 2
Format      : 0x00010006
Sections    : 1
Seekable    : TRUE
Duration    : 00:00:05.000
Signal Max  : 0.00729392 (-42.74 dB)

I don’t know what changed but I am unable to get the off speed recording anymore. If it should arise again I will attempt your request above. In the mean time I suppose this can be closed, or at least put on the back burner.

1 Like