View Full Version : sound is intermittent
jnawrocki
02-22-2010, 03:41 PM
In my Alice world I have penguins singing short notes (.11 sec) when the penguin is clicked. Sometimes the notes play OK; other times the note doesn't play--it just makes a "pop" sound. Can anyone help.
The notes are .wav files.
Dameria
02-22-2010, 05:08 PM
Can you upload your world so we can see it? Maybe you made a mistake in your coding.
jnawrocki
02-23-2010, 04:42 PM
Yes, I will upload. It is named PenguinSimonV3.a2w
Thanks
Jane
Dameria
02-23-2010, 05:27 PM
Ok I'm sorry but I can't find anything wrong with your program. There is absolutely no reason that those penguins should be waiting a second between notes. Everything method for the penguins making a noise happen happens around a 0.2 second duration, and there is no wait code after them and no wait code after the clicking method. There must be some other error I am not aware of, but by what I see the penguins should play their notes as soon as you click the next one.
zonedabone
02-23-2010, 05:35 PM
As far as I remember, Alice has a queue for sound playing. Try waiting between notes.
Dameria
02-23-2010, 05:47 PM
Why would they put in a queue? So, no matter what, you cannot play 2 sounds within the same second?
zonedabone
02-23-2010, 06:14 PM
It wasn't made to hurt you. Sound just wasn't a very supported feature, and sound mixing gets very complicated. A queue was the easiest way to do it.:)
jediaction
02-23-2010, 06:16 PM
Yes, I will upload. It is named PenguinSimonV3.a2w
Thanks
Jane
I tried it and there is nothing wrong with it. I have to say change the code of "when clicked on" to "when pressed on"
Dameria
02-23-2010, 06:20 PM
jediaction, have you tried clicking on the penguins faster? If you click on two penguins, the second one will not play until about 1 second after the first one finishes, which is weird.
jediaction
02-23-2010, 06:28 PM
jediaction, have you tried clicking on the penguins faster? If you click on two penguins, the second one will not play until about 1 second after the first one finishes, which is weird.
Yes i noticed that but i realized it is just the way the event is made and how long the sound is
Dameria
02-23-2010, 06:33 PM
No, the whole reason why I was posting is because it is not how long the sound is. Even after the penguin is done moving and making the sound, there is a random 1 second wait that comes from nowhere and I was wondering where it came from. Then zonedabone told me it is because the sounds have a queue, so that is the reason.
jediaction
02-23-2010, 07:00 PM
I thought it would just be alices problem
zonedabone
02-24-2010, 05:01 PM
Actually, there might be some white noise as the tend of the file. I've no time to check, though. In fact, I don't know how to. Good luck!
Dameria
02-24-2010, 05:13 PM
No, the file is exactly 0.1-0.2 seconds long each of them. It is not white noise or the sound file would show that in the amount of seconds. Plus, the animation for the penguin to close their mouth comes AFTER the sound is finished playing, so white noise cannot be it. It must be what you suggested before.
jnawrocki
02-24-2010, 06:37 PM
Thank you everyone for all your suggestions. I'll keep working at the penguin game.
Dameria, would you mind if I used your Tic Tac Toe game as a way to interest students in a review. I will certainly give you credit for writing it and I will not change it. I would ask questions; if answered correctly, students can earn X or O.
Thanks
Jane
Dameria
02-24-2010, 06:51 PM
Are you kidding me? I would be thrilled if someone used one of my programs in their class.
I love it when people like my programs, please do use it! Thank you :)
x2495iiii
02-24-2010, 07:15 PM
I think I can fix the world, actually. Hold on a sec...
Dameria
02-24-2010, 07:19 PM
Dun du du dun! Super moderator to the rescue!!! :)
x2495iiii
02-24-2010, 08:00 PM
Alright, I got it to work. I noticed three speed problems.
1. The "For all in order..." method of comparison is efficient but slow. I replaced this with a do together containing an if/else if for each penguin, much less streamlined, but much faster.
2. If there's a possibility that the penguins could be singing notes at nearly the same time, with a delay so small that the first penguin that was clicked wouldn't be finished singing yet, the method must be changed in order to allow for this possibility. I changed it to set a boolean variable to true based on which penguin was clicked, then added an event for each penguin that activates when that boolean is set to true. This way, the sing method, having done it's job, can be called once more when it's changed the value of the variable.
3. The biggest problem, and probably the major reason behind the delays, was the "insert <item> at end of list" method. It was set to a duration of one second, not zero.
Here's the fixed product!
jediaction
02-24-2010, 08:55 PM
Alright, I got it to work. I noticed three speed problems.
1. The "For all in order..." method of comparison is efficient but slow. I replaced this with a do together containing an if/else if for each penguin, much less streamlined, but much faster.
2. If there's a possibility that the penguins could be singing notes at nearly the same time, with a delay so small that the first penguin that was clicked wouldn't be finished singing yet, the method must be changed in order to allow for this possibility. I changed it to set a boolean variable to true based on which penguin was clicked, then added an event for each penguin that activates when that boolean is set to true. This way, the sing method, having done it's job, can be called once more when it's changed the value of the variable.
3. The biggest problem, and probably the major reason behind the delays, was the "insert <item> at end of list" method. It was set to a duration of one second, not zero.
Here's the fixed product!
In the future i will be fixing these problems mroe. Im going for a moderator job. Im on Alice 16/7
jnawrocki
02-25-2010, 06:28 PM
Thank you so much, x2495iiii. Your changes make for a much nicer game.
Also, Dameria, thank you for your willingness to share your Tic Tac Toe game. My class will love it. I hope to use it on Monday.
Again, thank you to all who helped with my sound problems.
Jane
jediaction
02-25-2010, 08:45 PM
Your welcome. If i helped, cant remember