Developer Manual

advertisement
Psychophysics Software Suite (PSS)
Developer Manual
Contents
Class Diagrams .............................................................................................................................................. 2
Sound Classes ............................................................................................................................................ 2
Sound Class – abstract basic class, all other sound classes inherit it methods and properties............ 3
GapSound Class – gapped sound .......................................................................................................... 3
PureSound Class – pure tone sound ..................................................................................................... 3
NoiseSound Class – noise based sound ................................................................................................ 4
AccordSound Class – accord (multiple tone) sound ............................................................................. 4
ModulatedSound Class – AM or FM modulated sound ........................................................................ 5
CreateGapSound Class – GUI applet for GapSound class constructor.................................................. 5
CreatePureSound Class – GUI applet for PureSound class constructor................................................ 6
CreateNoiseSound Class – GUI applet for NoiseSound class constructor ............................................ 6
CreateAccordSound Class – GUI applet for AccordSound class constructor ........................................ 7
CreateModulatedSound Class – GUI applet for ModulatedSound class constructor ........................... 7
ChooseSound Class – GUI applet used to facilitate different Sound classes creation .......................... 7
Tools Classes ............................................................................................................................................. 8
Tools Class – GUI applet facilitates the launch of PSS tools ................................................................. 9
CreateTest Class – GUI applet facilitates the creation and management of PSS tests ......................... 9
Analysis Tool Class – GUI applet facilitates the analysis of PSS tests ................................................. 10
Test Class – software representation of PSS test................................................................................ 10
Block Class – software representation of PSS test’s block .................................................................. 11
Block State Machine Diagram ............................................................................................................. 13
Delta change algorithm diagram......................................................................................................... 14
GUI Classes .......................................................................................................................................... 15
Class Diagrams
VisualClass
Paradigm for UML Community Edition [not for commercial use]
Sound Classes
Sound
2
1
+duration : int
+intensity : int
-sample_frequency : int
-bits : int
+play()
+generate()
+getType()
+clone()
+Sound() : Sound
1
1
GapSound
PureSound
NoiseSound
AccordSound
ModulatedSound
+gap : int
+frequency : int
+start_frequency : int
+frequencies : int[]
+message_sound : Sound
-sound1 : Sound
+PureSound() : PureSound
+stop_frequency : int
+AccordSound() : AccordSound
+mod_depth : int
-sound2 : Sound
+play()
+NoiseSound() : NoiseSound
+play()
+mod_type : Modulation
+GapSound() : GapSound
+generate()
+play()
+generate()
+carrier_frequency : int
+play()
+getType()
+generate()
+getType()
+ModulatedSound() : ModulatedSound
+generate()
+clone()
+getType()
+clone()
+play()
+getType()
+clone()
+generate()
+clone()
+getType()
+clone()
CreateGapSound
CreatePureSound
CreateNoiseSound
ChooseSound
CreateAccordSound
CreateModulatedSound
Sound Class – abstract basic class, all other sound classes inherit it methods and properties
Properties
 duration – sound’s playback duration in ms

intensity – sound’s intensity, can vary from 0 to 1, when above one clipping occurring

sample frequency – sample frequency of sound, default value 44000 Hz

bits – sound’s bit resolution, the default value 16 bit
Methods
 play() – abstract function to play the sound

generate() – abstract function to generate the sound’s data

getType() – abstract function returns the sound’s type

clone() – abstract copy-constructor

Sound() – constructor
GapSound Class – gapped sound
Properties
 gap – gap duration in ms
Methods
 GapSound() – constructor

play() – implementation of abstract function to play the sound

generate() – implementation of abstract function to generate the sound’s data

getType() – implementation of abstract function returns the sound’s type

clone() – implementation of abstract copy-constructor
PureSound Class – pure tone sound
Properties
 frequency – tone frequency
Methods
 PureSound() – constructor

play() – implementation of abstract function to play the sound

generate() – implementation of abstract function to generate the sound’s data

getType() – implementation of abstract function returns the sound’s type

clone() – implementation of abstract copy-constructor
NoiseSound Class – noise based sound
Properties
 start_frequency – defines the start frequency of band-pass filter

stop_frequency – defines the stop frequency of band-pass filter
Band –pass filter is based on Fourier transform. When both start_frequency and stop_frequency are
zero, no filtering occurs. Noise sound is generated each time the sound needs to be played.
Methods
 NoiseSound() – constructor

play() – implementation of abstract function to play the sound

generate() – implementation of abstract function to generate the sound’s data

getType() – implementation of abstract function returns the sound’s type

clone() – implementation of abstract copy-constructor
AccordSound Class – accord (multiple tone) sound
Properties
 frequencies – tones’ frequency
Methods
 AccordSound() – constructor

play() – implementation of abstract function to play the sound

generate() – implementation of abstract function to generate the sound’s data

getType() – implementation of abstract function returns the sound’s type

clone() – implementation of abstract copy-constructor
ModulatedSound Class – AM or FM modulated sound
Properties
 sound – sound that used as data to be modulated , derived from Sound class

mod_depth – depth (index) of the modulation ( see the formula below for details )

mod_type – type of the modulation, can be either amplitude(AM) or frequency(FM) modulation

mod_frequency – modulation frequency (Ωm)
AM modulation: x(t) = [1+ mod_depth ·sin (2π Ωmt)] · sound
FM modulation: x(t) = cos [2π sound + mod_depth · sin (2π Ωmt)]
Methods
 ModulatedSound() – constructor

play() – implementation of abstract function to play the sound

generate() – implementation of abstract function to generate the sound’s data

getType() – implementation of abstract function returns the sound’s type

clone() – implementation of abstract copy-constructor
CreateGapSound Class – GUI applet for GapSound class constructor
CreatePureSound Class – GUI applet for PureSound class constructor
CreateNoiseSound Class – GUI applet for NoiseSound class constructor
CreateAccordSound Class – GUI applet for AccordSound class constructor
CreateModulatedSound Class – GUI applet for ModulatedSound class constructor
ChooseSound Class – GUI applet used to facilitate different Sound classes creation
Visual Paradigm
Class for UML Community Edition [not for commercial use]
Tools Classes
executes
launches
Run Tool
+RunTest()
Block
Test
+name : String
+name : Sting
+theme : String
+create_time : int
manages
+blocks : Block[]
CreateTest (Test Tool)
Tools
+TestTool()
+filename : String
+newTest()
launches
+RunTool()
+current_block : Block
+openTest()
+saveTest()
+AnalysisTool()
+play_time : int
+editBlock()
+addBlock()
+removeBlock()
+moveUp()
+moveDown()
+test : Test
consist of
1..*
+reference_sound : Sound
+step_mode : IncrementType
+based_on : BlockType
+start_at : int
+Test(name) : Test
+stop_at : int
+play()
+step_on : Parameter
+save()
+delta : int
+addBlock(block)
+ISI : int
+removeBlock(block)
+ITI : int
+up(block_number)
+task : String
+down(block_number)
+big_step : int
+int_step : int
+smal_step : int
+big2int : int
launches
Analysis Tool
analyzes
+AnalyseTest()
+int2small : int
+small2end : int
+total2end : int
-GUI : JavaMainFrame
-current_delta : int
<<enumeration>>
<<enumeration>>
-current_value : int
Parameter
BlockType
-current_mode : int
+duration
+reversals
+frequency
+trials
-current_mode_steps : int
-current_direction : int
-last_direction : int
+intensity
-total_steps : int
+mod_frequency
-correct_answers : int
+mod_depth
<<enumeration>>
+start_frequency
Modulation
+stop_frequency
+noise_intensity
-wrong_answers : int
-answers : int[]
+AM
-semaphore : Semaphore
+FM
+Block() : Block
+setTest(test)
+play()
<<enumeration>>
IncrementType
+additive
+multiplicative
+check(answer)
+next(answer)
+enableGUI()
+disableGUI()
+start(code)
+stop(code)
Tools Class – GUI applet facilitates the launch of PSS tools
CreateTest Class – GUI applet facilitates the creation and management of PSS tests
Methods
 newTest() – creates new PSS test

openTest() – opens saved PSS test

saveTest() – saves the current open PSS test

addBlock() – adds the Block to PSS test

editBlock() – enable the user to edit PSS test’s block

removeBlock() – removes the selected block from the current PSS test

moveUp() – places the selected block one position up in PSS test block’s list

moveDown() – places the selected block one position down in PSS test block’s list

exit() – exits the tool
Analysis Tool Class – GUI applet facilitates the analysis of PSS tests
Test Class – software representation of PSS test
Properties
 name – name of the test

create_time – time of the PSS test creation

play_time – time of PSS test execution

filename – name of the file to save the PSS test’s results

blocks – array of Blocks that belong to this PSS test

current_block – the currently processing Block
Methods
 Test(name) – Test class constructor

play() – starts the test execution

addBlock(block) – adds the block to the test

removeBlock(block) –removes the block from the test

up(block_number) – places the block one step up

down(block_number) – places the block one step down

save() – save all test data into filename file
Block Class – software representation of PSS test’s block
Properties
 name – name of the block , must be unique within the same test

theme – theme of the block GUI

test – the test that block belongs to

reference_sound – reference sound of the block

step_mode – the mode of block execution, may be additive ( delta parameter is added to the
block‘s current value ) or mulplicative ( the block current value is multiplied by the delta
parameter )

based_on – specifies the parameter of the reference sound to be modified during the block
execution

start_at – the value the block will start with

stop_at – the value the block will not exceed during its execution

delta – the parameter that defines the amount of the block’s value change

ISI – Inter Stimulus Interval

ITI – Inter Trial Interval

task – the string that defines block’s GUI options , has to be in ‘abx’ form

big_step – specifies the number of big steps ( step may be both trial and reversal )

intermediate_step – specifies the number of intermediate steps

small_step – specifies the number of small steps

total2end – specifies the number of total trials

GUI – stores the reference to block’s GUI object

current_delta – current block delta parameter

current_value – current block value

current_mode – current block mode , may be big, intermediate, small or end

current_mode_steps – steps performed during current mode

current_direction – specifies the current direction of value change, it may be up or down

last_direction – specifies the last direction of value change, it may be up or down

total_steps – the total number of steps performed up to present time

correct_answers – number of correct answers to trigger the value change, default value is 3

wrong_answers – number of incorrect answers to trigger the value change, default value is 1

answers – an array to store the answers up to present time

semaphore – a test’s field used to synchronize different blocks’ execution, was used due to lack
of build in sync mechanism in Matlab
Methods
 Block(name) – Block class constructor

start(code) – starts the block execution, if code=1 then the block is started in running mode, if
code=0, then the block is initially paused

stop(code) – if code=0 then pauses the block execution, if code=1 then the block and test
execution is terminated

play() – plays the current trial’s sounds

check(answer) – checks if the answer selected by user is correct and modifies the current value
accordingly.

next(answer) – displays the GUI animation according to correctness of the answer and then
plays the next trial’s sounds

enableGUI() – enables the block’s GUI user accessible callbacks

disableGUI() – disables the block’s GUI user accessible callbacks
Visual Paradigm for UML Community Edition [not for commercial use]
Block State Machine Diagram
The block execution is paused
start(0)
start(1)
stop(0)
The block execution is active
stop(1)
play()
Playing the trials sounds
next()
stop(1)
Waiting for user input
check(answer)
Performing the change
Delta change algorithm diagram
Initial Values
V=start_at – reference_value
D=delta
Answer
Correct
Wrong
V>0
V<0
Add.
Mul
t.
Add.
V=V-D
V=V/D
V=V+D
Definitions
D – delta
V – current_delta
Add. – Additive delta change mode
Mult. – Multiplicative delta change mode
V>0
Mul
t.
V=V/D
V<0
Add.
Mul
t.
Add.
Mul
t.
V=V+D
V=V*D
V=V+D
V=V*D
GUI Classes
The description of GUI Classes diagram from above can be found here.
Download