|
1 | 1 | % (C) Copyright 2021 CPP LePoulpe developers |
2 | 2 |
|
3 | | -% this is the main script to present auditory or visual motion in LePoulpe |
4 | | -% it calls generate sounds (white, pink, brown noise) in a given length and |
| 3 | +% This demo presents auditory or visual motion on LePoulpe. |
| 4 | +% It generates sound noises (white, pink, brown noise) in a given length and |
5 | 5 | % cuts the sound array into chunks to play each chunk in a speaker. |
| 6 | +% |
| 7 | +% For visual motion it activates LEDs in a given speed, plane (horizontal, |
| 8 | +% vertical). |
6 | 9 |
|
7 | | -% for visual motion it activates LEDs in a given speed, plane (horizontal, |
8 | | -% vertical), and plays them in a given number of repetitions |
9 | | - |
10 | | -% if the suer control is needed, please provide that. Otherwise it loops |
11 | | - |
12 | | -% through the repetitions with 5s wait time. |
| 10 | +run(fullfile('..', 'initLePoulpe.m')); |
13 | 11 |
|
14 | 12 | pacedByUser = false; |
15 | 13 |
|
16 | 14 | waitForAWhile = 0; |
17 | 15 |
|
| 16 | +%% set cfg for LEDs |
| 17 | +speed = .03; |
| 18 | +nbRepetitionLED = 1; |
18 | 19 |
|
19 | | -%% prepare sounds to be played |
| 20 | +%% set cfg for sounds |
20 | 21 | fs = 44100; |
21 | 22 | saveAsWav = 1; |
22 | 23 | duration = 0.8; |
| 24 | +nbRepetitionSound = 2; |
| 25 | +waitForSwtich = 1; |
23 | 26 |
|
24 | 27 | % outSound = generateNoise('white', duration, saveAsWav, fs); |
25 | 28 | outSound = generateNoise('pink', duration, saveAsWav, fs); |
|
40 | 43 | speakerIdxUpward = generateMotionSpeakerArray('upward'); |
41 | 44 |
|
42 | 45 | %% play sounds (auditory motion) |
43 | | -nbRepetition = 2; |
44 | | - |
45 | | -waitForSwtich = 1; |
46 | | - |
47 | 46 | pressSpaceForMeOrWait(pacedByUser, waitForAWhile) |
| 47 | + |
48 | 48 | playMotionSound('horizontal', ... |
49 | 49 | speakerIdxRightward, ... |
50 | 50 | soundArray, ... |
51 | | - nbRepetition, ... |
| 51 | + nbRepetitionSound, ... |
52 | 52 | waitForSwtich); |
53 | 53 |
|
54 | 54 | pressSpaceForMeOrWait(pacedByUser, waitForAWhile) |
| 55 | + |
55 | 56 | playMotionSound('horizontal', ... |
56 | 57 | speakerIdxLeftward, ... |
57 | 58 | soundArray, ... |
58 | | - nbRepetition, ... |
| 59 | + nbRepetitionSound, ... |
59 | 60 | waitForSwtich); |
60 | 61 |
|
61 | 62 | pressSpaceForMeOrWait(pacedByUser, waitForAWhile) |
| 63 | + |
62 | 64 | playMotionSound('vertical', ... |
63 | 65 | speakerIdxDownward, ... |
64 | 66 | soundArray, ... |
65 | | - nbRepetition, ... |
| 67 | + nbRepetitionSound, ... |
66 | 68 | waitForSwtich); |
67 | 69 |
|
68 | 70 | pressSpaceForMeOrWait(pacedByUser, waitForAWhile) |
| 71 | + |
69 | 72 | playMotionSound('vertical', ... |
70 | 73 | speakerIdxUpward, ... |
71 | 74 | soundArray, ... |
72 | | - nbRepetition, ... |
| 75 | + nbRepetitionSound, ... |
73 | 76 | waitForSwtich); |
74 | 77 |
|
75 | 78 | %% play LEDs (visual motion) |
76 | | -speed = .03; |
77 | | -nbRepetition = 1; |
78 | 79 |
|
79 | 80 | pressSpaceForMeOrWait(pacedByUser, waitForAWhile) |
| 81 | + |
80 | 82 | playVisualMotion('rightward', ... |
81 | 83 | speed, ... |
82 | 84 | 2, ... |
83 | | - nbRepetition); |
| 85 | + nbRepetitionLED); |
84 | 86 |
|
85 | 87 |
|
86 | 88 | pressSpaceForMeOrWait(pacedByUser, waitForAWhile) |
| 89 | + |
87 | 90 | playVisualMotion('leftward', ... |
88 | 91 | speed, ... |
89 | 92 | 2, ... |
90 | | - nbRepetition) |
| 93 | + nbRepetitionLED) |
91 | 94 |
|
92 | 95 |
|
93 | 96 | pressSpaceForMeOrWait(pacedByUser, waitForAWhile) |
| 97 | + |
94 | 98 | playVisualMotion('downward', ... |
95 | 99 | speed, ... |
96 | 100 | 1, ... |
97 | | - nbRepetition) |
| 101 | + nbRepetitionLED) |
98 | 102 |
|
99 | 103 |
|
100 | 104 | pressSpaceForMeOrWait(pacedByUser, waitForAWhile) |
| 105 | + |
101 | 106 | playVisualMotion('upward', ... |
102 | 107 | speed, ... |
103 | 108 | 1, ... |
104 | | - nbRepetition) |
| 109 | + nbRepetitionLED) |
0 commit comments