On Board Sound -- Midi in Custom Props

Scott Rossi scott at tactilemedia.com
Wed May 30 14:43:19 EDT 2007


Recently, Sivakatirswami wrote:

> I would like to include some really light weight audio in stacks. Midi
> would be ideal for certain kinds of games sounds, transition sounds,
> opening splash screen sounds.
 
> Has anyone tried saving midi files in a custom prop, then writing those
> to disk and playing them in an off screen player? I wonder the system
> is going to block the write to disk.

Just tried it and it seems to work fine.  Using MIDI file imported as binary
property (uSnd):

  put the tempName into tPath
  set itemDel to "/"
  put "muzac.mid" into last item of tPath
  put the uSnd of this stack into url ("binfile:"&tPath)
  set filename of player 1 to tPath

But with MIDI files being so small, I'm not sure you would need to do this
unless you want your app to run offline.

 
> I'm open to any and all other strategies as this is something new for
> us. Looking for "best practice" based on your experience.

AFAIK, MIDI playback requires QT be present on the system.  If this is OK
for you, then playing MIDI files should be no more trouble than assigning a
filename to a player.  Try it:

set filename of player 1 to \
      "http://www.tactilemedia.com/download/battle.mid"

If you're not happy with the quality of MIDI music, or you can't rely on QT,
you can always play a small sound file and/or animation while downloading a
stack of sounds or individual sounds to the local machine.  If QT is OK and
you have control over the sound encoding, you can create the sounds as
streaming QT files and stream playback, allowing for playback before the
download is complete.

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design





More information about the use-livecode mailing list