Skip to content

Commit 23d6481

Browse files
Merge pull request #25 from marcobarilari/marco_reorganize
Reorganize the folder and give some shape for future use
2 parents dfc160f + 7444a60 commit 23d6481

6 files changed

Lines changed: 47 additions & 28 deletions

File tree

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
# LePoulpe
2-
In this repo, one can find developing sound bar scripts
2+
3+
This repo contains basic code to generate motion (auditory and visual) with Le Poulpe. It is a rookie release.
4+
5+
In the 'demo' folder there are some examples on how to use the functions inside 'src'.
Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
% (C) Copyright 2021 CPP LePoulpe developers
22

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
55
% 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).
69

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'));
1311

1412
pacedByUser = false;
1513

1614
waitForAWhile = 0;
1715

16+
%% set cfg for LEDs
17+
speed = .03;
18+
nbRepetitionLED = 1;
1819

19-
%% prepare sounds to be played
20+
%% set cfg for sounds
2021
fs = 44100;
2122
saveAsWav = 1;
2223
duration = 0.8;
24+
nbRepetitionSound = 2;
25+
waitForSwtich = 1;
2326

2427
% outSound = generateNoise('white', duration, saveAsWav, fs);
2528
outSound = generateNoise('pink', duration, saveAsWav, fs);
@@ -40,65 +43,67 @@
4043
speakerIdxUpward = generateMotionSpeakerArray('upward');
4144

4245
%% play sounds (auditory motion)
43-
nbRepetition = 2;
44-
45-
waitForSwtich = 1;
46-
4746
pressSpaceForMeOrWait(pacedByUser, waitForAWhile)
47+
4848
playMotionSound('horizontal', ...
4949
speakerIdxRightward, ...
5050
soundArray, ...
51-
nbRepetition, ...
51+
nbRepetitionSound, ...
5252
waitForSwtich);
5353

5454
pressSpaceForMeOrWait(pacedByUser, waitForAWhile)
55+
5556
playMotionSound('horizontal', ...
5657
speakerIdxLeftward, ...
5758
soundArray, ...
58-
nbRepetition, ...
59+
nbRepetitionSound, ...
5960
waitForSwtich);
6061

6162
pressSpaceForMeOrWait(pacedByUser, waitForAWhile)
63+
6264
playMotionSound('vertical', ...
6365
speakerIdxDownward, ...
6466
soundArray, ...
65-
nbRepetition, ...
67+
nbRepetitionSound, ...
6668
waitForSwtich);
6769

6870
pressSpaceForMeOrWait(pacedByUser, waitForAWhile)
71+
6972
playMotionSound('vertical', ...
7073
speakerIdxUpward, ...
7174
soundArray, ...
72-
nbRepetition, ...
75+
nbRepetitionSound, ...
7376
waitForSwtich);
7477

7578
%% play LEDs (visual motion)
76-
speed = .03;
77-
nbRepetition = 1;
7879

7980
pressSpaceForMeOrWait(pacedByUser, waitForAWhile)
81+
8082
playVisualMotion('rightward', ...
8183
speed, ...
8284
2, ...
83-
nbRepetition);
85+
nbRepetitionLED);
8486

8587

8688
pressSpaceForMeOrWait(pacedByUser, waitForAWhile)
89+
8790
playVisualMotion('leftward', ...
8891
speed, ...
8992
2, ...
90-
nbRepetition)
93+
nbRepetitionLED)
9194

9295

9396
pressSpaceForMeOrWait(pacedByUser, waitForAWhile)
97+
9498
playVisualMotion('downward', ...
9599
speed, ...
96100
1, ...
97-
nbRepetition)
101+
nbRepetitionLED)
98102

99103

100104
pressSpaceForMeOrWait(pacedByUser, waitForAWhile)
105+
101106
playVisualMotion('upward', ...
102107
speed, ...
103108
1, ...
104-
nbRepetition)
109+
nbRepetitionLED)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
run(fullfile('..', 'initLePoulpe.m'));
12

23
pacedByUser = true;
34

src/playSong.m renamed to demo/playSong.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
run(fullfile('..', 'initLePoulpe.m'));
12

23
soundPath = fullfile(fileparts(mfilename('fullpath')), '..', ...
3-
['input' filese 'song' filesep 'technologic.wav');
4+
['input' filese 'song' filesep 'technologic.wav']);
45

56
% soundPath = 'C:\Users\local-admin\Documents\MATLAB\Google\song\belgian_anthem.wav';
67

initLePoulpe.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
% (C) Copyright 2021 CPP LePoulpe developers
2+
3+
function initLePoulpe()
4+
5+
thisDirectory = fileparts(mfilename('fullpath'));
6+
7+
addpath(genpath(fullfile(thisDirectory, 'src')));
8+
9+
end

src/generateMotionSpeakerArray.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% (C) Copyright 2021 CPP LePoulpe developers
22

3-
function speakerIdx = generateMotionSpeakerArray(input)
3+
function speakerIdx = generateMotionSpeakerArray(direction)
44

55
% map the arms with directions
66

@@ -22,9 +22,9 @@
2222
vertDownToCenterMinusOne = 16:30;
2323
vertCenterPlusOnetoUp = 15:-1:1;
2424

25-
% create the entire
25+
% create the entire speakers array with their index
2626

27-
switch input
27+
switch direction
2828

2929
case 'rightward'
3030

0 commit comments

Comments
 (0)