AudioTrack distortion - where am I going wrong? :)

All your problems with Audio, Video and Images.

AudioTrack distortion - where am I going wrong? :)

Postby lavaburn » Fri Oct 30, 2009 1:55 pm

Hi guys!

I am very new to Java and programming in general and am trying - just for fun - to code a small music player for Android that can play XM, S3M, and Protracker modules, such as those found on :)

I am trying to use a java library called IBXM - Integer Based XM library.

My code is extremely messy as I'm trying all sorts of messing about trying to get the audio generated from IBXM to the AudioTrack class properly. All I'm trying to do for now is get some decent audio.

My problem is that I'm getting a lot of static from both emulator and phone, and can't seem to get a clean stream. You can barely hear something that vaguely resembles the tune, but its very distorted.

I could be very wrong, but I think it might have something to do with endian-ness. Does an AudioTrack class require a little-endian byte array? I've tried to use a ByteBuffer to flip the endianness of the output from IBXM, as the output from IBXM in its Player.class - an included example command line player - seems to write to a Java audio line with big-endian enabled. But I'm not sure if my approach is valid or even the right thing to be doing.

Can anyone help? I'd be very grateful if anyone can help test and fix this. :)

See attached .rar file - that's my Eclipse project with horrible source code - and test.xm, which the program looks for on the root of sdcard.

Upon launching the program, the play button should start playback, and that's where I'm hitting the static.

Many thanks for any help you can give me. :)
chipdroid project
(156.45 KiB) Downloaded 106 times
test.xm, copy to /sdcard/
(10.55 KiB) Downloaded 109 times
Once Poster
Once Poster
Posts: 1
Joined: Fri Oct 30, 2009 1:37 pm


Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 4 guests