Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Determining the length of a sound before playing it

From: rebolek:gmai:l at: 31-Aug-2009 20:54

Hi Steven, the lenght of the sound is: (length in bytes) / (sampling frequency) / (sampling resolution in bytes) / (number of channels) = length of the sound This is for RAW sounds. For WAV/AIFF add header size, for MP3 you have to use some MP3 analyzer (I think someone did it in REBOL). So for example a stereo sound that is 176400 bytes long and is sampled at 44100kHz in 16bit it is: 176400 / 44100 / 2 / 2 = 1 second. Hope that helps, Bolek On Mon, Aug 31, 2009 at 7:23 PM, Steven White <>wrote:
> REBOL/View Pro will play a sound. I have done that. Does anyone know if > it is possible for a REBOL program to determine the length of a sound before > playing it? > > Last night my spouse was struggling with Power Point to make a slide show > with background music. The reason it was such a struggle seemed to be that > it was hard to find the settings to make that happen, and when we found some > settings that APPEARED to be the ones that SHOULD make that happen, it still > did NOT happen. Defeated by complexity. > > That got me thinking that it should be logically simple to make a program > that does only one thing, namely, display pictures with background music. > > Determine length of music. > Obtain list of all pictures in a directory. > Determine number of pictures. > Divide length of music by number of pictures, giving duration. > Start sound playing. > For each picture, > Display the picture > Wait for the duration. > Quit > (Details are left as an exercise, as they say.) > > All those steps I have seen done in various sample REBOL scripts, except > for the first one of finding out how long a sound will play. > > Thank you. > > Steven White > City of Bloomington > 1800 W Old Shakopee Rd > Bloomington MN 55431-3096 > USA > 952-563-4882 (voice) > 952-563-4672 (fax) > > > -- > To unsubscribe from the list, just send an email to > lists at with unsubscribe as the subject. >
-- *** Boleslav Březovský == ***