All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Change the freq limit of speaker-test
@ 2005-06-17 18:14 Anssi Hannula
  2005-06-21 11:03 ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Anssi Hannula @ 2005-06-17 18:14 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 281 bytes --]

Hi!

I noticed that the speaker-test has limited sine wave frequency to 
50-5000 Hz. Attached patch changes that to 0-24575Hz (that's the limit 
at least here (x86-64) after which the freq would roll over to 0 Hz).

ps. I'm not subscribed, CC me when replying.

-- 
Anssi Hannula


[-- Attachment #2: speaker-test_changelimits.diff --]
[-- Type: text/x-patch, Size: 672 bytes --]

Index: alsa-utils/speaker-test/speaker-test.c
===================================================================
RCS file: /cvsroot/alsa/alsa-utils/speaker-test/speaker-test.c,v
retrieving revision 1.8
diff -u -r1.8 speaker-test.c
--- alsa-utils/speaker-test/speaker-test.c	3 May 2005 18:36:08 -0000	1.8
+++ alsa-utils/speaker-test/speaker-test.c	17 Jun 2005 18:07:34 -0000
@@ -532,8 +532,8 @@
       break;
     case 'f':
       freq = atoi(optarg);
-      freq = freq < 50 ? 50 : freq;
-      freq = freq > 5000 ? 5000 : freq;
+      freq = freq < 0 ? 0 : freq;
+      freq = freq > 24575 ? 24575 : freq;
       break;
     case 'b':
       buffer_time = atoi(optarg);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Change the freq limit of speaker-test
  2005-06-17 18:14 [PATCH] Change the freq limit of speaker-test Anssi Hannula
@ 2005-06-21 11:03 ` Takashi Iwai
  2005-06-21 14:50   ` Anssi Hannula
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2005-06-21 11:03 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: alsa-devel

At Fri, 17 Jun 2005 21:14:48 +0300,
Anssi Hannula wrote:
> 
> Hi!
> 
> I noticed that the speaker-test has limited sine wave frequency to 
> 50-5000 Hz. Attached patch changes that to 0-24575Hz (that's the limit 
> at least here (x86-64) after which the freq would roll over to 0 Hz).

Does freq=0 really work?  I think this will result in zero-division.
I'm not sure which max value is reasonable...

Also, atof() is better than atoi() for freq since freq is a double.


Takashi


> 
> ps. I'm not subscribed, CC me when replying.
> 
> -- 
> Anssi Hannula
> 
> [2 speaker-test_changelimits.diff <text/x-patch (7bit)>]
> Index: alsa-utils/speaker-test/speaker-test.c
> ===================================================================
> RCS file: /cvsroot/alsa/alsa-utils/speaker-test/speaker-test.c,v
> retrieving revision 1.8
> diff -u -r1.8 speaker-test.c
> --- alsa-utils/speaker-test/speaker-test.c	3 May 2005 18:36:08 -0000	1.8
> +++ alsa-utils/speaker-test/speaker-test.c	17 Jun 2005 18:07:34 -0000
> @@ -532,8 +532,8 @@
>        break;
>      case 'f':
>        freq = atoi(optarg);
> -      freq = freq < 50 ? 50 : freq;
> -      freq = freq > 5000 ? 5000 : freq;
> +      freq = freq < 0 ? 0 : freq;
> +      freq = freq > 24575 ? 24575 : freq;
>        break;
>      case 'b':
>        buffer_time = atoi(optarg);


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Change the freq limit of speaker-test
  2005-06-21 11:03 ` Takashi Iwai
@ 2005-06-21 14:50   ` Anssi Hannula
  2005-06-21 15:08     ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Anssi Hannula @ 2005-06-21 14:50 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 577 bytes --]

Takashi Iwai wrote:
> At Fri, 17 Jun 2005 21:14:48 +0300,
> Anssi Hannula wrote:
>>
>>I noticed that the speaker-test has limited sine wave frequency to 
>>50-5000 Hz. Attached patch changes that to 0-24575Hz (that's the limit 
>>at least here (x86-64) after which the freq would roll over to 0 Hz).
> 
> Does freq=0 really work?  I think this will result in zero-division.

Well, it produces the expected output (no sound) and does not crash.

> Also, atof() is better than atoi() for freq since freq is a double.
> 

OK, changed that. New patch attached.

-- 
Anssi Hannula


[-- Attachment #2: speaker-test_changelimits-atof.diff --]
[-- Type: text/x-patch, Size: 720 bytes --]

Index: speaker-test/speaker-test.c
===================================================================
RCS file: /cvsroot/alsa/alsa-utils/speaker-test/speaker-test.c,v
retrieving revision 1.8
diff -u -r1.8 speaker-test.c
--- speaker-test/speaker-test.c	3 May 2005 18:36:08 -0000	1.8
+++ speaker-test/speaker-test.c	21 Jun 2005 14:44:01 -0000
@@ -531,9 +531,9 @@
       channels = channels > 1024 ? 1024 : channels;
       break;
     case 'f':
-      freq = atoi(optarg);
-      freq = freq < 50 ? 50 : freq;
-      freq = freq > 5000 ? 5000 : freq;
+      freq = atof(optarg);
+      freq = freq < 0 ? 0 : freq;
+      freq = freq > 24575 ? 24575 : freq;
       break;
     case 'b':
       buffer_time = atoi(optarg);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Change the freq limit of speaker-test
  2005-06-21 14:50   ` Anssi Hannula
@ 2005-06-21 15:08     ` Takashi Iwai
  2005-06-21 15:14       ` Anssi Hannula
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2005-06-21 15:08 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: alsa-devel

At Tue, 21 Jun 2005 17:50:36 +0300,
Anssi Hannula wrote:
> 
> Takashi Iwai wrote:
> > At Fri, 17 Jun 2005 21:14:48 +0300,
> > Anssi Hannula wrote:
> >>
> >>I noticed that the speaker-test has limited sine wave frequency to 
> >>50-5000 Hz. Attached patch changes that to 0-24575Hz (that's the limit 
> >>at least here (x86-64) after which the freq would roll over to 0 Hz).
> > 
> > Does freq=0 really work?  I think this will result in zero-division.
> 
> Well, it produces the expected output (no sound) and does not crash.

Strange.  Anyway, accepting freq = 0 doesn't make sense.
I think we should keep reasonalbe minimal/maximal values to produce
tones.


Takashi


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Change the freq limit of speaker-test
  2005-06-21 15:08     ` Takashi Iwai
@ 2005-06-21 15:14       ` Anssi Hannula
  2005-06-21 15:26         ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Anssi Hannula @ 2005-06-21 15:14 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

Takashi Iwai wrote:
> At Tue, 21 Jun 2005 17:50:36 +0300,
> Anssi Hannula wrote:
> 
>>Takashi Iwai wrote:
>>
>>>At Fri, 17 Jun 2005 21:14:48 +0300,
>>>Anssi Hannula wrote:
>>>
>>>>I noticed that the speaker-test has limited sine wave frequency to 
>>>>50-5000 Hz. Attached patch changes that to 0-24575Hz (that's the limit 
>>>>at least here (x86-64) after which the freq would roll over to 0 Hz).
>>>
>>>Does freq=0 really work?  I think this will result in zero-division.
>>
>>Well, it produces the expected output (no sound) and does not crash.
> 
> Strange.  Anyway, accepting freq = 0 doesn't make sense.
> I think we should keep reasonalbe minimal/maximal values to produce
> tones.

I understand that 0 doesn't make any sense.
But I think we should still change the limits, so that users can 
experiment things and test their hardware (someone asked for tone 
generator in VDR ml, I replied with speaker-test, but it didn't produce 
high enough tones) etc, and it wouldn't hurt.

-- 
Anssi Hannula



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Change the freq limit of speaker-test
  2005-06-21 15:14       ` Anssi Hannula
@ 2005-06-21 15:26         ` Takashi Iwai
  0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2005-06-21 15:26 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: alsa-devel

At Tue, 21 Jun 2005 18:14:55 +0300,
Anssi Hannula wrote:
> 
> Takashi Iwai wrote:
> > At Tue, 21 Jun 2005 17:50:36 +0300,
> > Anssi Hannula wrote:
> > 
> >>Takashi Iwai wrote:
> >>
> >>>At Fri, 17 Jun 2005 21:14:48 +0300,
> >>>Anssi Hannula wrote:
> >>>
> >>>>I noticed that the speaker-test has limited sine wave frequency to 
> >>>>50-5000 Hz. Attached patch changes that to 0-24575Hz (that's the limit 
> >>>>at least here (x86-64) after which the freq would roll over to 0 Hz).
> >>>
> >>>Does freq=0 really work?  I think this will result in zero-division.
> >>
> >>Well, it produces the expected output (no sound) and does not crash.
> > 
> > Strange.  Anyway, accepting freq = 0 doesn't make sense.
> > I think we should keep reasonalbe minimal/maximal values to produce
> > tones.
> 
> I understand that 0 doesn't make any sense.
> But I think we should still change the limits, so that users can 
> experiment things and test their hardware (someone asked for tone 
> generator in VDR ml, I replied with speaker-test, but it didn't produce 
> high enough tones) etc, and it wouldn't hurt.

Well, it's a question "what is reasonable".  I see the advantage of
having extreme values, too.  But 0 is not, at least...


Takashi


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-06-21 15:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-17 18:14 [PATCH] Change the freq limit of speaker-test Anssi Hannula
2005-06-21 11:03 ` Takashi Iwai
2005-06-21 14:50   ` Anssi Hannula
2005-06-21 15:08     ` Takashi Iwai
2005-06-21 15:14       ` Anssi Hannula
2005-06-21 15:26         ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.