My app will download audio files e.g loops. I need a database system for the server and one for the iOS device that can handle audio files. The user should be able to browse audio files from the iPhone and then download selected ones locally to the device.
I am looking for recommendation about what databases/database-APIs to use.
Storing audio in any database system is difficult because the audio files have to be saved as big blobs of data. Getting those blobs into and out of the persistent store file is difficult and if something corrupts the file, you lose all the audio.
Instead, you should save the audio file as individual files and then use Core Data to maintain information about the file e.g. file path, length, type, last used, etc. You can use the Core Data information to manage the UI and then only load the audio file directly when you need.
This has the added advantage under iOS that most of the audio classes expect a file to work with so it makes everything a lot easier.
Just a bunch of keywords you might want to research:
- CoreData for modeling objects stored in and retrieved from a local database on the iPhone
- MP4/AAC for the audio format usable by the iPhone
- AVAudioPlayer for handling playback.
精彩评论