Putting audio into mysql and getting it back again

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Simon Vickers
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5
Joined: Sun Apr 14, 2013 4:33 am
Contact:

Putting audio into mysql and getting it back again

Post by Simon Vickers » Tue Aug 27, 2013 11:42 am

I am making an application that is designed to take large MP3 audio files and break them into small chunks.

As Per §13.3.1 of the LiveCode User Guide, I use a "player object", getting the audio from a URL then defining each chunk with a "startTime" and an "endTime". The chunks can then be played at will. This works perfectly well.

How can I then store the chunks as separate objects in a BLOB field in a mysql database, then retrieve and play them separately later?

All suggestions gratefully received!

Klaus
Posts: 14206
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Putting audio into mysql and getting it back again

Post by Klaus » Tue Aug 27, 2013 12:57 pm

Hi Simon,

let me see if I get this right:
You want to "slice" a big MP3 file into small separate MP3 files, right?
Sorry, this is not possible with the built-in means of Livecode!

Why not just store the pairs of "start-/endtime" for each "chunk" in the database?


Best

Klaus

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10053
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Putting audio into mysql and getting it back again

Post by FourthWorld » Tue Aug 27, 2013 3:05 pm

Klaus wrote:Why not just store the pairs of "start-/endtime" for each "chunk" in the database?
Brilliant solution. Keeps the database from getting bogged down with large BLOBs, and provides tremendous flexibility with minimal overhead.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Simon Vickers
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5
Joined: Sun Apr 14, 2013 4:33 am
Contact:

Re: Putting audio into mysql and getting it back again

Post by Simon Vickers » Wed Aug 28, 2013 2:25 am

Thanks for the feedback. Maybe I should explain a bit more.

I have already done storing the startTime and endTime in SQL fields and having the audio file accessible at an URL.
It works fine.

The trouble is I want to play individual sound chunks from multiple audio files, in no particular order.

That would, I suppose, mean having multiple "player objects" standing by, which would take time to load and use much memory.

The audio file size is in the region of 20 MB and chunk size is around 50 KB.

So it does seem to make sense to put them into SQL fields as binary files and to get & play them individually as and when they are needed (small is beautiful!).

OK then, supposing you can't capture the sound between two markers and save it somewhere automatically with LiveCode,
can you retrieve sound data from a mysql database field and play it? And how?

Thanks in advance...

heatherlaine
Site Admin
Site Admin
Posts: 351
Joined: Thu Feb 23, 2006 7:59 pm

Re: Putting audio into mysql and getting it back again

Post by heatherlaine » Thu Aug 29, 2013 9:11 am

Simon has asked me to post this on his behalf as it contains a link, which he cannot yet include (5 posts, 1 week membership required to post links)

Regards,

Heather

Maybe I need to explain a bit more.

The application that I am working on is a text library designed to show sentences of text,
one by one. For each sentence, it presents the conventional spelling, the phonetic spelling and the
sound.

It is to be searchable, giving the context, spelling and pronunciation of any word it
contains.

Here is a screenshot as it now stands (messy):

http://034d0ec.netsolhost.com/LE/Screen ... 20Tool.png

You can see the startTime and endTime of the current chunk under the audio control panel.

Currently, the data is internal, stored in cards.

I need to make the application into an interface for a remote database, and the challenge
I now face is storing the audio.

I would be very please to have a technical fix for my problem.

I imagine getting sound data from a database and playing it would be a problem that many
might face.

By the way, whatever you might say about Tony Blair as a politician, he was a spellbinding
orator!
Seems we are in a here-we-go-again situation right now.

Post Reply