Page History: Beeper Element
Compare Page Revisions
Page Revision: 2011/07/20 13:54
|
New Element
|
Info |
Category: |
|
|
AddIn: |
Base Elements |
Creator: |
OkazoLab Team |
|
Scope: |
Parent Event |
Owns Snippets: |
no |
|
Usage: |
Runtime Screen,Snippets |
Beeper element can generate and play a square sound wave (beep) of the requested frequency and duration.
Description
Beeps are played by a hardware tone generator called
PC speaker. Due to simple hardware implementation, the sound generation and playback via PC speaker is characterized by a high temporal precision which is barely possible with the conventional sound cards. However, PC speaker cannot play complex sounds other than single tones and also has a little control on the playback process. You can use this element to generate auditory stimuli in the experimental scenarios where very accurate timing is important and simple sounds are sufficient. If you wish to have more controllable and complex auditory stimuli (still with a good temporal precision of playback) use the
DirectSound element. Alternatively, in scenarios where temporal precision is not necessary you can use the Audio Player element that supports the widest range of sound formats.
Snapshots
Snapshot 1
| Snapshot 2 |
Practical Use
The Beeper element can work in one of two working modes that define the synchronization of the sound playback:
Manual working mode
In this mode the element plays a beep on a manual request made in code snippets at will time. The playback is initiated as the element's property [IsPlaying] is assigned to true. Later, the same property can be used to monitor if the initiated beep is still currently playing. [IsPlaying] property automatically turns to false when the initiated playback ends. At this moment and later you can initiate a new playback under a condition that the parent event is still active.
Auto working mode
In this mode the element starts to play a beep synchronously with activation of the parent event.
IsPlaying property can be used to monitor if the initiated beep is still currently playing. In this working mode you can initiate a playback manually (by assigning true to IsPlaying property) only after the synchronized playback ends.
Notes
- If the element starts generating and playing a beep, it becomes locked in hardware- the playback cannot be stopped before the predefined beep duration is exceeded, even if the parent event is deactivated at that time. Be always aware about how the requested duration matches a flow of your experiment. However, you can initiate a beep in another Beeper element in order to overwrite the currently playing sound in PC speaker. For instance, with this technique, you can initiate a short beep with frequency 1 (unheard) to force the actual silence of the PC speaker at any time.
- For better synchronization of the initiated playback (Auto working mode), move the Beeper 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 |
Working mode | Defines the working mode for the element. One of two modes can be selected:
Manual – the sound playback is initiated manually by a request from code snippets.
Auto- the start of sound playback is synchronized with activation of the parent event. | D | Int32 |
Test beep | Use this action at the design time to initiate a beep in PC speaker with the current beep settings. | Design-time action |
Beep |
Frequency | Defines the beep frequency (in Hz) has to be grater then 0. The heard range is from 20 to 20000 Hz. | D,R | Int32 |
Duration | Defines the beep duration (in ms) | D,R | Uint64 |
Is Playing | Indicates, if a beep is currently playing. In the manual mode, if assigned to true, initiates a new playback. | R | Boolean |
Runtime info |
Start time | Indicates the local event time when a beep has been started (in ms). In the auto mode, is expected to be 0. | D,R | Uint64 |
+=== 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 |
|