Topic: Calling all Linux (ALSA) users!

Ladies and gentlemen, I have somehow stumbled across a strange
thing in my explorations of the Multiface 2.  There exists a
simple tool in the alsa-utils called "speaker-test" which
you may have already used before.  If you haven't, it is just
a "command-line speaker test tone generator for ALSA" which
"generates a tone that can be used to test the speakers of a
computer."  (Man page http://linux.die.net/man/1/speaker-test)

For some reason, I decided I would run a series of test tones
of increasing frequency through the Multiface 2.  I just made
a quick script that would run the same command in a loop each
time bumping the frequency up 1 Hz.  Started at 40 Hz, so it
was just 40 Hz, 41 Hz, 42 Hz... and ended at 60 Hz.  Simple
enough, right?

Well, for some reason things didn't go as planned and all test
tones below 50 Hz were somehow altered play at 50 Hz.  Let me
put it another way: all of the 40-49 Hz tones that were requested,
were all played back at 50 Hz.  Once the frequency value in the
script got above 50 Hz, things went normally and it played a
51 Hz tone, a 52 Hz tone, etc.  (This may be easier to understand
by looking at the output from the script pasted below.)

So, I'm scratching my head.  I'm wondering if the Multiface 2
could somehow be implicated, but that doesn't make any sense
since the specs have the frequency response rated down to
5 Hz (and the last time I checked 5 < 50).

Could this be a a built-in limitation of ALSA and/or the
speaker-test utility?  Hard to imagine, but possible I suppose.
Unfortunately, speaker-test doesn't have a verbose or debugging
option so I couldn't coax much information out of it.  I suppose
the next step would be to trace the system calls and then maybe
look over the speaker-test source code after that, but I thought
I'd check here first.

If you are a Linux user, would you mind please run this command
on your box and report back what results you obtained?

/usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 40 --nloops 1

Thanks very much!





luser@dawbox:~>
luser@dawbox:~>
luser@dawbox:~>
luser@dawbox:~>
luser@dawbox:~>
luser@dawbox:~> ./myspeaker-test.sh


Frequency is: 40 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 40 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 50.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.811834


Frequency is: 41 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 41 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 50.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.814871


Frequency is: 42 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 42 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 50.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.813361


Frequency is: 43 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 43 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 50.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.811889


Frequency is: 44 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 44 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 50.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.811520


Frequency is: 45 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 45 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 50.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.812000


Frequency is: 46 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 46 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 50.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.811633


Frequency is: 47 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 47 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 50.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.811498


Frequency is: 48 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 48 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 50.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.811774


Frequency is: 49 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 49 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 50.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.811662


Frequency is: 50 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 50 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 50.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.811806


Frequency is: 51 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 51 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 51.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.811549


Frequency is: 52 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 52 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 52.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.811861


Frequency is: 53 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 53 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 53.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.811703


Frequency is: 54 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 54 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 54.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.811889


Frequency is: 55 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 55 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 55.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.811936


Frequency is: 56 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 56 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 56.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.811784


Frequency is: 57 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 57 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 57.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.811751


Frequency is: 58 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 58 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 58.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.811555


Frequency is: 59 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 59 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 59.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.811635


Frequency is: 60 Hz
  Command is: /usr/bin/speaker-test --channels 2 --rate 48000 --test sine --frequency 60 --nloops 1

speaker-test 1.0.14rc1

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 60.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 8192
Period size range from 64 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 4096
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 5.811713
luser@dawbox:~>
luser@dawbox:~>
luser@dawbox:~>
luser@dawbox:~>
luser@dawbox:~>

Re: Calling all Linux (ALSA) users!

Does the same on my system through the onboard sound card.  Looks to be a limitation of the app.

Re: Calling all Linux (ALSA) users!

kws wrote:

Does the same on my system through the onboard sound card.  Looks to be a limitation of the app.

thank you, kws!   :-D

you are indeed correct.  upon reading your post, i fetched the alsa-utils
tarball from alsa-project.org, scanned through speaker-test.c and found
the culprit.  not sure why, but for some reason the author decided to
hard code limits on the tone frequency you can request:

    case 'f':
      freq = atoi(optarg);
      freq = freq < 50 ? 50 : freq;
      freq = freq > 5000 ? 5000 : freq;
      break;

easy enough to change and re-compile i guess, but i'm not really interested
in doing that at the moment.  my main concern was being able to identify
the source of the limitation in order to know where the problem was.

all is well!  cool