• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How is audio playback handled, in detail?

Zeke99

Lurker
May 23, 2015
1
0
Greetings all,
I'm new to this forum, most people I've been talking to recommend it for app dev in android. I would never have guess that from the name of the website...

I'm in the process of building an app that functions as a media player with some unique features. So, as a true noob, I will ask a question that is probably telling of my confusion yet here it goes; how does android play an audio file back? Let's see if I can be less vague. I'm looking for clarification on how this process works, specifically how the audio file is read. I have 5 different assumptions about how it could go, but it's just speculation so here I am.

I have read information about media players so I understand (correct me if Im wrong) that in media player apps, generally, you have functions that govern the buttons and processes; file location, stop, play, release, destroy...etc. I'm interested in knowing the process of how the audio file is read. For a 4 min audio file, let's say 4MB in size;
1) Does android read it once piece at a time i.e. only reading what it needs for whatever position in the track it is at? OR
2) Does android load the whole audio track of 4MB into memory and read it that way?
3) Is the audio file being played locked since it is in use like in Win 7? i.e. trying to move the file you're playing results in "no, you cant move the file. It's being used be another program".
4) If this app I build can and does load the entire track (4MB) into memory and plays it from there, would that be resource intensive for the majority of phones? How about a 500MB track?

As a final attempt to clarify, here is what I plan on doing; I will be using this app for audio playback, audio recording, saving new audio tracks, and playback speed settings. I know that the app will work just fine without knowing EXACTLY how playback works, but it is imperative for a recording feature I'd like to implement that I know how playback works in detail.

Thank you to all who read, and much appreciation to those who reply!

Z
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones