Sounds Unreliable (solved)
by rennie moffat · in iTorque 2D · 01/27/2011 (10:23 pm) · 15 replies
I had posted on this earlier with little response however, I believe it is a major issue. Regarding non looping sounds, anything under 12 seconds (on my count) will always be distorted. This is major since 4 sounds, which should be a beep each, and thus, less then a second take up 16 MB.
Is anyone else finding iTGB sounds to be unreliable?
Is anyone else finding iTGB sounds to be unreliable?
About the author
My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.
#2
My files are wav. Tho I am using behaviors and not a file say audio.cs containing all descriptions and profiles. Does this make a difference?
01/28/2011 (5:33 am)
I don't quite understand what you are saying Marc.My files are wav. Tho I am using behaviors and not a file say audio.cs containing all descriptions and profiles. Does this make a difference?
#3
01/28/2011 (7:30 am)
@rennie - How are your audio datablocks set up. Can you give me an example from your code?
#4
In an owner I add these fields.
in onBehaviorAdd() I use this.
The sound is triggered when another object collides with this (above) owner.
I of course attach an audio description to one anonymous object in level. The code I use is direct from TDN with very little done to it minus adjusting volume and switching the description to NonLooping from Looping.
The problem is two fold....
1. the audio files must be longer in time length than the actual sound by 10 times (rough estimate, my tests have shown I need to have a sound (audio clip) that is 13 seconds long even if the actual sound it hold is 0.5 seconds.
2. the system I use, occasionally the sound is not triggered. Maybe because it (the audio file) is too long?
3. the wooshing static effect, that normally is only heard in iTGB, on your desktop, is currently now playing in my iPod too. I made some minor changes to the audio files, but never touched the code.
:s
Thanks Michael. I am interested in hearing your response.
Cheers
01/28/2011 (8:56 am)
Currently I am only using behaviors to run them, as I did in my last app., which worked fine, but I only used looping. NonLoopoing, seems to be the issue.In an owner I add these fields.
///audio %template.addBehaviorField( name, "Name for this audio profile", string , "tileC" ); %template.addBehaviorField( filename, "File name for the audio file in your data/audio directory.", string , "tileC.wav" ); %template.addBehaviorField( volume, "The default volume", float , 1.0 ); %template.addBehaviorField( description, "The Audio Description to use", string , "AudioNonLooping" );
in onBehaviorAdd() I use this.
if (!isObject( %this.name ) )
{
new AudioProfile( %this.name )
{
volume = %this.volume ;
filename = "~/data/audio/" @ %this.filename ;
description = %this.description;
};
}The sound is triggered when another object collides with this (above) owner.
alxPlay(%this.name);
I of course attach an audio description to one anonymous object in level. The code I use is direct from TDN with very little done to it minus adjusting volume and switching the description to NonLooping from Looping.
if (!isObject(AudioDescriptionBehavior))
{
%template = new BehaviorTemplate( AudioDescriptionBehavior );
%template.friendlyName = "Audio Description";
%template.behaviorType = "Audio";
%template.description = "Creates a new AudioDescription when this object is loaded.";
%template.addBehaviorField( name, "Name for this Audio Description", string , "AudioNonLooping" );
%template.addBehaviorField( volume, "Volume", float , 1.0 );
%template.addBehaviorField( isLooping, "Looping", bool , 0 );
%template.addBehaviorField( is3D, "3D", bool , 0 );
%template.addBehaviorField( isStreaming, "Streaming", bool , 0 );
%template.addBehaviorField( preload, "Preload", bool , 1 );
%template.addBehaviorField( type, "Channel ( 1 - 8 )", int , 1 );
}
function AudioDescriptionBehavior::onBehaviorAdd(%this){
if (!isobject( %this.name ) )
new AudioDescription( %this.name ) {
};
%this.name.volume = %this.volume ;
%this.name.isLooping = %this.isLooping;
%this.name.is3D = %this.is3D;
%this.name.isStreaming = %this.isStreaming ;
%this.name.preload = %this.preload ;
%this.name.type = %this.type;
}
function AudioDescriptionBehavior::onRemoveFromScene(%this){
}The problem is two fold....
1. the audio files must be longer in time length than the actual sound by 10 times (rough estimate, my tests have shown I need to have a sound (audio clip) that is 13 seconds long even if the actual sound it hold is 0.5 seconds.
2. the system I use, occasionally the sound is not triggered. Maybe because it (the audio file) is too long?
3. the wooshing static effect, that normally is only heard in iTGB, on your desktop, is currently now playing in my iPod too. I made some minor changes to the audio files, but never touched the code.
:s
Thanks Michael. I am interested in hearing your response.
Cheers
#5
01/30/2011 (1:42 pm)
Sorry to bump this but I am getting the static sound on my iDevice, the sounds dont play 100% of the time and the size is way to large. Any thoughts? Thanks.
#6
The only problem I have had with audio is some of the sounds just producing static on the Mac, on the iDevice they have always worked without any problem.
Sorry.
01/30/2011 (2:04 pm)
Rennie, I would like to help but I don't use behaviors and therefore the approach taken is completely different. The only problem I have had with audio is some of the sounds just producing static on the Mac, on the iDevice they have always worked without any problem.
Sorry.
#7
I actually just popped in an audioDatablock.cs
I think, underline I think it is playing a sound that was not playing before, now is, but now, on the device too I get the static.
:/
In theory, using that code, with
should work? Keep in mind, as of right now, I am calling the alxPlay, from a behavior. This is all very much, for something so little.
01/30/2011 (2:10 pm)
Scott, I actually just popped in an audioDatablock.cs
new AudioDescription(AudioNonLooping)
{
volume = 1.0;
isLooping= false;
is3D = false;
type = $GuiAudioType;
};
new AudioDescription(AudioLooping)
{
volume = 1.0;
isLooping= true;
is3D = false;
type = $GuiAudioType;
};
// --------------------------------------------------------------------
// clearedLevel
// --------------------------------------------------------------------
new AudioProfile(clearedLevel)
{
filename = "~/data/audio/clearedLevel.wav";
description = "AudioNonLooping";
preload = true;
};
// --------------------------------------------------------------------
// tileA
// --------------------------------------------------------------------
new AudioProfile(tileA)
{
filename = "../data/audio/tileA.wav";
description = "AudioNonLooping";
preload = true;
};I think, underline I think it is playing a sound that was not playing before, now is, but now, on the device too I get the static.
:/
In theory, using that code, with
alxPlay(tileA);
should work? Keep in mind, as of right now, I am calling the alxPlay, from a behavior. This is all very much, for something so little.
#8
:?
01/30/2011 (5:38 pm)
Yes, so that code is calling the sound I want, but I AM getting static sounds for my audio on my device.:?
#9
;/
01/31/2011 (1:15 pm)
Not to be a jerk, but this sounds is really jerking me around. It still sounds staticy on my device.;/
#10
2. I have never tried dynamic creation of AudioProfiles. My gut instinct based on a few years of Torque work is that this could be the core problem. Have you tried just creating the AudioProfile and AudioDescriptions as static objects executed during game startup, then playing the audio?
3. Short audio waves work in all my sample projects. The only other thing I can think of is that the sound is playing way too fast for the audio channel to handle. In Torque 2D, a sample project called Reactor makes heavy use of playing audio across multiple audio channels so there is no garbling and static. If the dynamic creation of an AudioProfile is not the problem, you are going to have to try to utilize multiple audio channels instead.
Start with #2, then get back to us.
01/31/2011 (9:05 pm)
1. The static you hear on OSX is not related to your problem at all. I fixed this for 1.4.1 and the problems are completely different.2. I have never tried dynamic creation of AudioProfiles. My gut instinct based on a few years of Torque work is that this could be the core problem. Have you tried just creating the AudioProfile and AudioDescriptions as static objects executed during game startup, then playing the audio?
3. Short audio waves work in all my sample projects. The only other thing I can think of is that the sound is playing way too fast for the audio channel to handle. In Torque 2D, a sample project called Reactor makes heavy use of playing audio across multiple audio channels so there is no garbling and static. If the dynamic creation of an AudioProfile is not the problem, you are going to have to try to utilize multiple audio channels instead.
Start with #2, then get back to us.
#11
I am triggering one sound, from many owners in relatively rapid succession so that might be a factor.
:?
Using multiple channels is a thought but seems a bit inconvenient. Just cumbersome really.
And I will look into shortening the sounds. Maybe the rapid succession (sound triggered) and the long length causing the garble.
:?
Anyhow, thanks will keep you posted.
01/31/2011 (9:47 pm)
I have tried 2. I use it to call my clearedLevel and it works, of course but it plays static in the device.I am triggering one sound, from many owners in relatively rapid succession so that might be a factor.
:?
Using multiple channels is a thought but seems a bit inconvenient. Just cumbersome really.
And I will look into shortening the sounds. Maybe the rapid succession (sound triggered) and the long length causing the garble.
:?
Anyhow, thanks will keep you posted.
#12
02/01/2011 (10:46 am)
Thanks, all seems to be working well now. Can't really explain why. Tho I did shrink the audio down. anyhow. Thanks.
#13
I have a mac and the audio is nothing but static on all sounds. When I run the same code/audio files as a T2D project, they play fine, only as an iTorque they are static.
I even recorded one sound from my iPhone and when played in iTorque are static. How can I fix this?
02/05/2011 (8:13 am)
What did you do to get this working?I have a mac and the audio is nothing but static on all sounds. When I run the same code/audio files as a T2D project, they play fine, only as an iTorque they are static.
I even recorded one sound from my iPhone and when played in iTorque are static. How can I fix this?
#14
02/05/2011 (8:22 am)
David - audio doesn't work properly on the Mac in iT2D 1.4 - it does work on the device though. This should be fixed in 1.4.1
#15
02/05/2011 (10:35 am)
Awesome, thanks
Torque 3D Owner Marc Dreamora Schaerer
Gayasoft
would go that way, going with compressed does not lend itself to run in parallel, performant and without interferance