Store audiofile in database

I don’t know how to store an audiofile in a database.
In my Windows-App i open an wav-file with the f.openassound method, this works fine, i can play the file with .play

How can i store this file in a, for example mysql-database, as blob.

It is not good practice to store large blobs like images and audio data in a database. You should store it as a file, and store a reference (like path and filename) in the database instead.

But if you really want to, you could
1 - store the audio in a temporary file on disk
2 - open this file as a binary stream
3 - read the file and store the bytes in a blob field in your database
4 - close the binary stream
5 - delete the temporary file

In postgresql you can store large objects. Those objects do not reside in a table column. After creating such an object, the db returns an id. That id you can use as reference elsewhere in your database.

Dank u wel Edwin…
I was thinking about this solution, too, but your detailed description helps me a lot.

Bitte :wink: