durationSeconds specifies the length of the playback event measured on the
main timeline. If this is shorter than the underlying source audio file,
playback of the audio file will be truncated. To calculate where in the
source audio file playback ends, use .getEndInSourceSeconds()
.
Fade in time in seconds
Fade out time in seconds
Gain in dBFS applied to the sample. 0 is unity gain
Information and metadata pertaining to the source audio file
Named events within the source file
Audio file playback mode. See AudioFileMode
The name as it should show up in an audio editor
Stereo pan as bipolar number form -1 to 1
path to the underlying audio file
Adjust the pitch of the sample in semitones.cents
Audio file playback rate. Setting this to 0.5 will playback they audio at
half speed (and an octave lower). Setting this to a negative value will
case reverse playback. If this is set to a negative value,
startInSourceSeconds
should be set to a positive value. Note that you
use also use the .reverse()
method which will update the startInSource
value for you.
startInSourceSeconds specifies the beginning of the region of interest
within the audio source file. Set this to zero to play from the beginning.
This measures the start point within the source material, assuming a 1x
.playbackRate
(even when this.playbackRate != 1
). Notice that you
cannot use startInSourceSeconds + durationSeconds
to calculate the
"endInSourceSeconds".
To calculate the position in the source audio file that playback ends, use
.getEndInSourceSeconds()
, which correctly accounts for the value of
.playbackRate
.
The time within the parent (track) that this sample will be triggered
Check the AudioFile for potential problems. If problems are found, return an error message string. Otherwise, return null
Techniques may have a finalize method, which will be invoked in when
calling session.finalize()
for each unique finalize function that was
inserted via session.insertScore(...)
since the last call to
session.finalize
. Note that the when finalize methods are not associated
with any particular technique instance, so .this
will be undefined inside
the finalize method invocation.
The order that finalizers will be called in is undefined. It's a good idea to make finalizers idempotent because a finalizer may be called more than one if the user does the following:
session.finalize() // finalizer invoked a second time
Identify where within the source file playback will end, given the values
of .startInSourceSeconds
, .durationSeconds
, and .playbackRate
.
Calculate and return the maximum valid value for .durationSeconds
.
Setting the .durationSeconds
value to the value returned by this function
will result in the underlying audio file being played to the end of the
underlying audio source object (or to the beginning, if .playbackRate
is
negative.
audioFile.durationSeconds = audioFile.getMaxDurationSeconds()
When the file is NOT reversed, the source file length is used, so make sure
that audioFile.info.duration
exists.
Return the length of the source audio file in seconds. If the length is not included in .info, print a WARNING message, and return an arbitrary value.
Return the length of the source audio file given the current .playbackRate. This will be the maximum length of the event, assuming the value of .startInSource does not trim the fileEvent.
The "left tail" is the source content that gets trimmed during playback
when (for example), the .startInSourceSeconds
offsets the beginning of
the playback within the underlying source audio file.
If the .startInSourceSeconds
property is 1, then the "left tail" will
also be 1 (assuming .playbackRate == 1
).
This method will calculate the duration of the lead-in tail correctly even
when audio is playing in reverse (because of a negative .playbackRate
)
Note that there is an inverse relationship between the absolute value of
.playbackRate
and the tail length, because slowing the playback rate of
the source file effectively increases the length of the underlying sample.
A duration (measured in seconds on the timeline) of the lead-in tail of this audio item.
The "right tail" is the source content that gets truncated during playback
when (for example), the .durationSeconds
ends playback before the end
of the underlying source audio file.
If source audio file duration is 5 seconds, and the .durationSeconds
property is 4 seconds, then the "right tail" will be 1 second (assuming
.playbackRate == 1
and .startInSourceSeconds == 0
).
This method will calculate the duration of the trailing tail even when
audio is playing in reverse (because of a negative .playbackRate
or when
.startInSourceSeconds != 0
).
Note that there is an inverse relationship between the absolute value of
.playbackRate
and the tail length, because slowing the playback rate of
the source file effectively increases the length of the underlying sample.
A duration (measured in seconds on the timeline) of the trailing tail of this audio item.
Move the left edge of the item without moving the contents of the item on the timeline.
Positive values make the item longer by moving the left edge
to the left. Negative values make the item shorter by moving the left edge
to the right. This value is be measured on the timeline, and not in the
audiofile source (an important distinction when this.playbackRate != 1
).
Move the right edge of the item without moving the contents of the item on the timeline.
Positive values make the item longer by moving the right
edge to the right. Negative values make the item shorter by moving the
right edge to the left. This value is be measured on the timeline, and not
in the audiofile source (an important distinction when
this.playbackRate != 1
).
Set the event's .durationSeconds
so that it plays right up to the end of
the source. This takes into account .playbackRate
, .isReversed()
, and
.startInSourceSeconds
.
Reverse the audio file playback, swapping the in/out fades.
Convenience method for setting audio file markers
Set playbackRate for the clip, stretching the duration proportionally. A
negative value will result in a reversed clip, where a positive value will
result in a non-reversed clip. If playbackRate
causes the playback
direction to change, .startInSource
will also be updated so as to
maintain the playback region within the source audio file.
Note that cybr only accepts values in [-10, -0.02] and [0.02 to 10].
Create a copy of an AudioFile
technique, optionally applying changes to
the copy before returning it. This is useful in situations when you want
variations of an audioFile with different properties.
Note that the value returned will be an AudioFile
even if the first
argument is an instance of a class derived from AudioFile
. As a result,
the output object will not be an exact copy if audioFileTechnique
is
derived from techniques.AudioFile
.
const newAudioFile = AudioFile.copy(someAudioFile)
The input AudioFile
technique to copy
The resulting AudioFile
will
A copied version of the input audio file technique
Insert an audio sample into a track.
Note that base class
FluidAudioFile
has many useful methods and properties for trimming, fading, reversing, etc.