Sound issues in game speed J2ME - audio

When background sound is being played in game,the game speed is slightly low when compared to game without sound.. How to resolve this issue? The code which is been used for sound is as follows..
menusound = Manager.createPlayer(inputstream, "audio/midi");
menusound.realize();
menusound.setLoopCount(-1);
menusound.start();

Related

Speed up playback of a video with a video editor

Recently, I discover that my tutorial videos could be seen at 1.5x playback speed without losses in quality (they are actually better to see, as I normally speak slowly). My problem is that if I change the speed of the video when using a video editor, like Kdenlive, the audio becomes distorted and turns into a mess (higher pitch, I believe).
How could I obtain the same quality as VLC "playback fast" and Youtube "playback speed 1.5" for the audio track? I'm a layman in audio/video editing, so I'm also satisfied with partial answers, like the identification of which terms I should search for in this case.
It might be better to take your audio track and use something like Sound Forge to automatically remove silence. Just be sure to add a pad to that (built into sound forge) otherwise the speech will sound way to chopped and fast.
Aside from that, you could also use Vegas to (then) chop the video to keep pace with your new speech rate. Vegas is a video editing program that is best for this kind of down and dirty editing.

Multiple enemies with their own audio sources and clips makes my game's audio lag

I'm making a game that will have tons of enemies in one scene and each of them has their own Audio Source and Clips.
My issue is, when they all start to stack around me and shoots me, the audio lags so much. The background music is cutting off, my shooting sfx is cutting off, explosion sfx is cutting off, etc...
Basically what's going on is that there's like 50+ audios playing at the same time and the sound breaks :/.
I'm using the PlayOneShot function on everything, btw.
What's the best way to handle game audio in terms of having multiple audio sources and clips at the same time?
Well, technically you won't need everyone of them to have an audioclip, especially if they're the same kind; and double especially if there's a huge mass of them. Maybe use SetActive(true/false) to turn some on and if there's (x) amount surrounding the player, SetActive to false for a majority of them.

setFrequency in FMOD doesn't work satisfactorily

I'm trying to use FMOD to develop an application that is expected to be able to play audio more slowly than normal so that the user could hear the audio more clearly. In my code, I called Channel::setFrequency like this:
float normal_frequency;
channel->getFrequency(&normal_frequency);
channel->setFrequency(normal_frequency * speedSelected);
If the value of speedSelected is lower than 1, for example 0.8, the audio will indeed be played more slowly than normal, but the voice sounds really odd. Playing slowly doesn't enable me to hear audio more clearly at all.
By contrast, Microsoft's Windows Media Player works perfectly when it plays audio more slowly than normal.
Is there a way to solve this problem?
If by "sounds really odd" you mean the pitch has been altered then this is the expected outcome. If you want to correct the pitch while adjusting the speed you will need to use the pitch shifter DSP.

XNA , Monogame ; Is there an alternative to XACT?

I'm making a game in XNA... I havent looked at monogame yet but I'm conscious that I probably will be looking at it in the future..
I havent implemented sounds in my game yet.. Atmosphere is very imprtant in this game so different reverb and delay on the sounds in different rooms is important.
I could use XACT to do this dynamically, however I know XACT is not supported by Monogame
Is there something else I could look at??
What I could do is record 3 versions of each sound effect with little, medium and high reverb and just play different ones depending on what room you are in.. I think this would work ok and I'm assuming with less real-time audio processing going on it will be lighter on CPU.
This is an old question, but I think it still needs an appropriate answer for the one who are looking for an answer.
For sound in Monogame, you can use SoundEffect or MediaPlayer classes to play audio.
Example for SoundEffect class:
Declaration: SoundEffect soundEffect;
In LoadContent(): soundEffect= Content.Load<SoundEffect>("sound_title");
In wherever you want to play this sound: soundEffect.Play();
Example for SoundEffectInstances class (using SoundEffect that created above):
SoundEffectInstance soundEffectInstance = effect.CreateInstance();
soundEffectInstance.Play();
Then you can stop the soundeffect from playing whenever you want by using: soundEffectInstance.Stop();
Example for MediaPlayer class (best for background music):
In LoadContent():
Song song = Content.Load<Song>("song_title");
MediaPlayer.Play(song);
Hope this helps!

2D platformers: why make the physics dependent on the framerate?

"Super Meat Boy" is a difficult platformer that recently came out for PC, requiring exceptional control and pixel-perfect jumping. The physics code in the game is dependent on the framerate, which is locked to 60fps; this means that if your computer can't run the game at full speed, the physics will go insane, causing (among other things) your character to run slower and fall through the ground. Furthermore, if vsync is off, the game runs extremely fast.
Could those experienced with 2D game programming help explain why the game was coded this way? Wouldn't a physics loop running at a constant rate be a better solution? (Actually, I think a physics loop is used for parts of the game, since some of the entities continue to move normally regardless of the framerate. Your character, on the other hand, runs exactly [fps/60] as fast.)
What bothers me about this implementation is the loss of abstraction between the game engine and the graphics rendering, which depends on system-specific things like the monitor, graphics card, and CPU. If, for whatever reason, your computer can't handle vsync, or can't run the game at exactly 60fps, it'll break spectacularly. Why should the rendering step in any way influence the physics calculations? (Most games nowadays would either slow down the game or skip frames.) On the other hand, I understand that old-school platformers on the NES and SNES depended on a fixed framerate for much of their control and physics. Why is this, and would it be possible to create a patformer in that vein without having the framerate dependency? Is there necessarily a loss of precision if you separate the graphics rendering from the rest of the engine?
Thank you, and sorry if the question was confusing.
There are no reasons why physics should depend on the framerate and this is clearly a bad design.
I've once tried to understand why people do this. I did a code review for a game written by another team in the company, and I didn't see it from the beginning but they used a lot of hardcoded value of 17 in their code. When I ran the game on debug mode with the FPS shown, I saw it, FPS was exactly 17! I look over the code again and now it's clear: the programmers assumed that the game will always have a 17 FPS constant frame rate. If the FPS was greater than 17, they did a sleep to make the FPS be exactly 17. Of course, they did nothing if the FPS was smaller than 17 the game just went crazy (like when played at 2 FPS and driving a car in the game, the game system alerted me: "Too Fast! Too Fast!").
So I write an email asking why they hardcoded this value and use it their physics engine and they replied that this way they keep the engine simpler. And i replied again, Ok, but if we run the game on a device that is incapable of 17 FPS, your game engine runs very funny but not as expected. And they said that will fix the issue until the next code review.
After 3 or 4 weeks I get a new version of the source code so I was really curious to find out what they did with the FPS constant so first thing i do is search through code after 17 and there are only a couple matches, but one of them was not something i wanted to see:
final static int FPS = 17;
So they removed all the hardcoded 17 value from all the code and used the FPS constant instead. And their motivation: now if I need to put the game on a device that can only do 10 FPS, all i need to do is to set that FPS constant to 10 and the game will work smooth.
In conclusion, sorry for writing such a long message, but I wanted to emphasize that the only reason why anyone will do such a thing is the bad design.
Here's a good explanation on why your timestep should be kept constant: http://gafferongames.com/game-physics/fix-your-timestep/
Additionally, depending on the physics engine, the system may get unstable when the timestep changes. This is because some of the data that is cached between frames is timestep-dependant. For example, the starting guess for an iterative solver (which is how constraints are solved) may be far off from the answer. I know this is true for Havok (the physics engine used by many commericial games), but I'm not sure which engine SMB uses.
There was also an article in Game Developer Magazine a few months ago, illustrating how a jump with the same initial velocity but different timesteps was achieved different max heights with different frame rates. There was a supporting anecdote from a game (Tony Hawk?) where a certain jump could be made when running on the NTSC version of the game but not the PAL version (since the framerates are different). Sorry I can't find the issue at the moment, but I can try to dig it up later if you want.
They probably needed to get the game done quickly enough and decided that they would cover sufficient user base with the current implementation.
Now, it's not really that hard to retrofit independence, if you think about it during development, but I suppose they could go down some steep holes.
I think it's unnecessary, and I've seen it before (some early 3d-hw game used the same thing, where the game went faster if you looked at the sky, and slower if you looked at the ground).
It just sucks. Bug the developers about it and hope that they patch it, if they can.

Resources