When should JetCreator or SoundPool be used? - android

I'm trying to make an app and I would liek to try to implement the optimal solution for multiple, simutaneously playing, programmatically selected sound effects.
I really appreciate the help.
Cheers

Well it depends:
Mediaplayer:
Not good for simultaneous playing (you need multiple MP objects), the response time and especially the prepare() methode take a lot of time.
Therefore synchronizing is quite impossible.
SoundPool:
Good for small MP3.files (size limt ~1mb, ~30sec)
Easy to implement
A lot faster than Mediaplayer. Mostly used for "sounds" and not a for complete "piece of music"
Jet Player/JET Creator
Used for MIDI files, quite difficult to install (you need python, wx python in order to use JET creator ...).
Very fast response, good for simultaneous playing of several tracks!
Any further questions? do not hesitate to ask!
best regards

Related

simple foreground Android audio playback: shall I use MediaPlayer/Exoplayer in Service?

I need to embed simple inline audio playback into a list view, where the user would just click play/pause/stop on the items one by one, in the foreground
The playback back would stop when leaving the screen (activity or fragment).
So the use case is similar to those usual chat apps.
Ideally, I was looking for a simple UI widget I could embed into a list view and pass a mp3/wav/ogg url (local files for a start).
Trying to research for such a thing I found people implementing either an ultra simplistic player with no ui at all or a fully fledged bound Service (which I tried and it works, but it seems like an overkill for a simple foreground playback). When simply embedding a MediaPlayer + MediaController into a fragment, the android monitor was complaining -I think- about doing too much on the UI thread.
So, is there such a player widget to minimise boilerplate code?
Would ExoPlayer be a good choice? ( I see it's powerful but may be even more of an overkill - unless it has some handy utility class, which I missed so far)
What would be the simplest, quickest, safest, most elegant solution?
I'd be grateful for any pointers or enlightenment.
In the meantime I found some potential candidates as audio player widgets:
Uncodin: looks good but not properly packaged, as a gradle dependency https://github.com/Uncodin/Android-Common/blob/master/UncodinCommon-standalone/src/in/uncod/android/media/widget/AudioPlayerView.java
https://github.com/Cleveroad/MusicBobber
and more on android-arsenal.com
I've yet to try these but wouldn't mind hearing suggestions about concrete solutions or how to implement or where to look.

Playing game sounds

I need to play sound effects in my game such as jump, failed, shot etc.
So for this purpose I have selected SoundPool class. But there were some times when it lagged.
So I wonder what is correct way to use this class. I have tried to use play method in new thread, it seems work better but I don't know if I am correct.
Please advice how to use object of this class correctly for better performance.
Best way to implement Sound / Music into your game is by using Service component. Read this answer here for an example.

Android - Tempo adjust?

I have now admitted defeat that you cannot use/build a good audio tempo function without using the NDK as the SoundPool class is buggy and only allows up to 1MB. Now my question is does anyone know of any good tempo/bpm changing code either in a library or some source code for the NDK?
You could use a Sample Rate Converter. Simple Rabbit Code is pretty damned good.
If you wish to do more complex things such as time stretching i suggest you start here.

Is there something in the Android architecture or API that prevents people from creating MP3 players that read embedded lyrics?

When I play certain MP3 files (such as lessons from JapanesePod101.com) on my iPod Touch, lyrics or transcripts that are embedded in the MP3 files are displayed in the media player. The lyrics are, I believe, stored as ID3/ID4 tags in the MP3 metadata.
I find this to be an extremely useful feature, and I believe I'm not alone. Despite that, neither the stock Android media player nor any other media player I've downloaded from the Market seems to support this. I just have not been able to find any way to get feature on my Nexus One.
This feature is important enough to me that I'm considering learning Android development just so I can write a simple media player that displays embedded lyrics or notes. However, the fact that nobody else seems to have done this makes me wonder - is it even possible? Is there something in the Android architecture or APIs that make it difficult or impossible to read and display lyrics information from MP3 files? I'd hate to get deep into the learning process and find out what I'm aiming for can't easily be done. (I mean, if all else fails I assume I could write my own MP3-decoder, but that's more trouble than I'm willing to go through right now).
I've already asked this question on the Android Enthusiasts Stack Exchange Beta Site, but in retrospect I decided it was more of a programming question and decided it was better to ask here.
Yeah, definitely more of a programming question. Just from my brief experience of reading through the ID3 spec, I think it's probably just that decoding ID3 tags is a complete PITA. I'm sure it can be done, as there are MP3 tag editing apps available for Android (whether any support lyrics or not, I do not know).
ID3v2.3 seems to have support for both synchronized and unsynchronized lyrics through the SYLT and USLT frames of the header. I imagine it's just such an underused feature that it isn't worth the effort to most to do so. Purchased MP3s don't carry this information (I've always wondered why not?), so they would have to manually be added (or automatically via a lyric service API, but there's a lot more coding involved with that).
Here is the ID3v2.3 spec if you'd like to look into it further...(abandon hope all ye who enter here)
The problem may be that most people would use the built-in mp3 playback mechanisms, and this may neither support lyric display nor be very easy to keep synchronized with something else doing lyric display.
So it may be that something needs to be written which does it's own mp3 decoding.
Most likely this would want to be done in native code. On the other hand, on android, audio output (and unless you use opengl, video display) pretty much has to be done from java. So you are looking at a fair amount of work to decode data with a native library and then dispatch it for playback and display from java.
So to answer your question - is it possible? Definitely
Is it made easy by the android APIs? - not really
I just added a new feature request that would give Android support for reading USLT in the ID3 tag. This will enable the native and 3rd party music players to display lyrics. If you want this feature, please star the request below, and post your comments.
http://code.google.com/p/android/issues/detail?id=32547

Sound processing in Android

I know there is a similar question to this floating around stackoverflow. What I would like to know is if there's a simple way to do beat mapping for a song in Android? I don't need to do anything as complicated as beat matching between different varieties of songs, as the other question requests; at least I don't think it's anymore complicated, more experienced programmers please feel free to comment.
I simply would like to map the beat of a single song to be able to use it later in my program. I'm very new to both Android programming and sound processing in programs, so any suggestions or comments are appreciated.
Check out the open source (actually made by a member of the Android team) project RingDroid...there's some pretty basic sound processing there, so that should give you a start.
Here's the RingDroid site.

Categories

Resources