Audioclips: can't get at the data?

stephen barncard stephenREVOLUTION2 at
Mon Mar 14 18:47:17 EDT 2011

Just a short report to those following this thread :
 today I've been successful in

   - Recovering the audio data and playback metadata from a livecode stack
   - separating the components and metadata into arrays
   - Using the metadata to export to a standard AIFF file from the audioclip
   to MacOSX.

This is a 100% LiveCode scripted solution.

My project was a personal 'black box' investigation with no info from the
mother ship outside of the usual docs. I built a hex-dump display so I could
read all the headers and data in the captured data and typical audio files,
and dug up some ancient AIFF spec sheets going back to the Apple ][ era.
Some parameters remain in the REV2700 data dump that I haven't connected
with function yet.

Limitations - At this moment I can't recover files with lower sample rates
of 11k and 8k, but that's probably due to scripting errors (gasp), my test
files or methodology -  there are still a few things about the audioclip
data structure I haven't yet discovered. But an exported 22k 8 bit file
worked fine, as did the 16 bit 44.1 and 48k samples, stereo and mono.

Also not supported is audio with 24 bits or wider width and/or sample rates
higher than 48,000. Those are Livecode limitations anyway. Not tested on
Intel or Windows yet. There might be some endian issues. This has not tested
with audio files greater than a second or two.

 Not sure what to do with the project other than use my own libraries,
perhaps I'll offer a free 'rescue' app that will allow the recovery of the
audioclips in any stack to files in a designated folder, a very simple app.

I started originally to create WAV files and could parse files and read the
headers of my templates and comparison test files, but my Template creator
code for WAVs just didn't produce a playable file, so I started completely
over with an AIFF template.  Making this project deliver wav files will be
an option in the future.

I may check out some other Livecode objects in their own 'binary space'.
This is an interesting area for spelunking. For instance, the first 8 bytes
of the captured Livecode audioclip object in memory is    52 45 56 4F 32 37
30 30
which reads back in ascii as     REVO2700 but the rest is audio data and
metadata that relates to the audio.

A couple more things - I've discovered that it's possible to create custom
properties within a soundclip, but one won't want to do that - it TROUNCES
the audio data inside! (although it seems to play in Livecode anyway, it
might mess up future export)
And Livecode itself trounces the last 9 bytes of imported audio data in the
original file in adding its own metadata using the import command.
Obviously, 9 sample among millions won't be missed, but something to note.

I'm sure the multimedia improvements in Livecode with upcoming versions will
someday make this hack unnecessary. But for applications that need this now,
it seems to work.

Livecode made this investigation and execution possible, allowing me to
create interactive information gathering displays to then empower me to
write data conversion handlers with results confirmed by the displays I
created before!

I'll report back.

 Thanks to David Bovill for opening the door back in January:

*copy audioclip 1*
*put clipboarddata ["objects"] into tVariable*

On 10 January 2011 21:11, stephen barncard
<stephenREVOLUTION2 at>wrote:

> I don't know about merging yet. I'll be happy to export individual files
> right now.

Stephen Barncard
San Francisco Ca. USA

more about sqb  <>

More information about the use-livecode mailing list