简体   繁体   English

Android:哪种声音格式适合SoundBoard应用程序

[英]Android: Which Audio Format is Preferable for SoundBoard Application

I hope my question is clear from the title. 我希望我的问题从标题中可以清楚看出。 But still I will explain briefly my problems. 但是我仍然会简要地解释我的问题。 I tried ogg and faced the problem of looping. 我尝试了ogg,然后遇到了循环问题。 I added a tag ANDROID_LOOP=true for ogg file to enable loop while it is set as ringtone. 我为ogg文件添加了标记ANDROID_LOOP = true ,以在设置为铃声时启用循环。 But when I play in the soundboard app, it continues to play in infinite loop. 但是,当我在音板应用程序中播放时,它会继续无限循环播放。 When I googled about this, I found it to be a bug with ogg files. 当我用谷歌搜索时,发现它是ogg文件的错误。 Then I tried mp3, and I am not able to set the TITLE, or ARTIST or any metadata to the mp3 file even after when i enter the mediastore database as follows 然后我尝试了mp3,即使我按如下所示进入mediastore数据库,也无法将TITLE,ARTIST或任何元数据设置为mp3文件

       values.put(MediaStore.MediaColumns.TITLE, "foo");  
       values.put(MediaStore.MediaColumns.DISPLAY_NAME, "foo"); 
       values.put(MediaStore.MediaColumns.MIME_TYPE, "audio/mp3");  
       values.put(MediaStore.Audio.Media.ARTIST, "Sound Board");  

When I open the mp3 file in the Media Player, it says Unknown Artist and Unknown Album . 当我在Media Player中打开mp3文件时,它说未知艺术家未知专辑 Anybody knows how to fix this? 有人知道如何解决这个问题吗? Also suggest me a good format which will save me some space. 还建议我使用一种好的格式,这将节省一些空间。 Your help is really appreciated. 非常感谢您的帮助。 Thanks. 谢谢。

Is there a reason you're adding your audio to the media store? 您是否有理由将音频添加到媒体商店? It seems that a sound board application would keep all their audio inside the application resources and play them as necessary. 音板应用程序似乎会将所有音频保留在应用程序资源中,并在必要时播放它们。 In that case I would go back to using ogg files since the performance seems to be the best, and if you take a look at SoundPool class that's pretty much exactly what you'll need to load up a bunch of audio samples, trigger and loop them as necessary. 在那种情况下,我将重新使用ogg文件,因为性能似乎是最好的,并且如果您看一下SoundPool类,那几乎就是加载大量音频样本,触发和循环所需要的他们是必要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM