Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is it me or Applet.play?

0 views
Skip to first unread message

David Segall

unread,
Aug 31, 2005, 11:15:16 AM8/31/05
to
I have written an applet, based on a couple of other applets on the
Internet, that plays DTMF tones from an input phone number.

My applet plays some, but not all, of the tones but there is no
individual tone that cannot be played. The two second sleep is more
than enough to play a tone and, in any case, the status message is
followed by silence sometimes. A simplified form of the play loop to
play numbers is shown below.

for (int i = 0; i < phoneCount; i++) {
appletParent.showStatus("Dial in progress ..." + sepPhone[i]);
appletParent.play(appletParent.getCodeBase( ),
"audio/"+sepPhone[i]+".au");
sleep(2000);
}

What should I look for in order to fix the problem?

Andrew Thompson

unread,
Aug 31, 2005, 11:23:19 AM8/31/05
to
On Wed, 31 Aug 2005 15:15:16 GMT, David Segall wrote:

> I have written an applet, ..

URL? Pleas link to (complete, short) code.
<http://www.physci.org/codes/sscce.jsp>

--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"Let us not talk falsely now, the hour is getting late."
Bob Dylan 'All Along The Watchtower'

Thomas Hawtin

unread,
Aug 31, 2005, 11:33:15 AM8/31/05
to

It's probably a bug. There have been problems with playing short sounds
(apparently, my machine doesn't have a sound card).

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6251460

The fixed version of J2SE 5.0 does not appear to be available quite yet.
Even when it is, not everyone is going to upgrade immediately. I believe
the usual workaround is to add silence to the end of the clip.

Tom Hawtin
--
Unemployed English Java programmer
http://jroller.com/page/tackline/

David Segall

unread,
Aug 31, 2005, 12:50:47 PM8/31/05
to
Andrew Thompson <SeeMy...@www.invalid> wrote:

>On Wed, 31 Aug 2005 15:15:16 GMT, David Segall wrote:
>
>> I have written an applet, ..
>
>URL? Pleas link to (complete, short) code.
><http://www.physci.org/codes/sscce.jsp>

If I could do this I would have. I don't have a suitable web site and,
as you can see from my code fragment, a post here would require at
least one binary which you would be the first to criticize. Are you
offering space at www.physci.org to post my problem?

The other difficulty with your advice to produce a "Short, Self
Contained, Correct (Compilable), Example" is that it requires a
thorough understanding of the problem. The advice is good in that it
will probably obviate the need for a post if the poster can do it. The
advice is useless in most circumstances because the poster cannot
isolate the problem to the extent that it is both short and self
contained.

Debugging is the art of asking the right questions and Usenet provides
an ideal environment for this. Post your sscce.jsp link as a way of
speeding up the process but, if you want to help, please also post a
short, self contained, question that elicits the information that is
missing from the original post.

Andrew Thompson

unread,
Aug 31, 2005, 12:58:04 PM8/31/05
to
On Wed, 31 Aug 2005 16:50:47 GMT, David Segall wrote:

> Andrew Thompson <SeeMy...@www.invalid> wrote:
>
>>On Wed, 31 Aug 2005 15:15:16 GMT, David Segall wrote:
>>
>>> I have written an applet, ..
>>
>>URL? Pleas link to (complete, short) code.
>><http://www.physci.org/codes/sscce.jsp>
> If I could do this I would have. I don't have a suitable web site

'GeoCities' +
<http://www.google.com/search?hl=en&q=free+"web+host"> ?

"If no one out there understands, start your own revolution and cut out the
middle man."
Billy Bragg 'Waiting For The Great Leap Forward'

Andrew Thompson

unread,
Aug 31, 2005, 12:59:50 PM8/31/05
to
On Wed, 31 Aug 2005 16:50:47 GMT, David Segall wrote:

> please also post a
> short, self contained, question that elicits the information that is
> missing from the original post.

<short enough for you?>
Can you provide the code that breaks?
</short enough for you?>

"Get off your f**kin cross. We need the f**kin space to nail the next fool
martyr."
Tool 'Eulogy'

Roedy Green

unread,
Aug 31, 2005, 5:00:19 PM8/31/05
to
On Wed, 31 Aug 2005 16:50:47 GMT, David Segall <da...@nowhere.net>
wrote or quoted :

>The
>advice is useless in most circumstances because the poster cannot
>isolate the problem to the extent that it is both short and self
>contained.

That is not quite true. Most of the time the user has made NO ATTEMPT
to do so. One of the reasons old timers are so big on SCCSE's in that
in creating them, novices often solve their own problems. It is a
powerful technique to isolate the problem -- to separate out the
factors that could and could not be the culprits.

There are two goals:

1. getting the problem solved

2. getting you to become a more competent, independent programmer,
perhaps one capable of helping others.

In presenting an SCCSE (or an explanation of why there is not one) to
the old timers, it proves the naive user has at least made an effort
to solve the problem and is not just playing Marilyn Monroe to get
gallants to do her homework.

If you present without one, you are not asking anyone to analyse your
problem, but merely to tell you of any gotchas in the general area you
may be unaware of, or to suggest a whack-on-the-side-of-the-head fresh
approaches to solving the problem. Usually only old timers want that
level of advice.

--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

David Segall

unread,
Sep 1, 2005, 4:52:41 AM9/1/05
to
Andrew Thompson <SeeMy...@www.invalid> wrote:

>On Wed, 31 Aug 2005 16:50:47 GMT, David Segall wrote:
>
>> please also post a
>> short, self contained, question that elicits the information that is
>> missing from the original post.
>
><short enough for you?>

Yes, but I did not think it was missing from the original post.


>Can you provide the code that breaks?

for (int i = 0; i < phoneCount; i++) {


appletParent.showStatus("Dial in progress ..." + sepPhone[i]);
appletParent.play(appletParent.getCodeBase( ),
"audio/"+sepPhone[i]+".au");
sleep(2000);
}

The code "works" to the extent the loop is executed for each digit in
the phone number and displays the digit in the status bar. It also
correctly plays any one digit phone number. However, it fails to play
all the digits in a longer phone number. I am using the 1.5_04 SDK.

David Segall

unread,
Sep 1, 2005, 4:55:00 AM9/1/05
to
Andrew Thompson <SeeMy...@www.invalid> wrote:

>On Wed, 31 Aug 2005 16:50:47 GMT, David Segall wrote:
>
>> Andrew Thompson <SeeMy...@www.invalid> wrote:
>>
>>>On Wed, 31 Aug 2005 15:15:16 GMT, David Segall wrote:
>>>
>>>> I have written an applet, ..
>>>
>>>URL? Pleas link to (complete, short) code.
>>><http://www.physci.org/codes/sscce.jsp>
>> If I could do this I would have. I don't have a suitable web site
>
>'GeoCities' +
><http://www.google.com/search?hl=en&q=free+"web+host"> ?

OK. I'll set something up for my next question.

David Segall

unread,
Sep 1, 2005, 9:10:10 AM9/1/05
to
Roedy Green <loo...@mindprod.com.invalid> wrote:

> but merely to tell you of any gotchas in the general area you
>may be unaware of, or to suggest a whack-on-the-side-of-the-head fresh
>approaches to solving the problem.

That's exactly what I want. Any ideas?

Stan

unread,
Sep 15, 2005, 10:30:34 AM9/15/05
to

I've never used sound in Java but I think I read something about
invokeLater...
this might help:
http://forum.java.sun.com/thread.jspa?threadID=585270&messageID=3006016

Stan Dickerson

Roedy Green

unread,
Sep 15, 2005, 10:11:22 PM9/15/05
to
On 15 Sep 2005 07:30:34 -0700, "Stan"
<engin...@energycontrolsystems.com> wrote or quoted :

>> That's exactly what I want. Any ideas?
>
>I've never used sound in Java but I think I read something about
>invokeLater...
>this might help:
>http://forum.java.sun.com/thread.jspa?threadID=585270&messageID=3006016

for generic advice about sound, see
http://mindprod.com/jgloss/sound.html

David Segall

unread,
Sep 16, 2005, 8:15:00 AM9/16/05
to
"Stan" <engin...@energycontrolsystems.com> wrote:

Thanks Stan. I think my problem is the one referenced by Tom Hawtin's
response - http://bugs.sun.com/bugdatabase/view...bug_id=6251460. I am
busy trying to publish my SSCCE
<http://www.physci.org/codes/sscce.jsp> to confirm it. The SSCCE
appears to work with JRE 1.4. Publication has been delayed because
first I need to set up a web site!

0 new messages