Page History: Wave Player Element
Compare Page Revisions
Page Revision: 2011/07/19 13:30
|
New Element
|
Info |
Category: |
Auditory stimuli |
|
AddIn: |
Base Elements |
Creator: |
OkazoLab Team |
|
Scope: |
Parent Event |
Owns Snippets: |
no |
|
Usage: |
Runtime Screen,Snippets |
ASIO element is capable to play audio clips in the Waveform Audio File Format (WAV).
Description
ASIO element is capable to play audio clips in the Waveform Audio File Format (WAV) via a fast, low-level sound playback protocol called
Audio Stream Input/Output (ASIO). Using this protocol and compatible sound hardware (the last is essential) allow to achieve better temporal precision and fidelity compare to other sound playback APIs, for example DirectSound. The WAV format is adequate for majority of auditory stimuli -the multichannel sounds of various resolutions are supported. The ASIO element offers a basic management of the playback process (compare to DirectSound element): multiple sounds mixing (limited), changes in sound volume, balance and playback position.
Snapshots
Snapshot 1
| Snapshot 2 |
Practical Use
You can use this element to deliver rich auditory stimuli in experimental scenarios where very accurate timing is important. For the comparable temporal accuracy but better control on a playback process, use
DirectSound element. For simplest sound tones you can get even better temporal precision if you use the
Beeper element. Alternatively, in scenarios where temporal precision is not necessary, for example for a post-stimulus voice feedback, you can use the Audio Player element that supports the widest range of sound formats.
The ASIO element has few properties for tuning of the sound hardware (other settings are typically available via ASIO driver software). By element, the clip mixing can be switched on and off, and, with monitoring turn on, a basic playback statistics can be measured, like a real startup latency and actual playback duration at runtime. These settings affect the playback performance and, it's always a good idea to test the real playback empirically, with the current hardware, drivers and audio clips.
The element can be used even with sound hardware that does not support ASIO protocol directly. For this purpose you can download and install one of the WDM to ASIO drivers, available for Windows (e.g.
ASIO4ALL driver). However, in this case, the temporal accuracy of playback is normally quite poor.
Playback modes
The ASIO element can work in one of 2 playback modes which define temporal synchronization of the playback process:
Once modeIn this mode the element starts to play an audio synchronously with activation of the parent event. The audio is played once. When the playback stops you can initiate a new one manually if the parent event is still active.
Loop modeIn this mode the element starts to play an audio synchronously with activation of the parent event and automatically restarts the playback as soon as the end of the audio clip is reached. This playback loop lasts until deactivation of the parent event.
Manual mode (CURRENTLY NOT SUPPORTED IN THIS ELEMENT!!)
In this mode the element plays an audio by a manual request made in code snippets at will time. The playback is initiated by assigning true to the [IsPlaying] property of the element. Later, the same property can be used to monitor if the audio is still currently played. [IsPlaying] property automatically turns to false when the playback ends. At this moment and later you can initiate a new playback if the parent event is still active.
Design-time testing
While choosing appropriate values for the element's properties, check the content of the [Clip Info] property. It is refreshed after selection of an audio clip should not be empty or contain error messages. If you see an error, the playback is not possible, and you have to select another clip or choose different values for the element's properties. You can also always test an audio playback with the current element settings by clicking the [Test Playback] property.
- Note 1: Due to the nature of ASIO playback protocol a limited number of sound formats (among Wave formats) can be played by ASIO element- a typical playable format is the two-channels, 44.4kHz Wave raw audio. Test every selected audio clip via a special Test playback property of the ASIO element and recode your audio clips if necessary.
- Note 2: For better synchronization of the audio playback (in the Once and Loop playback modes), move the ASIO element at the top of the elements list in the parent event. Elements in the list get to work one by one, as soon as the parent event is activated, so the top position in the list will minimize possible delays.
Properties
Generic properties
Name | Description | Attributes | Value Type |
---|
Settings |
Test Playback | Use this action at the design time to initiate an testing playback with the current settings. | Design-time action |
Is Mixing | Indicates if ASIO playback allows simultaneous playback of several audio clips. If false, the better temporal accuracy can be achieved. All ASIO elements in experiment must have the same value for this property. | D | Boolean |
Playback mode | Defines the synchronization mode of the playback process. One of three modes can be selected:
Once – the sound playback is initiated synchronously with activation of the parent event and an audio clip is played once.
Loop- the start of sound playback is synchronized with activation of the parent event but, since that, an audio clip is played in a loop.
Manual – the sound playback is initiated manually by a request from code snippets. | D | List |
Monitor Playback | Defines if the element monitors the start and end playback times and is triggered at the end of the each single clip playback | D | Boolean |
Clip Info | Information about the currently loaded audio clip (via the resource list properties). Click to expand all sub-fields. | D | Struct |
Playback |
Volume | Defines the volume of the audio playback, in percentages, from 0 (ground) to 100 (full) | D,R | Int32 |
Balance | Defines the stereophonic balance of the audio playback, from 100 (most left) to 100 (most right) | D,R | Int32 |
Start position | Defines the start position of the audio playback in percentages (0..100) to the total duration of the currently selected audio clip. | D,R | Double |
Position | The current playback position in percentages (0..100) to the total duration of the currently played audio. The property can be used only at runtime. | D,R | Double |
Runtime info |
Start Time | If [Monitor Playback] property is true, this property stores the actual event time when the last playback started. Indicates the actual playback startup latency in ms if the "Once" playback mode is chosen. | R, Read-Only | UInt64 |
End Time | If [Monitor Playback] property is true, this property stores the actual event time when the last playback ended. [End Time]-[Start Time] indicates the actual duration of the last playback in ms. | R, Read-Only | UInt64 |
Was triggered | If [Monitor Playback] property is true, this property indicates if the element has been triggered at least once since activation of the parent event. The triggering occurs each time when the playback ends. | R, Read-Only | Boolean |
+=== Properties inherited from clLibraryElement ===
Name | Description | Constraints | Value Type | Upon Runtime Change |
---|
Material List |
Selected Index | Defines the index of the active item in the material list of the element. | | Int32 | A change causes the current item to be reloaded and an update of the element. |
Selected Item | Defines the name of the active item in the material list of the element. The name matches to a name of item in the Material Library | | String | A change causes the current item to be reloaded and an update of the element. |
Item Count | Returns the total number of items in the material list of the element. | | Int32 |
Equalize RGB | The property is only available in the visual element. If the value is true, the average RGB pixel intensity will be equalized across all items in the material list. You can turn on this property, when you need to obtain a luminance-balanced set of visual stimulus. | | Boolean | |
+=== Properties inherited from clElement ===
Inherited properties of clElement
Name | Description | Constraints | Value Type | Upon Change |
---|
Control |
Is Enabled | If set to false the element is completely omitted when the experiment is run. | | Boolean |
|
Title | Title of the element. | | String |
|
The list of Text element properties:
Resource Holder inherited properties
CATEGORY ,Property name | Description | type | Value type |
RESOURCE LIST |
Resource index | The index of item in the resource list that is currently used by the element. Notice, that index starts from 1. | D,R,* | Int32 |
Resource count | The number of items loaded in the resource list of the element | D,R,Read-only | Int32 |
|