max length for sound files

Paul Gr pauls_postbus at hotmail.com
Sat Apr 16 13:48:05 UTC 2005


Dear Michaela

Since the buffer size is limited by the graphical user interface, you could
bypass the 100sec limit by entering the required code in an inline script:

dim SoundLong as SoundOut
dim SoundBufferLong as SoundBuffer
Set SoundLong = New SoundOut
SoundLong.Name = "SoundLong"
SoundLong.Tag = ""
Dim SoundBufferLongInfo As SoundBufferInfo
SoundBufferLongInfo.MaxLength = 300000   ' this should be at least the
duration of your sound clip
SoundBufferLongInfo.VolumeControl = CLogical("no")
SoundBufferLongInfo.PanControl = CLogical("no")
Set SoundBufferLong = Sound.CreateBuffer(SoundBufferLongInfo)
SoundLong.Buffers.Add SoundBufferLong
SoundBufferLong.Loop = CLogical("No")
SoundBufferLong.StopAfter = CLogical("Yes")
SoundBufferLong.StartOffset = "0"
SoundBufferLong.StopOffset = "0"
SoundBufferLong.EndSoundAction = 0
SoundBufferLong.Filename = "longtrack.WAV" ' <-- enter your file her
SoundBufferLong.Load
Set SoundBufferLong = Nothing
SoundLong.Duration = 0   ' <-- the currents setting continues playing while
running the rest of the script
SoundLong.TimingMode = ebTimingModeEvent
SoundLong.PreRelease = Val("0")
SoundLong.OnsetSync = 1
SoundLong.OffsetSync = 0
SoundLong.Play ' <-- the tune is started here

This seems like a ln awfull lot of code, but most properties are set just to
there default values. Properties to change are MaxLength and Filename. More
detailed info is available in the EBasic manual.

An alternative is to bypass the sound functionality of EPrime and call some
build-in windows functions directly. Just enter the following piece of code
in the user section tab-page of the script:

'------------ USER SECTION BEGIN

' Sound suppport by using the windows multimedia library directly (i.e.
bypassing EPrime)
Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal
lpszSoundName As String, ByVal uFlags As Long) As Long
Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal
lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

' Some constants for playing sounds
Const SND_LOOP = &H8        ' loop the sound until next sndPlaySound
Const SND_ASYNC = &H1       '  play asynchronously
Const SND_NOSTOP = &H10     '  don't stop any currently playing sound
Const SND_SYNC = &H0        '  play synchronously (default)
Const SND_NODEFAULT = &H2   '  silence not default, if sound not found
Const SND_PURGE = &H40      '  purge non-static events for task

' Remarks
' If the specified sound cannot be found, sndPlaySound plays the system
default sound.
' If there is no system default entry in the registry or WIN.INI file, or if
the
' default sound cannot be found, the function makes no sound and returns
FALSE.
'
' The specified sound must fit in available physical memory and be playable
' by an installed waveform-audio device driver. If sndPlaySound does not
find
' the sound in the current directory, the function searches for it using the
' standard directory-search order.

' Plays a sound from filename ans optionally wait until ready.
Function PlaySoundFile(ByVal filename As String, bWaitReady as boolean) as
Boolean
  PlaySoundFile = sndPlaySound(filename, iif(bWaitReady, SND_SYNC,
SND_ASYNC) )
End Function

' Plays a repeating sound from filename.
Function RepeatSoundFile(ByVal filename As String) as Boolean
  RepeatSoundFile = sndPlaySound(filename, (SND_LOOP Or SND_ASYNC) )
End Function

Sub StopSoundFile()
  dim ret as boolean
  ret = sndPlaySound(ebNullString, SND_SYNC)
End Sub

'------------ USER SECTION END

Playing a long sound file is a matter of entering the following code in an
inline script to start (and stop) a sound file:

if not PlaySoundFile("longtrack.WAV", False) then
   MsgBox "Unable to play sound file"
end if

...

StopSoundFile


Kind regards,

Paul Groot
Vrije Universiteit Amsterdam


>From: Michaela Dewar <M.T.Dewar at sms.ed.ac.uk>
>To: eprime at mail.talkbank.org
>Subject: max length for sound files
>Date: Thu, 14 Apr 2005 15:36:55 +0100
>
>
>
>Hi,
>Does anyone know whether the maximum length of a sound file can be changed
>in
>e-prime. The default maximum duration appears to be 100000ms. My wav file
>is 10
>minutes long and I have not been successful in finding a way to present
>this
>with e-prime.
>
>Many thanks,
>Michaela
>

_________________________________________________________________
MSN Webmessenger doet het altijd en overal http://webmessenger.msn.com/



More information about the Eprime mailing list