Players, playing data from RAM

Dave Cragg dcragg at lacscentre.co.uk
Thu Jun 12 07:52:00 EDT 2003


Hi

My main question is whether there is a way to play audio data through 
a Player object without linking the Player to an external file or url.

I think the answer is no, but I'm really hoping I've missed something.

Some background:

I developed a language learning application that plays a conversation 
as a series of audio clips. Originally the clips were in au format 
and were played with the "play audioclip" command. When one clip 
ended, the next was played. All the clips for a single conversation 
were imported to a single stack. Open the stack (downloaded from an 
ftp or http server) and the clips are all in RAM. This worked fine, 
and the playback was seamless.

I've recently had to change the audio format to mp3. Unfortunately, 
you can't play mp3 with the "play" command and have to use a Player 
object. This means linking to a file (set the filename). I tried to 
keep to a similar strategy. The mp3 clips for a single conversation 
are stored as custom properties of a stack. The stack is downloaded 
from the web. The clips are written as temporary files on the local 
drive. The  clips are played back through a player in sequence.

On my machines (and most others it seems) this gives acceptable 
performance. But I've had reports of long pauses (up to 5 seconds) 
between clips from one group of users. These users are far away, so I 
can't see eactly what is happening. But even if I find out they have 
some anti-virus software or something else that is delaying the 
setting of filenames, I prefer to avoid the problem happening 
elsewhere.

The solutions I've tried so far:

-- use a single player, change the filename after each clip (works 
fine here, gives the longest pauses on the problem machines)

-- use multiple players (one per clip), set the filenames when the 
lesson opens. This gives better performance, but when the Players are 
unbuffered, the pauses are still too long. When the Players are 
buffered, the pauses are acceptable, but there is a long delay (up to 
15 seconds) on the problem machines while the filenames are set for 
each player.

Solutions I want to avoid:

I could join all the clips into a single audio file. But as each clip 
plays, some corresponding text is hilited in a field. I'd have to 
completely redo how the text segments are linked to the playing audio 
-- work I'd prefer to avoid.

Linking to a url instead of a file offers a partial solution. You can 
load the url first, and then the Player will play the sound from the 
cached url. However, after the audio is first downloaded from the 
web, it has to be stored locally (a custom cache) to avoid further 
downloads, which means the Player then has to deal with files, not 
http/ftp urls. (As far as I can determine, you can't load 
"file/binfile" urls.)

What I really want is something like "set the data of player 1 to <some data>.

Any ideas anyone?

Cheers
Dave



More information about the metacard mailing list