Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Odd sound issues - any tips?

Author
Message
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 15th Nov 2014 08:04
So on my Nexus 7 I keep having some weird sound issues.
Sometimes WAV files won't play, then suddenly they start playing.
Oftentimes music has crackles in it.
My wife has the same exact model Nexus 7 and no problems for her.
I don't have any sound/music issues with other apps.

WAV files are windows 16-bit PCM trimmed to have zero crossings in Audacity.
Audacity says they are 32-bit float, mono 22,050Hz when I load them up, but the only option is to save them as 16-bit PCM...
Bitrate ranges from 352 to 700kbps... 700 seems a bit high.
Ah I found the option to export to different bit compressions, maybe that is the problem?
I know I saw someone, I think Jim say what the best compression is for WAV files on mobile. Can someone share that with me?

As far as the M4A files go they appear to be 16 bit PCM at 44,100Hz when I load them up into Audacity. I could probably turn them into mono, but they sound really great with headphones. Is Audactiy telling me the right info on these files? It seems like there should be a utility to tell me more info about the format. Right click in Windows explorer doesn't yield much info.
Also, what's optimal for M4A?

I've been listening to the music for the app for a bit right now and it isn't crackling. It seems to start to happen after sounds have been loaded and played a bit... Is it possible that the WAV format I'm using is messing up the M4A playback?

So many questions!
Thanks for the help

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 15th Nov 2014 08:58
WAV files must be UNCOMPRESSED PCM data. What does my analysis tool say about them?

-- Jim - When is there going to be a release?
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 15th Nov 2014 09:35
16 bit uncompressed pcm. The old SoundRec from Vista does the job of converting perfectly, and works just fine in Windows 7/8 etc.

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 15th Nov 2014 09:46
Can you post an example or email it to me?

-- Jim - When is there going to be a release?
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 15th Nov 2014 10:28
Oops... I meant xp sound recorder (not Vista!). The filename is sndrec32.exe

Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 15th Nov 2014 11:41
Your tool says all of the WAV files are PCM, 1 channel, 16-bit, 22050hz. No stars by any of them.

So for some reason Audacity when it loads them just says they are 32-bit float. It probably handles the filters better when it is 32-bit float so it just uses the active file that way.

Audacity has worked great for me for years now. I know they are saved as Microsoft WAV 16-bit PCM which is uncompressed. I might just run them through again to see what happens.

There is no crackling on either of my Nexus 5's, my wife's Nexus 7, my HTC Droid Incredible 2, or my iPhone 3GS.
So there's just something in my Nexus 7 that is interfering with AGK's Android sound library and the M4A format that ends up overloading the sound processor. No idea what it could be.

AGK is using openAL, right?
Any one know of a game using an engine with openAL and M4A? That would be the easiest way to check.

At this point it is more of a curiosity than an actual issue.

Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 15th Nov 2014 12:25
You could try making a small app that plays each sound file one at a time and then several at one time, that way you can figure out if it's some sort of conflict or not.


Sean

Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 15th Nov 2014 12:27
I could but that would really help me compare to see if it is an AppGameKit engine issue or if it persists with other openAL engines.

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 15th Nov 2014 13:34
Unless things have changed, AppGameKit was NOT using OpenAL.

Try re-sampling to 8000 or 4410 and see what happens.

-- Jim - When is there going to be a release?
Native Tech
11
Years of Service
User Offline
Joined: 19th Jul 2013
Location:
Posted: 16th Nov 2014 02:30
Naphier I cant help directly with this issue , however I have attatched some AppGameKit source for manually reading in wave files , it may not be useful to u as I believe Jims app is better for testing wave forms , the reason I have attatched is because this is the source code where I was reading in bytes and getting slow read times , maybe if u guys have a chance to play around with it u might be able to find a way of reading in bytes faster as my method has me scratching my head.

Basically once compiled this app

will take a string to a wav file
open it for reading
test the header data
spit errors if the file being tested is showing compression
if it is a PCM file it will then make 2 memblocks
the entire file will get dumped into one memblock and then the data chunk (Raw Wave Samples) will be split from the first memblock and then put into the second one
it will then proceed to read each byte of the Raw Sample Data from the second memblock
here is where u may b able to find a faster method of testing bytes


its purely for test purposes and is incomplete as far as an app goes , but please take a look and maybe help me out here as I am definitely aware that AppGameKit is probably not the best tool for byte reading of this capacity , however I am using this to test the limits of AGK's power , and if possible I'll break the Wave data into an FFT for displaying the graphical representation of 16 bit PCM uncompressed wave data inside AppGameKit for mobile applications ..... this to me will test the power of AppGameKit and push it to the very limit as far as sounds and sound design apps go

Native Technology

Attachments

Login to view attachments
Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 16th Nov 2014 02:54
Quote: "but please take a look and maybe help me out here as I am definitely aware that AppGameKit is probably not the best tool for byte reading of this capacity"


Change:



To this:



Updating text and syncing take a long time, removing them significantly speeds up the reading process.


Sean

Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 16th Nov 2014 02:55
Neat idea. Are you thinking this method is slow? Because it is only slowed due to calling sync.
As I was just ninja'd by HockeyKid

Native Tech
11
Years of Service
User Offline
Joined: 19th Jul 2013
Location:
Posted: 16th Nov 2014 03:29
Aha thanks guys , how I let that small detail slip is beyond me , as I was only using the text and sync() call for testing , I somehow noticed the lack of speed but didnt even think that it would all go back to normal after removing sync() haha , it seems the smallest things make the biggest difference , also turns out that AppGameKit is more than capable of providing for my design , thanks guys

Native Technology
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 16th Nov 2014 03:50
I also limit sync calls when showing a loading animation and loading assets. Because sometimes you can load 20 images in less than a frame, but if you call sync() every image then no matter what you are bottlenecking yourself. Just something like
if lastSyncCallTime > (1/60) or lastSyncCallTime = 0
lastSyncCallTime = timer()
sync()
endif



JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 16th Nov 2014 10:21
The key factor with audio or video is, is it you who is selecting the files or the user? If it's you, I would pre-process as much as possible outside of AGK. That way you can make a file format optimised for your app. I would avoid byte-reads except for trivial cases.

An example is a musical instrument sample. We need to know:

sample frequency - probably 8000,16000, 44100
mono stereo
pitch in Hz - (for example A4 at concert pitch is 440 Hz
scale point - I use the 88-key piano scale. The lowest note is A0, which is 27.5 Hz. So this is scale point 1, and A1 is 12 semitones above it, or scale point 13.)

We may need to know whether it's tuneable or not, and if so, what is its range (typically +- 3 semitones. What are the modifying factors for each semitone in the +- s - These are different at different sample frequencies, so it's better to compute that elsewhere.

We may need attack, sustain (loop) and decay fragments, in which case we're better of creating 3 waveform chunks defined in our loader.

And so on... That simple WAV analyser took 12 minutes to program using Delphi. It would have a taken a lot longer in AppGameKit because there is no simple way to get folder information etc.

-- Jim - When is there going to be a release?
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 17th Nov 2014 03:37
I've tried some different sampling rates and tried 24-bit PCM for S&G... No changes.
Still the sounds play clear for the most part, but every so often they stop playing for a bit. The music continues to play, but gets crackly. Seems to happen when I get a notification on the device. It's like the handler for the notification sounds is crossing bits with the AppGameKit engine.
Only showing as a problem on this single device. All others are alright.
Not noticing the issue with non-AGK games.

What library does AppGameKit use to handle audio on Android?

It's not a big problem since I can't replicate on other devices, but it is an annoying mystery!

Native Tech
11
Years of Service
User Offline
Joined: 19th Jul 2013
Location:
Posted: 17th Nov 2014 09:45
when installing AppGameKit I noticed OpenGL installations and directx installations , maybe AppGameKit is using DirectSound? , I am unsure , either way the sound buffer I assume would be protected and at worst it sounds like the soundcard is mixing the two signals together possibly resulting in some data corruption?

Native Technology
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 17th Nov 2014 10:10
AGK uses DirectSound on PC. What it does on the other platforms I don't know.

-- Jim - When is there going to be a release?
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 19th Nov 2014 00:13
So it seems to be the M4A format for some strange reason.
The files themselves play beautifully on th edevice. Through AppGameKit they crackle. Also it only happens through the speakers. But the speakers are good when I play music via any other app. :/

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 19th Nov 2014 00:39
What happens if you convert to MP3?

-- Jim - When is there going to be a release?
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 19th Nov 2014 23:18
Hope to get a chance to try that soon.
Just updated to lollipop and the tablet is getting very glitchy. I'm probably going to do a full reset. I can hardly get a stable framerate anymore. Uninstalled some programs that I suspect were slowing it down and it only helped a little. Feels like Android is pulling a Microsoft move (pack the old devices with updates until they're so slow you need a new one).
Tried playing Field Runners and the music glitched out on that too. So it's not likely an AppGameKit issue, but really my tablet. Good for business, bad for me

Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 20th Nov 2014 09:38
OK so I went and re-exported the M4A files to a quality of 75 instead of 100 via Audacity. This changed the bitrate from 152 to 82. The sound now clicks a lot less. Still a little bit when the tablet gets busy with other stuff, but not nearly as bad and my frame rate isn't dropping as much either.
So that seems to be the key issue here is the bitrate + the processing power needed for the graphics is just too much for my N7 now.

Interesting that Netflix is just fine and I assume it is 700kbps on average.

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 20th Nov 2014 14:00
Processor use is quite interesting.

Delphi XE7 allows you to improve OpenGL performance by switching off things that are not needed. For example, if you are not using 3D you can switch off depth buffering etc.

These switches might be a good idea for AGK.

-- Jim - When is there going to be a release?
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 20th Nov 2014 20:11
I use
Update2D(0) : Render2DFront() : Swap()
Which apparently does similar.

Login to post a reply

Server time is: 2024-11-25 11:42:23
Your offset time is: 2024-11-25 11:42:23