Change the freq limit of speaker-test
PATCH 1/1 Change the freq limit of speaker-test
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.
Signature · 1 line
Anssi Hannula
Index: alsa-utils/speaker-test/speaker-test.c
===================================================================
RCS file: /cvsroot/alsa/alsa-utils/speaker-test/speaker-test.c,v retrieving revision 1.8
speaker-test/speaker-test.c +2 -2
@@ -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);
At Fri, 17 Jun 2005 21:14:48 +0300,
Quoted 6 lines · Anssi Hannula
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
Quoted 15 lines
ps. I'm not subscribed, CC me when replying.
Signature · 8 lines
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
speaker-test/speaker-test.c line 539
Quoted 10 lines
speaker-test/speaker-test.c +2
-2@@ -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
Quoted 6 lines · Takashi Iwai
At Fri, 17 Jun 2005 21:14:48 +0300,
Quoted 2 lines · Anssi Hannula
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.
Quoted 2 lines
Also,
atof()is better thanatoi()for freq since freq is a double.
OK, changed that. New patch attached.
Signature · 1 line
Anssi Hannula
Index: speaker-test/speaker-test.c
===================================================================
RCS file: /cvsroot/alsa/alsa-utils/speaker-test/speaker-test.c,v retrieving revision 1.8
speaker-test.c +3 -3
@@ -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);
At Tue, 21 Jun 2005 17:50:36 +0300,
Quoted 5 lines · Anssi Hannula
Quoted 3 lines · Takashi Iwai
At Fri, 17 Jun 2005 21:14:48 +0300,
Quoted 1 line · Anssi Hannula
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
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
Quoted 10 lines · Takashi Iwai
At Tue, 21 Jun 2005 17:50:36 +0300,
Quoted 7 lines · Anssi Hannula
Quoted 5 lines · Takashi Iwai
At Fri, 17 Jun 2005 21:14:48 +0300,
Quoted 1 line · Anssi Hannula
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).
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
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.
Signature · 9 lines
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
At Tue, 21 Jun 2005 18:14:55 +0300,
Quoted 22 lines · Anssi Hannula
Quoted 12 lines · Takashi Iwai
At Tue, 21 Jun 2005 17:50:36 +0300,
Quoted 9 lines · Anssi Hannula
Quoted 7 lines · Takashi Iwai
At Fri, 17 Jun 2005 21:14:48 +0300,
Quoted 3 lines · Anssi Hannula
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).
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
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.
Quoted 5 lines
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