Best Way To Use Sounds with Database Store

Years ago I wanted to have my app sounds all stored in a SQLite database, so I wrote some code that is used when I want to play a sound that fetches the blob data from the database, writes it to the local filesystem as a .wav file, then opens it as a sound object using f.openAsSound.

This has worked reasonably well, but I hate that I have to pull the sound of the database just to spit it back out to the filesystem so that I can re-load it from disk using the FolderItem method.

Is there a more direct way to get a sound that is in a SQLite database blob field to be an in-memory sound object that I can play?

Something analogous to Picture.FromData ?
No there isn’t

Interesting FR though

Yes, interesting FR that was opened back in 2011:
<https://xojo.com/issue/16261>

Thats the one
Sounds just have so many formats the raw data could be in
I’m not sure what each platform has in terms of available libraries/API’s to actually do this

Of course you could, at app start up, pull all the sounds write them to disk & load them once and be done with it

Yeah, I am just loading all the sounds into a dictionary on demand - as they are played, the are fetched and stuffed into the dictionary. The next time that sound is needed, it is pulled from the dictionary.

This is faster once things are loaded up, but it does consume considerably more memory.

[quote=72756:@Kimball Larsen]Yeah, I am just loading all the sounds into a dictionary on demand - as they are played, the are fetched and stuffed into the dictionary. The next time that sound is needed, it is pulled from the dictionary.

This is faster once things are loaded up, but it does consume considerably more memory.[/quote]
Since they are “read only” loading all of them at start up costs memory but speed would be better overall once the app is up.
If eventually they all get loaded then memory is no worse.