Author Topic: [SoundSystem] Sound Loaded From ByteBuffer Has Audible Artifacts  (Read 1757 times)

Offline orange451

  • bit
  • Posts: 4
    • View Profile
[SoundSystem] Sound Loaded From ByteBuffer Has Audible Artifacts
« on: December 12, 2014, 11:49:40 PM »
Hello!

In my current Java project, I am attempting to load a sound file (.wav). This is how it is being done:
newbielink:http://pastebin.com/z2WcbWq1 [nonactive]

This works! And to execute a sound, I simply call:
Code: newbielink:javascript:void(0); [nonactive]
soundSystem.quickPlay( false, soundName, false, 0, 0, 0, SoundSystemConfig.ATTENUATION_ROLLOFF, SoundSystemConfig.getDefaultRolloff() );
However this also produces some audible artifacts. Sometimes I hear a quick cracking sound (before/after the sound). What would cause this?

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3473
  • Developer
    • View Profile
    • PaulsCode.Com
Re: [SoundSystem] Sound Loaded From ByteBuffer Has Audible Artifacts
« Reply #1 on: December 13, 2014, 08:16:29 AM »
My first thought is a problem with endianness.  Take a look at the convertAudioBytes and reverseBytes functions in CodecJOgg.java.  Although with these, I would expect to hear artifacts throughout playback (one issue, I think with two-byte swapped stereo, would exhibit ear-splitting screeching during playback).  It could be that the particular audio file is such that the problem is only evident audibly at the beginning and end (worth a try anyhow-- just play around with those methods to see if it has any effect on the artifacts).
« Last Edit: December 13, 2014, 08:22:55 AM by Paul »
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline Paul

  • Administrator
  • double
  • *****
  • Posts: 3473
  • Developer
    • View Profile
    • PaulsCode.Com
Re: [SoundSystem] Sound Loaded From ByteBuffer Has Audible Artifacts
« Reply #2 on: December 13, 2014, 08:27:05 AM »
Re-reading your post, the cracking sound is it like a single pop?  If so, what you could be experiencing is the fact that one of the Library implementations (I think LibraryJavaSound, but can't remember) has an issue where the first split-second of audio playback is at full volume, then it switched back quickly to the correct volume.  Because the length of time is so short, this audibly sounds like a speaker pop.  If that is the problem, a workaround might be to insert like 10 milliseconds of silence to the front-end of the sound if you are able to edit it.
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline orange451

  • bit
  • Posts: 4
    • View Profile
Re: [SoundSystem] Sound Loaded From ByteBuffer Has Audible Artifacts
« Reply #3 on: December 13, 2014, 12:20:41 PM »
I will try adding a 10 ms of silence before each sound. Lets hope for the best! :)