RecordSound Xtra (Beta)
Windows:1.0.12 Released:2006-02-19
MacOSX:N/A
MacOS9:NA
Copyright Geoff Smith 1999-2006
This page last updated Tuesday 02nd of December 2008



Introduction

Information

Messages

Download/Buy

Error handling


Messages

Message
Windows
MacOSX
MacOS9
General
New
OpenAudio
CloseAudio
IsAudioOpen
FindAudioCaptureDevices
StartRecording
StopRecording
RecordingNow
StartGetInputLevel
NYI
NYI
StopGetInputLevel
NYI
NYI
GetInputLevel
IsGsilActive
NYI
NYI
Audio Capture Format
GetFormat
SetFormat
SetSampleRate
SetBitsPerSample
SetChannels
Play
PlaySound
PlayStop
IsSoundPlaying
Saving
SaveAsMember
SaveAsFile
Misc
ShowErrorsAsDialogs
GetVersionString
GetLicensetype
GetDemoDaysRemaining
NYI
NYI
privateInstance
privateGlobal

= Implemented and available on this platform
* = Modified this release
X = Cannot be implemented on this platform
NYI = Not yet implemented

Version release history

New

Command format New xtra "RecordSound"
Description Standard command to create a new instance of an object.
Parameters None
Notes  
Return value Object instance or minus number on error.
Example set theXtra to new( xtra "RecordSound" )

OpenAudio

Command format OpenAudio object me, string deviceName
Description Open an audio device with the specified name. If the device name is empty, "", the currently selected device is opened. To find the currently installed audio devices use FindAllAudioCaptureDevices.
Parameters object me: The value returned from new

string deviceName:The name of a valis audio device on this machine

Notes  
Return value "ok" or error messages starting with "Error :"
Example theXtra.OpenAudio("")

CloseAudio

Command format CloseAudio object me
Description Closes the connection to an audio capture device that has been opened. You MUST call this if you have used OPenAudio.
Parameters object me: The value returned from new
Notes  
Return value "ok" or error messages starting with "Error :"
Example theXtra.CloseAudio()

IsAudioOpen

Command format IsAudioOpen obejcect me
Description Check to see if an audio device has been opened without error.
Parameters object me: The value returned from new
Notes  
Return value Returns 1, true, if the device is open, or 0, false if not open.
Example open = theXtra.IsAudioOpen()

FindAudioCaptureDevices

Command format FindAudioCaptureDevices object me
Description Every computer can have zero or more audio capture devices. This function finds all the devices and returns then as a list of lists. The number of items in the list is the number of devices. Each sublist contain 2 items, first the name to use in the new command, the second is a description , if any. The PC does have descriptions, the Mac does not. eg [["',"default capture"],["wave 1","CS343.3 capture board"]]
Parameters object me: The value returned from new
Notes  
Return value Returns the list or error messages starting with "Error :"
Example put theXtra.FindAudioCaptureDevices()

StartRecording

Command format StartRecording object me, integer maxTimeToRecordInMilliseconds
Description Initiates a recording with a maximum record time of maxTimeToRecordInMilliseconds. It may be stopped at anytime by using StopRecording
Parameters object me: The value returned from new
integer maxTimeToRecordInMilliseconds: The maximum time to record in milliseconds. 1000 milliseconds = 1 second.
Notes This will fail if you have not opened the audio capture device, or if there is not enough memory to store the recording. If it fails because of memory then try reducing the record time or changing the recording format.
Return value  
Example put theXtra.StartRecording(10000) --record for 10 seconds

StopRecording

Command format StopRecording object me
Description To stop a recording in progress. All recording upto this point is kept.
Parameters object me: The value returned from new
Notes  
Return value "ok" or error messages starting with "Error :"
Example put theXtra.StopRecording()

RecordingNow

Command format RecordingNow object me
Description Once you start a recording this method allows you to see if the recording is still recording, or has reached the maximum duration. If audio is still being recorded this function returns "yes" - else "no"
Parameters object me: The value returned from new
Notes  
Return value "yes" if a recording is currently occuring, else "no"
Example if theXtra.RecordingNow() = "yes" then ...etc

StartGetInputLevel

Command format StartGetInputLevel object me
Description If you want to monitor the sound input level when not recording you have to switch it on with this message.
Parameters object me The value returned from new
Notes You do not have to use this message if you want to use GetInputLevel during recording.
Noe you cannot playback a sound when using the Wintel platform unless you use StopGetInputLevel.
Return value "ok" or error messages starting with "Error :"
Example theXtra.StartGetInputLevel()

StopGetInputLevel

Command format StopGetInputLevel object me
Description Stop the monitoring of the input audio level
Parameters object me:The value returned by new
Notes  
Return value  
Example theXtra.StopGetInputLevel()

GetInputLevel

Command format GetInputLevel object me
Description This allows you to access the current level of the sound being recorded. The message returns a list of items: #left: the value of the audio on the left channel #right: the level of the audio on the right channel #error: "ok" or an error message
Parameters object me: The value returned from new
Notes If the input source is mono the left and right values will be the same. 1.0.8 has a bug that will be fixed in a later release. The returned value is a property list inside a linear list. Use the example below to access the values.
Return value Property list containing the volume levels and error return value
Example values = getat(theXtra.GetInputLevel(),1) -- [[#left:22, #right:56, #error:"ok"]]
put values.Getprop(#right) -- 56

IsGsilActive

Command format IsGsilActive object me
Description Query if the GetSoundLevel is currently active.
Parameters object me: The value returned from new
Notes  
Return value "ok" or error messages starting with "Error :"
Example put theXtra.IsGsilActive()

GetFormat

Command format GetFormat object me
Description Obtains the current audio format. Returns a property list with the following properties #SampleSize - the sample size in bits per sample, normally 8 or 16 #NumberOfChannels - the current number of channels being recorded, normally 1 or 2 #CompressionType - a 4 character string to describe the compression being used "" = none #SampleRate - the number of samples per second, normally 11.025, 22.01 or 44.1
Parameters object me: The value returned from new
Notes  
Return value Property list of audio settings or error messages starting with "Error :"
Example put theXtra.GetFormat()

SetFormat

Command format SetFormat object me propertyList aListOfSettings
Description Sets the current audio format. Returns a property list with the following properties #SampleSize - the sample size in bits per sample, normally 8 or 16 #NumberOfChannels - the current number of channels being recorded, normally 1 or 2 #CompressionType - a 4 character string to describe the compression being used "" = none #SampleRate - the number of samples per second, normally 11.025, 22.01 or 44.1
Parameters object me: The value returned from new
propertyList aListOfSettings:A property list of the settings you want to set.
Notes Not all the properties need to be present, any that are missing retain there previous value.
Return value "ok" or error messages starting with "Error :"
Example put theXtra.SetFormat([SampleSize:16])

SetSampleRate

Command format SetSampleRate object me, integer newRate
Description There are various parameters that control the quality of the recorded sound. The sample rate sets the number of times per second the current level of the input is checked. The more, the better quality - but requires more memory. You can pass any value, but only certain standards are supported by most computers. Standard ones are: 11025, 22050 and 44100 Note: Will be withdrawn in the near future, please use SetFormat in new projects
Parameters object me: The value returned from new
integer newRate: The new sample rate. Standard values are: 11025, 22050 and 44100
Notes  
Return value "ok" or error messages starting with "Error :"
Example put theXtra.SetSampleRate()

SetBitsPerSample

Command format SetBitsPerSample object me, integer newBitsPerSample
Description There are various parameters that control the quality of the recorded sound. The bits per sample controls the resolution of the amplitude, or size, of the signal. There are 2 valid values, 8 and 16. The 8 bit value divides the amplitude into 256 steps and the 16 bit into 65536. The more, the better quality - but requires more memory. Note: Will be withdrawn in the near future, please use SetFormat in new projects
Parameters object me: The value returned from new
integer newBitsPerSample: The new bit rate. Standard values are: 8 and 16
Notes  
Return value "ok" or error messages starting with "Error :"
Example put theXtra.SetBitsPerSample(16)

SetChannels

Command format SetChannels object me, integer newChannels
Description There are various parameters that control the quality of the recorded sound.The SetChannels command alows you to control the number of audio channels to record. Mono is 1, stereo is 2 and quad is 4. Note: Will be withdrawn in the near future, please use SetFormat in new projects
Parameters object me: The value returned from new
integer newChannels: The new channel count. Standard values are:1, 2 and 4
Notes  
Return value "ok" or error messages starting with "Error :"
Example put theXtra.SetChannels(2)

PlaySound

Command format PlaySound object me
Description Play a sound that has been recorded
Parameters object me: The value returned from new
Notes  
Return value  
Example theXtra.PlaySound()

PlayStop

Command format PlayStop object me
Description Cancel the playback of a sound that was started with PlaySound
Parameters object me: The value returned from new
Notes  
Return value "ok" or error messages starting with "Error :"
Example theXtra.PlayStop()

IsSoundPlaying

Command format IsSoundPlaying object me
Description Checks is a sound is playing that was started with PlayStart
Parameters object me: The value returned from new
Notes  
Return value Returns 1, true, if playing; else 0, false
Example if theXtra.IsSoundPlaying() then ...etc

SaveAsMember

Command format SaveAsMember object me, integer castNumber, string memberName
Description Saves the recorded information into a cast member for playback and manipulation by Director Lingo commands. If the the member does not exist, it is created - if one exists, it is replaced. To play sound use Director lingo puppetsound.
Parameters object me: The value returned from new
integer castNumber: The cast number to save the member within.
string memberName: The name of the member to save the audio as.
Notes  
Return value "ok" or error messages starting with "Error :"
Example put theXtra.SaveAsMember(1,"TheSound")

SaveAsFile

Command format SaveAsFile object me, string pathAndFilename
Description Saves the recorded information into the named file. On Windows this is in WAV format and on the Macintosh it is an AIFF file. To play the sound use Director Lingo, sound playfile.
Parameters object me: The value returned from new
string pathAndFilename: The combined path to and/or fiename.
Notes Files saved on windows are in the wav format, on Macintosh as AIFF.
Return value "ok" or error messages starting with "Error :"
Example put theXtra.SaveAsFile("c:\theAudio.wav")

ShowErrorsAsDialogs

Command format ShowErrorsAsDialogs object objectRef, integer truOrFalse
Description Controls if error dialogs are shwn in addtion to the error return. Turn this off is you want your problem to handle errors without informing the user
Parameters objectRef: valid instance of UsbAccessXtra created with "new"
trueOrFalse: true to turn dialogs on, or false to turn them off
Notes  
Return value "ok" or "Error"
Example theXtra.ShowErrorsAsDialogs(0)

GetVersionString

Command format GetVersionString object objectRef
Description Obtain the version number of the xtra as a string. This may be requested when you are reporting bugs or interacting with PhysicalBits support.
Parameters objectRef: valid instance of UsbAccessXtra created with "new"
Notes  
Return value A version string.
Example put theXtra.GetVersionString()

GetLicensetype

Command format GetLicenseType object objectRef
Description Returns the license type for this xtra. #Author, #Demo or #Full
Parameters objectRef: valid instance of UsbAccessXtra created with "new"
Notes  
Return value #Author, #Demo or #Full
Example put theXtra.GetLicenseType()

GetDemoDaysRemaining

Command format GetDemoDaysRemaining object me
Description Returns the number of days remaining on a demo license. Returns 0 if authoring license, or a big number if a full license.
Parameters object me: The value returned from new
Notes  
Return value Integer number
Example put theXtra.GetDemoDaysRemaining()

privateInstance

Command format privateInstance
Description Private function
Parameters Private
Notes for the curious:
0 = invalid:
1 = internal error reporting, 0=off 1=on:
2 = flow control reporting, 0=off 1=on, 0-100 level:
3 = log messages to file, 0=off 1=on, filname:
Return value  
Example  

privateGlobal

Command format privateGlobal
Description Private
Parameters  
Notes  
Return value  
Example  

Known Issues

There are no outstanding issues at this time

Version History

Version
Date
Platform
Notes
1.0.12
2006-02-19
wintel
Bug fixes and new messages for turning GSIL on and off
1.0.8
2005-02-12
wintel
 
1.0.8
2005-02-12
osx
 
1.0.8
2005-02-12
os9
 
1.0.5
2004-07-26
wintel
 
1.0.5
2004-08-05
wintel
Cleanup and logging
1.0.5
2004-08-05
osx
Cleanup and logging
1.0.5
2004-08-05
os9
Cleanup and logging
1.0.4
0000-00-00
wintel
Bug fix:wintel Playing was not re-starting at the begining after stop
1.0.4
2004-00-00
osx
 
1.0.4
2004-00-00
os9
 

Conditions of use

In this document Xtra refers to this Xtra, and me refers to Geoff Smith. All rights to the XObject/Xtra are retained by me. The XObject may be used in any MacroMedia Director document for personal use and given to your friends. All documentation must be included when passing on the XObject/Xtra. Unless licensed you may NOT do the following ·distribute for profit without prior permission. ·distribute for profit within a Director presentation without prior permission ·distribute by CD-ROM without prior permission. ·distribute as part of a collection without prior permission ·be used in a public presentation without prior permission.
Financial liabilty for this product is limited to the purchase price or $1, whichever is greater.
All legal proceeding must be carried out under the auspices of the court of Santa Clara, California, USA. These conditions may be modified at any time. Please refer to the physicalbits website for the latest conditions.