Spaces:
Sleeping
Sleeping
layering works
Browse files- app.log +452 -0
- app.py +116 -185
- config.py +3 -3
- sound_library.py +40 -38
app.log
ADDED
|
@@ -0,0 +1,452 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
π§ EEG Motor Imagery Music Composer
|
| 2 |
+
==================================================
|
| 3 |
+
Starting Gradio application...
|
| 4 |
+
π― New random sequence (5 movements): Left Leg β Right Leg β Right Hand β Left Hand β Tongue
|
| 5 |
+
Loaded sound for left_hand: 1_SoundHelix-Song-6_(Bass).wav
|
| 6 |
+
Loaded sound for right_hand: 1_SoundHelix-Song-6_(Drums).wav
|
| 7 |
+
Loaded sound for left_leg: 1_SoundHelix-Song-6_(Other).wav
|
| 8 |
+
Loaded sound for tongue: 1_SoundHelix-Song-6_(Vocals).wav
|
| 9 |
+
Loaded sound for right_leg: 1_SoundHelix-Song-6_(Bass).wav
|
| 10 |
+
Dropped auxiliary channels [np.str_('X5')]. Remaining channels: 21
|
| 11 |
+
Creating RawArray with float64 data, n_channels=21, n_times=667600
|
| 12 |
+
Range : 0 ... 667599 = 0.000 ... 3337.995 secs
|
| 13 |
+
Ready.
|
| 14 |
+
Not setting metadata
|
| 15 |
+
959 matching events found
|
| 16 |
+
No baseline correction applied
|
| 17 |
+
0 projection items activated
|
| 18 |
+
Using data from preloaded Raw for 959 events and 301 original time points ...
|
| 19 |
+
0 bad epochs dropped
|
| 20 |
+
Dropped auxiliary channels [np.str_('X5')]. Remaining channels: 21
|
| 21 |
+
Creating RawArray with float64 data, n_channels=21, n_times=681400
|
| 22 |
+
Range : 0 ... 681399 = 0.000 ... 3406.995 secs
|
| 23 |
+
Ready.
|
| 24 |
+
Not setting metadata
|
| 25 |
+
958 matching events found
|
| 26 |
+
No baseline correction applied
|
| 27 |
+
0 projection items activated
|
| 28 |
+
Using data from preloaded Raw for 958 events and 301 original time points ...
|
| 29 |
+
0 bad epochs dropped
|
| 30 |
+
Dropped auxiliary channels [np.str_('X5')]. Remaining channels: 21
|
| 31 |
+
Creating RawArray with float64 data, n_channels=21, n_times=813600
|
| 32 |
+
Range : 0 ... 813599 = 0.000 ... 4067.995 secs
|
| 33 |
+
Ready.
|
| 34 |
+
Not setting metadata
|
| 35 |
+
960 matching events found
|
| 36 |
+
No baseline correction applied
|
| 37 |
+
0 projection items activated
|
| 38 |
+
Using data from preloaded Raw for 960 events and 301 original time points ...
|
| 39 |
+
0 bad epochs dropped
|
| 40 |
+
Not setting metadata
|
| 41 |
+
2877 matching events found
|
| 42 |
+
No baseline correction applied
|
| 43 |
+
β
Pre-trained model loaded successfully from shallow_weights_all.pth
|
| 44 |
+
β
Pre-trained model loaded successfully from shallow_weights_all.pth
|
| 45 |
+
Pre-trained Demo: 2877 samples from 3 subjects
|
| 46 |
+
Available sound classes: ['left_hand', 'right_hand', 'neutral', 'left_leg', 'tongue', 'right_leg']
|
| 47 |
+
* Running on local URL: http://0.0.0.0:7867
|
| 48 |
+
* To create a public link, set `share=True` in `launch()`.
|
| 49 |
+
π― New random sequence (5 movements): Right Leg β Tongue β Right Hand β Left Hand β Left Leg
|
| 50 |
+
π Starting Cycle 2
|
| 51 |
+
πͺ Let's create your first brain-music composition!
|
| 52 |
+
DEBUG start_automatic_composition: current target = right_leg
|
| 53 |
+
DEBUG: Added layer 1, total layers now: 1
|
| 54 |
+
DEBUG: Composition layers: ['left_leg']
|
| 55 |
+
DEBUG: Current composition has 1 layers: ['left_leg']
|
| 56 |
+
DEBUG: Audio files to mix: ['1_SoundHelix-Song-6_(Other).wav']
|
| 57 |
+
DEBUG: Using base audio file as fallback: 1_SoundHelix-Song-6_(Vocals).wav (FILE SAVING DISABLED)
|
| 58 |
+
β Cycle 2: Added 1_SoundHelix-Song-6_(Other).wav for left_leg (1/5 complete)
|
| 59 |
+
DEBUG start_automatic_composition: predicted=left_leg, confidence=0.413, sound_added=True
|
| 60 |
+
DEBUG: Available sounds: ['left_hand', 'right_hand', 'left_leg', 'tongue', 'right_leg']
|
| 61 |
+
DEBUG: Completed movements: {'left_leg'}
|
| 62 |
+
DEBUG: Showing individual sounds that will layer together: ['left_leg']
|
| 63 |
+
DEBUG: Left leg playing: /Users/sofiafregni/Downloads/portfolio_ML_project/Gradio/sounds/1_SoundHelix-Song-6_(Other).wav
|
| 64 |
+
DEBUG: 1 individual sounds will play together creating layered composition
|
| 65 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 66 |
+
DEBUG: Added layer 2, total layers now: 2
|
| 67 |
+
DEBUG: Composition layers: ['left_leg', 'left_hand']
|
| 68 |
+
DEBUG: Current composition has 2 layers: ['left_leg', 'left_hand']
|
| 69 |
+
DEBUG: Audio files to mix: ['1_SoundHelix-Song-6_(Other).wav', '1_SoundHelix-Song-6_(Bass).wav']
|
| 70 |
+
DEBUG: Using base audio file as fallback: 1_SoundHelix-Song-6_(Vocals).wav (FILE SAVING DISABLED)
|
| 71 |
+
β Cycle 2: Added 1_SoundHelix-Song-6_(Bass).wav for left_hand (2/5 complete)
|
| 72 |
+
DEBUG continue: Available sounds: ['left_hand', 'right_hand', 'left_leg', 'tongue', 'right_leg']
|
| 73 |
+
DEBUG continue: Completed movements: {'left_hand', 'left_leg'}
|
| 74 |
+
DEBUG continue: Showing individual sounds that will layer together: ['left_hand', 'left_leg']
|
| 75 |
+
DEBUG continue: Left hand playing: /Users/sofiafregni/Downloads/portfolio_ML_project/Gradio/sounds/1_SoundHelix-Song-6_(Bass).wav
|
| 76 |
+
DEBUG continue: Left leg playing: /Users/sofiafregni/Downloads/portfolio_ML_project/Gradio/sounds/1_SoundHelix-Song-6_(Other).wav
|
| 77 |
+
DEBUG continue: 2 individual sounds will play together creating layered composition
|
| 78 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 79 |
+
DEBUG: Added layer 3, total layers now: 3
|
| 80 |
+
DEBUG: Composition layers: ['left_leg', 'left_hand', 'right_hand']
|
| 81 |
+
DEBUG: Current composition has 3 layers: ['left_leg', 'left_hand', 'right_hand']
|
| 82 |
+
DEBUG: Audio files to mix: ['1_SoundHelix-Song-6_(Other).wav', '1_SoundHelix-Song-6_(Bass).wav', '1_SoundHelix-Song-6_(Drums).wav']
|
| 83 |
+
DEBUG: Using base audio file as fallback: 1_SoundHelix-Song-6_(Vocals).wav (FILE SAVING DISABLED)
|
| 84 |
+
β Cycle 2: Added 1_SoundHelix-Song-6_(Drums).wav for right_hand (3/5 complete)
|
| 85 |
+
DEBUG continue: Available sounds: ['left_hand', 'right_hand', 'left_leg', 'tongue', 'right_leg']
|
| 86 |
+
DEBUG continue: Completed movements: {'left_hand', 'left_leg', 'right_hand'}
|
| 87 |
+
DEBUG continue: Showing individual sounds that will layer together: ['left_hand', 'left_leg', 'right_hand']
|
| 88 |
+
DEBUG continue: Left hand playing: /Users/sofiafregni/Downloads/portfolio_ML_project/Gradio/sounds/1_SoundHelix-Song-6_(Bass).wav
|
| 89 |
+
DEBUG continue: Right hand playing: /Users/sofiafregni/Downloads/portfolio_ML_project/Gradio/sounds/1_SoundHelix-Song-6_(Drums).wav
|
| 90 |
+
DEBUG continue: Left leg playing: /Users/sofiafregni/Downloads/portfolio_ML_project/Gradio/sounds/1_SoundHelix-Song-6_(Other).wav
|
| 91 |
+
DEBUG continue: 3 individual sounds will play together creating layered composition
|
| 92 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 93 |
+
DEBUG: Added layer 4, total layers now: 4
|
| 94 |
+
DEBUG: Composition layers: ['left_leg', 'left_hand', 'right_hand', 'right_leg']
|
| 95 |
+
DEBUG: Current composition has 4 layers: ['left_leg', 'left_hand', 'right_hand', 'right_leg']
|
| 96 |
+
DEBUG: Audio files to mix: ['1_SoundHelix-Song-6_(Other).wav', '1_SoundHelix-Song-6_(Bass).wav', '1_SoundHelix-Song-6_(Drums).wav', '1_SoundHelix-Song-6_(Bass).wav']
|
| 97 |
+
DEBUG: Using base audio file as fallback: 1_SoundHelix-Song-6_(Vocals).wav (FILE SAVING DISABLED)
|
| 98 |
+
β Cycle 2: Added 1_SoundHelix-Song-6_(Bass).wav for right_leg (4/5 complete)
|
| 99 |
+
DEBUG continue: Available sounds: ['left_hand', 'right_hand', 'left_leg', 'tongue', 'right_leg']
|
| 100 |
+
DEBUG continue: Completed movements: {'left_hand', 'left_leg', 'right_leg', 'right_hand'}
|
| 101 |
+
DEBUG continue: Showing individual sounds that will layer together: ['left_hand', 'left_leg', 'right_leg', 'right_hand']
|
| 102 |
+
DEBUG continue: Left hand playing: /Users/sofiafregni/Downloads/portfolio_ML_project/Gradio/sounds/1_SoundHelix-Song-6_(Bass).wav
|
| 103 |
+
DEBUG continue: Right hand playing: /Users/sofiafregni/Downloads/portfolio_ML_project/Gradio/sounds/1_SoundHelix-Song-6_(Drums).wav
|
| 104 |
+
DEBUG continue: Left leg playing: /Users/sofiafregni/Downloads/portfolio_ML_project/Gradio/sounds/1_SoundHelix-Song-6_(Other).wav
|
| 105 |
+
DEBUG continue: Right leg playing: /Users/sofiafregni/Downloads/portfolio_ML_project/Gradio/sounds/1_SoundHelix-Song-6_(Bass).wav
|
| 106 |
+
DEBUG continue: 4 individual sounds will play together creating layered composition
|
| 107 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 108 |
+
DEBUG: Added layer 5, total layers now: 5
|
| 109 |
+
DEBUG: Composition layers: ['left_leg', 'left_hand', 'right_hand', 'right_leg', 'tongue']
|
| 110 |
+
DEBUG: Current composition has 5 layers: ['left_leg', 'left_hand', 'right_hand', 'right_leg', 'tongue']
|
| 111 |
+
DEBUG: Audio files to mix: ['1_SoundHelix-Song-6_(Other).wav', '1_SoundHelix-Song-6_(Bass).wav', '1_SoundHelix-Song-6_(Drums).wav', '1_SoundHelix-Song-6_(Bass).wav', '1_SoundHelix-Song-6_(Vocals).wav']
|
| 112 |
+
DEBUG: Using base audio file as fallback: 1_SoundHelix-Song-6_(Vocals).wav (FILE SAVING DISABLED)
|
| 113 |
+
β Cycle 2: Added 1_SoundHelix-Song-6_(Vocals).wav for tongue (5/5 complete)
|
| 114 |
+
π΅ Cycle 2 complete! All 5 movements successfully classified!
|
| 115 |
+
π Using existing audio as mixed composition: /Users/sofiafregni/Downloads/portfolio_ML_project/Gradio/sounds/1_SoundHelix-Song-6_(Bass).wav (FILE SAVING DISABLED)
|
| 116 |
+
π΅ Composition Complete! Transitioning to DJ Effects Phase...
|
| 117 |
+
π§ You are now the DJ! Use movements to control effects:
|
| 118 |
+
π Left Hand: Volume Fade
|
| 119 |
+
π Right Hand: High Pass Filter
|
| 120 |
+
𦡠Left Leg: Reverb Effect
|
| 121 |
+
𦡠Right Leg: Low Pass Filter
|
| 122 |
+
π
Tongue: Bass Boost
|
| 123 |
+
DEBUG: Successfully transitioned to DJ phase with 5 completed movements
|
| 124 |
+
DEBUG continue: DJ mode - NEW mixed composition loaded: /Users/sofiafregni/Downloads/portfolio_ML_project/Gradio/sounds/1_SoundHelix-Song-6_(Bass).wav
|
| 125 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 126 |
+
ποΈ Reverb Effect: ON
|
| 127 |
+
ποΈ Audio processed with effects: rev (FILE SAVING DISABLED)
|
| 128 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 129 |
+
ποΈ Reverb Effect: OFF
|
| 130 |
+
ποΈ Audio processed with effects: clean (FILE SAVING DISABLED)
|
| 131 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 132 |
+
ποΈ High Pass Filter: ON
|
| 133 |
+
ποΈ Audio processed with effects: hpf (FILE SAVING DISABLED)
|
| 134 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 135 |
+
ποΈ Reverb Effect: ON
|
| 136 |
+
ποΈ Audio processed with effects: hpf_rev (FILE SAVING DISABLED)
|
| 137 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 138 |
+
ποΈ High Pass Filter: OFF
|
| 139 |
+
ποΈ Audio processed with effects: rev (FILE SAVING DISABLED)
|
| 140 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 141 |
+
ποΈ Bass Boost: ON
|
| 142 |
+
ποΈ Audio processed with effects: rev_bass (FILE SAVING DISABLED)
|
| 143 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 144 |
+
ποΈ High Pass Filter: ON
|
| 145 |
+
ποΈ Audio processed with effects: hpf_rev_bass (FILE SAVING DISABLED)
|
| 146 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 147 |
+
ποΈ Bass Boost: OFF
|
| 148 |
+
ποΈ Audio processed with effects: hpf_rev (FILE SAVING DISABLED)
|
| 149 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 150 |
+
π΅ Cycle 2 complete! All 5 movements successfully classified!
|
| 151 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 152 |
+
DEBUG start_automatic_composition: current target = right_leg
|
| 153 |
+
ποΈ High Pass Filter: OFF
|
| 154 |
+
ποΈ Low Pass Filter: ON
|
| 155 |
+
ποΈ Audio processed with effects: rev_lpf (FILE SAVING DISABLED)/Users/sofiafregni/Downloads/portfolio_ML_project/Gradio/app.py:729: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`). Consider using `matplotlib.pyplot.close()`.
|
| 156 |
+
fig, axes = plt.subplots(2, 2, figsize=(12, 8))
|
| 157 |
+
|
| 158 |
+
ποΈ Audio processed with effects: rev_lpf (FILE SAVING DISABLED)
|
| 159 |
+
DEBUG start_automatic_composition: predicted=right_hand, confidence=0.424, sound_added=True
|
| 160 |
+
DEBUG DJ: Playing mixed composition with effects: /Users/sofiafregni/Downloads/portfolio_ML_project/Gradio/sounds/1_SoundHelix-Song-6_(Bass).wav
|
| 161 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 162 |
+
ποΈ Reverb Effect: OFF
|
| 163 |
+
ποΈ Audio processed with effects: lpf (FILE SAVING DISABLED)
|
| 164 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 165 |
+
ποΈ Reverb Effect: ON
|
| 166 |
+
ποΈ Audio processed with effects: rev_lpf (FILE SAVING DISABLED)
|
| 167 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 168 |
+
ποΈ Bass Boost: ON
|
| 169 |
+
ποΈ Audio processed with effects: rev_lpf_bass (FILE SAVING DISABLED)
|
| 170 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 171 |
+
ποΈ High Pass Filter: ON
|
| 172 |
+
ποΈ Audio processed with effects: hpf_rev_lpf_bass (FILE SAVING DISABLED)
|
| 173 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 174 |
+
ποΈ Reverb Effect: OFF
|
| 175 |
+
ποΈ Audio processed with effects: hpf_lpf_bass (FILE SAVING DISABLED)
|
| 176 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 177 |
+
ποΈ High Pass Filter: OFF
|
| 178 |
+
ποΈ Audio processed with effects: lpf_bass (FILE SAVING DISABLED)
|
| 179 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 180 |
+
ποΈ High Pass Filter: ON
|
| 181 |
+
ποΈ Audio processed with effects: hpf_lpf_bass (FILE SAVING DISABLED)
|
| 182 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 183 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 184 |
+
ποΈ Low Pass Filter: OFF
|
| 185 |
+
ποΈ Audio processed with effects: hpf_bass (FILE SAVING DISABLED)
|
| 186 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 187 |
+
ποΈ Reverb Effect: ON
|
| 188 |
+
ποΈ Audio processed with effects: hpf_rev_bass (FILE SAVING DISABLED)
|
| 189 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 190 |
+
ποΈ High Pass Filter: OFF
|
| 191 |
+
ποΈ Audio processed with effects: rev_bass (FILE SAVING DISABLED)
|
| 192 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 193 |
+
ποΈ Bass Boost: OFF
|
| 194 |
+
ποΈ Audio processed with effects: rev (FILE SAVING DISABLED)
|
| 195 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 196 |
+
ποΈ Reverb Effect: OFF
|
| 197 |
+
ποΈ Audio processed with effects: clean (FILE SAVING DISABLED)
|
| 198 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 199 |
+
ποΈ Reverb Effect: ON
|
| 200 |
+
ποΈ Audio processed with effects: rev (FILE SAVING DISABLED)
|
| 201 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 202 |
+
ποΈ High Pass Filter: ON
|
| 203 |
+
ποΈ Audio processed with effects: hpf_rev (FILE SAVING DISABLED)
|
| 204 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 205 |
+
ποΈ Bass Boost: ON
|
| 206 |
+
ποΈ Audio processed with effects: hpf_rev_bass (FILE SAVING DISABLED)
|
| 207 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 208 |
+
ποΈ High Pass Filter: OFF
|
| 209 |
+
ποΈ Audio processed with effects: rev_bass (FILE SAVING DISABLED)
|
| 210 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 211 |
+
ποΈ Low Pass Filter: ON
|
| 212 |
+
ποΈ Audio processed with effects: rev_lpf_bass (FILE SAVING DISABLED)
|
| 213 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 214 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 215 |
+
ποΈ Bass Boost: OFF
|
| 216 |
+
ποΈ Audio processed with effects: rev_lpf (FILE SAVING DISABLED)
|
| 217 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 218 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 219 |
+
ποΈ Bass Boost: ON
|
| 220 |
+
ποΈ Audio processed with effects: rev_lpf_bass (FILE SAVING DISABLED)
|
| 221 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 222 |
+
ποΈ Low Pass Filter: OFF
|
| 223 |
+
ποΈ Audio processed with effects: rev_bass (FILE SAVING DISABLED)
|
| 224 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 225 |
+
ποΈ Reverb Effect: OFF
|
| 226 |
+
ποΈ Audio processed with effects: bass (FILE SAVING DISABLED)
|
| 227 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 228 |
+
ποΈ Bass Boost: OFF
|
| 229 |
+
ποΈ Audio processed with effects: clean (FILE SAVING DISABLED)
|
| 230 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 231 |
+
ποΈ Bass Boost: ON
|
| 232 |
+
ποΈ Audio processed with effects: bass (FILE SAVING DISABLED)
|
| 233 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 234 |
+
ποΈ High Pass Filter: ON
|
| 235 |
+
ποΈ Audio processed with effects: hpf_bass (FILE SAVING DISABLED)
|
| 236 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 237 |
+
ποΈ Bass Boost: OFF
|
| 238 |
+
ποΈ Audio processed with effects: hpf (FILE SAVING DISABLED)
|
| 239 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 240 |
+
ποΈ Reverb Effect: ON
|
| 241 |
+
ποΈ Audio processed with effects: hpf_rev (FILE SAVING DISABLED)
|
| 242 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 243 |
+
ποΈ Bass Boost: ON
|
| 244 |
+
ποΈ Audio processed with effects: hpf_rev_bass (FILE SAVING DISABLED)
|
| 245 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 246 |
+
ποΈ Low Pass Filter: ON
|
| 247 |
+
ποΈ Audio processed with effects: hpf_rev_lpf_bass (FILE SAVING DISABLED)
|
| 248 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 249 |
+
ποΈ High Pass Filter: OFF
|
| 250 |
+
ποΈ Audio processed with effects: rev_lpf_bass (FILE SAVING DISABLED)
|
| 251 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 252 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 253 |
+
ποΈ High Pass Filter: ON
|
| 254 |
+
ποΈ Audio processed with effects: hpf_rev_lpf_bass (FILE SAVING DISABLED)
|
| 255 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 256 |
+
ποΈ High Pass Filter: OFF
|
| 257 |
+
ποΈ Audio processed with effects: rev_lpf_bass (FILE SAVING DISABLED)
|
| 258 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 259 |
+
ποΈ High Pass Filter: ON
|
| 260 |
+
ποΈ Audio processed with effects: hpf_rev_lpf_bass (FILE SAVING DISABLED)
|
| 261 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 262 |
+
ποΈ Volume Fade: ON
|
| 263 |
+
ποΈ Audio processed with effects: fade_hpf_rev_lpf_bass (FILE SAVING DISABLED)
|
| 264 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 265 |
+
ποΈ Bass Boost: OFF
|
| 266 |
+
ποΈ Audio processed with effects: fade_hpf_rev_lpf (FILE SAVING DISABLED)
|
| 267 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 268 |
+
ποΈ Low Pass Filter: OFF
|
| 269 |
+
ποΈ Audio processed with effects: fade_hpf_rev (FILE SAVING DISABLED)
|
| 270 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 271 |
+
ποΈ High Pass Filter: OFF
|
| 272 |
+
ποΈ Audio processed with effects: fade_rev (FILE SAVING DISABLED)
|
| 273 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 274 |
+
ποΈ High Pass Filter: ON
|
| 275 |
+
ποΈ Audio processed with effects: fade_hpf_rev (FILE SAVING DISABLED)
|
| 276 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 277 |
+
ποΈ Reverb Effect: OFF
|
| 278 |
+
ποΈ Audio processed with effects: fade_hpf (FILE SAVING DISABLED)
|
| 279 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 280 |
+
ποΈ High Pass Filter: OFF
|
| 281 |
+
ποΈ Audio processed with effects: fade (FILE SAVING DISABLED)
|
| 282 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 283 |
+
ποΈ Volume Fade: OFF
|
| 284 |
+
ποΈ Audio processed with effects: clean (FILE SAVING DISABLED)
|
| 285 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 286 |
+
ποΈ Bass Boost: ON
|
| 287 |
+
ποΈ Audio processed with effects: bass (FILE SAVING DISABLED)
|
| 288 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 289 |
+
ποΈ High Pass Filter: ON
|
| 290 |
+
ποΈ Audio processed with effects: hpf_bass (FILE SAVING DISABLED)
|
| 291 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 292 |
+
ποΈ Volume Fade: ON
|
| 293 |
+
ποΈ Audio processed with effects: fade_hpf_bass (FILE SAVING DISABLED)
|
| 294 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 295 |
+
ποΈ Volume Fade: OFF
|
| 296 |
+
ποΈ Audio processed with effects: hpf_bass (FILE SAVING DISABLED)
|
| 297 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 298 |
+
ποΈ Reverb Effect: ON
|
| 299 |
+
ποΈ Audio processed with effects: hpf_rev_bass (FILE SAVING DISABLED)
|
| 300 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 301 |
+
ποΈ Volume Fade: ON
|
| 302 |
+
ποΈ Audio processed with effects: fade_hpf_rev_bass (FILE SAVING DISABLED)
|
| 303 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 304 |
+
ποΈ Low Pass Filter: ON
|
| 305 |
+
ποΈ Audio processed with effects: fade_hpf_rev_lpf_bass (FILE SAVING DISABLED)
|
| 306 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 307 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 308 |
+
ποΈ Low Pass Filter: OFF
|
| 309 |
+
ποΈ Audio processed with effects: fade_hpf_rev_bass (FILE SAVING DISABLED)
|
| 310 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 311 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 312 |
+
ποΈ Volume Fade: OFF
|
| 313 |
+
ποΈ Audio processed with effects: hpf_rev_bass (FILE SAVING DISABLED)
|
| 314 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 315 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 316 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 317 |
+
ποΈ Bass Boost: OFF
|
| 318 |
+
ποΈ Audio processed with effects: hpf_rev (FILE SAVING DISABLED)
|
| 319 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 320 |
+
ποΈ Low Pass Filter: ON
|
| 321 |
+
ποΈ Audio processed with effects: hpf_rev_lpf (FILE SAVING DISABLED)
|
| 322 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 323 |
+
ποΈ Reverb Effect: OFF
|
| 324 |
+
ποΈ Audio processed with effects: hpf_lpf (FILE SAVING DISABLED)
|
| 325 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 326 |
+
ποΈ High Pass Filter: OFF
|
| 327 |
+
ποΈ Audio processed with effects: lpf (FILE SAVING DISABLED)
|
| 328 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 329 |
+
ποΈ Low Pass Filter: OFF
|
| 330 |
+
ποΈ Audio processed with effects: clean (FILE SAVING DISABLED)
|
| 331 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 332 |
+
ποΈ Reverb Effect: ON
|
| 333 |
+
ποΈ Audio processed with effects: rev (FILE SAVING DISABLED)
|
| 334 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 335 |
+
ποΈ High Pass Filter: ON
|
| 336 |
+
ποΈ Audio processed with effects: hpf_rev (FILE SAVING DISABLED)
|
| 337 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 338 |
+
ποΈ Bass Boost: ON
|
| 339 |
+
ποΈ Audio processed with effects: hpf_rev_bass (FILE SAVING DISABLED)
|
| 340 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 341 |
+
ποΈ Reverb Effect: OFF
|
| 342 |
+
ποΈ Audio processed with effects: hpf_bass (FILE SAVING DISABLED)
|
| 343 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 344 |
+
ποΈ Reverb Effect: ON
|
| 345 |
+
ποΈ Audio processed with effects: hpf_rev_bass (FILE SAVING DISABLED)
|
| 346 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 347 |
+
ποΈ Volume Fade: ON
|
| 348 |
+
ποΈ Audio processed with effects: fade_hpf_rev_bass (FILE SAVING DISABLED)
|
| 349 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 350 |
+
ποΈ Volume Fade: OFF
|
| 351 |
+
ποΈ Audio processed with effects: hpf_rev_bass (FILE SAVING DISABLED)
|
| 352 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 353 |
+
ποΈ Reverb Effect: OFF
|
| 354 |
+
ποΈ Audio processed with effects: hpf_bass (FILE SAVING DISABLED)
|
| 355 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 356 |
+
ποΈ Low Pass Filter: ON
|
| 357 |
+
ποΈ Audio processed with effects: hpf_lpf_bass (FILE SAVING DISABLED)
|
| 358 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 359 |
+
ποΈ High Pass Filter: OFF
|
| 360 |
+
ποΈ Audio processed with effects: lpf_bass (FILE SAVING DISABLED)
|
| 361 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 362 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 363 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 364 |
+
ποΈ Volume Fade: ON
|
| 365 |
+
ποΈ Audio processed with effects: fade_lpf_bass (FILE SAVING DISABLED)
|
| 366 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 367 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 368 |
+
ποΈ Reverb Effect: ON
|
| 369 |
+
ποΈ Audio processed with effects: fade_rev_lpf_bass (FILE SAVING DISABLED)
|
| 370 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 371 |
+
ποΈ Low Pass Filter: OFF
|
| 372 |
+
ποΈ Audio processed with effects: fade_rev_bass (FILE SAVING DISABLED)
|
| 373 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 374 |
+
ποΈ Bass Boost: OFF
|
| 375 |
+
ποΈ Audio processed with effects: fade_rev (FILE SAVING DISABLED)
|
| 376 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 377 |
+
π΅ Cycle 2 complete! All 5 movements successfully classified!
|
| 378 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 379 |
+
ποΈ Low Pass Filter: ON
|
| 380 |
+
ποΈ Audio processed with effects: fade_rev_lpf (FILE SAVING DISABLED)
|
| 381 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 382 |
+
ποΈ Volume Fade: OFF
|
| 383 |
+
ποΈ Audio processed with effects: rev_lpf (FILE SAVING DISABLED)
|
| 384 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 385 |
+
ποΈ High Pass Filter: ON
|
| 386 |
+
ποΈ Audio processed with effects: hpf_rev_lpf (FILE SAVING DISABLED)
|
| 387 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 388 |
+
ποΈ Low Pass Filter: OFF
|
| 389 |
+
ποΈ Audio processed with effects: hpf_rev (FILE SAVING DISABLED)
|
| 390 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 391 |
+
ποΈ Volume Fade: ON
|
| 392 |
+
ποΈ Audio processed with effects: fade_hpf_rev (FILE SAVING DISABLED)
|
| 393 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 394 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 395 |
+
ποΈ Low Pass Filter: ON
|
| 396 |
+
ποΈ Audio processed with effects: fade_hpf_rev_lpf (FILE SAVING DISABLED)
|
| 397 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 398 |
+
ποΈ Reverb Effect: OFF
|
| 399 |
+
ποΈ Audio processed with effects: fade_hpf_lpf (FILE SAVING DISABLED)
|
| 400 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 401 |
+
ποΈ Bass Boost: ON
|
| 402 |
+
ποΈ Audio processed with effects: fade_hpf_lpf_bass (FILE SAVING DISABLED)
|
| 403 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 404 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 405 |
+
ποΈ High Pass Filter: OFF
|
| 406 |
+
ποΈ Audio processed with effects: fade_lpf_bass (FILE SAVING DISABLED)
|
| 407 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 408 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 409 |
+
ποΈ Reverb Effect: ON
|
| 410 |
+
ποΈ Audio processed with effects: fade_rev_lpf_bass (FILE SAVING DISABLED)
|
| 411 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 412 |
+
ποΈ Volume Fade: OFF
|
| 413 |
+
ποΈ Audio processed with effects: rev_lpf_bass (FILE SAVING DISABLED)
|
| 414 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 415 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 416 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 417 |
+
ποΈ High Pass Filter: ON
|
| 418 |
+
ποΈ Audio processed with effects: hpf_rev_lpf_bass (FILE SAVING DISABLED)
|
| 419 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 420 |
+
ποΈ Reverb Effect: OFF
|
| 421 |
+
ποΈ Audio processed with effects: hpf_lpf_bass (FILE SAVING DISABLED)
|
| 422 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 423 |
+
ποΈ Volume Fade: ON
|
| 424 |
+
ποΈ Audio processed with effects: fade_hpf_lpf_bass (FILE SAVING DISABLED)
|
| 425 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 426 |
+
ποΈ Volume Fade: OFF
|
| 427 |
+
ποΈ Audio processed with effects: hpf_lpf_bass (FILE SAVING DISABLED)
|
| 428 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 429 |
+
ποΈ High Pass Filter: OFF
|
| 430 |
+
ποΈ Audio processed with effects: lpf_bass (FILE SAVING DISABLED)
|
| 431 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 432 |
+
ποΈ Bass Boost: OFF
|
| 433 |
+
ποΈ Audio processed with effects: lpf (FILE SAVING DISABLED)
|
| 434 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 435 |
+
ποΈ Volume Fade: ON
|
| 436 |
+
ποΈ Audio processed with effects: fade_lpf (FILE SAVING DISABLED)
|
| 437 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 438 |
+
ποΈ Reverb Effect: ON
|
| 439 |
+
ποΈ Audio processed with effects: fade_rev_lpf (FILE SAVING DISABLED)
|
| 440 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 441 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 442 |
+
ποΈ Volume Fade: OFF
|
| 443 |
+
ποΈ Audio processed with effects: rev_lpf (FILE SAVING DISABLED)
|
| 444 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 445 |
+
ποΈ Bass Boost: ON
|
| 446 |
+
ποΈ Audio processed with effects: rev_lpf_bass (FILE SAVING DISABLED)
|
| 447 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 448 |
+
ποΈ Low Pass Filter: OFF
|
| 449 |
+
ποΈ Audio processed with effects: rev_bass (FILE SAVING DISABLED)
|
| 450 |
+
DEBUG continue_automatic_composition: current target = right_leg
|
| 451 |
+
ποΈ Low Pass Filter: ON
|
| 452 |
+
ποΈ Audio processed with effects: rev_lpf_bass (FILE SAVING DISABLED)
|
app.py
CHANGED
|
@@ -9,6 +9,7 @@ import numpy as np
|
|
| 9 |
import matplotlib.pyplot as plt
|
| 10 |
import time
|
| 11 |
import threading
|
|
|
|
| 12 |
from typing import Dict, Tuple, Any, List
|
| 13 |
|
| 14 |
# Import our custom modules
|
|
@@ -40,14 +41,7 @@ app_state = {
|
|
| 40 |
'demo_labels': None,
|
| 41 |
'classification_history': [],
|
| 42 |
'composition_active': False,
|
| 43 |
-
'auto_mode': False
|
| 44 |
-
'last_audio_state': {
|
| 45 |
-
'left_hand_audio': None,
|
| 46 |
-
'right_hand_audio': None,
|
| 47 |
-
'left_leg_audio': None,
|
| 48 |
-
'right_leg_audio': None,
|
| 49 |
-
'tongue_audio': None
|
| 50 |
-
}
|
| 51 |
}
|
| 52 |
|
| 53 |
# Initialize components
|
|
@@ -128,23 +122,26 @@ def start_composition():
|
|
| 128 |
|
| 129 |
# Process classification
|
| 130 |
result = sound_manager.process_classification(predicted_name, confidence, CONFIDENCE_THRESHOLD)
|
| 131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
# Create visualization
|
| 133 |
fig = create_eeg_plot(epoch_data, target_movement, predicted_name, confidence, result['sound_added'])
|
| 134 |
|
| 135 |
-
# Initialize all audio components to
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
tongue_audio = silent_file
|
| 142 |
|
| 143 |
# Debug: Print classification result
|
| 144 |
print(f"DEBUG start_composition: predicted={predicted_name}, confidence={confidence:.3f}, sound_added={result['sound_added']}")
|
| 145 |
|
| 146 |
# Only play the sound if it was just added and matches the prediction
|
| 147 |
-
if result['sound_added']:
|
| 148 |
sounds = get_movement_sounds()
|
| 149 |
print(f"DEBUG: Available sounds: {list(sounds.keys())}")
|
| 150 |
if predicted_name == 'left_hand' and 'left_hand' in sounds:
|
|
@@ -215,10 +212,10 @@ def start_automatic_composition():
|
|
| 215 |
app_state['composition_active'] = True
|
| 216 |
app_state['auto_mode'] = True
|
| 217 |
sound_manager.start_new_cycle() # Reset composition only when starting fresh
|
| 218 |
-
|
| 219 |
if app_state['demo_data'] is None:
|
| 220 |
-
return "β No data", "β No data", "β No data", "β No data", None, None, None, None, None, None, "No EEG data available"
|
| 221 |
-
|
| 222 |
# Get current target
|
| 223 |
target_movement = sound_manager.get_current_target_movement()
|
| 224 |
print(f"DEBUG start_automatic_composition: current target = {target_movement}")
|
|
@@ -283,74 +280,78 @@ def start_automatic_composition():
|
|
| 283 |
# Create visualization
|
| 284 |
fig = create_eeg_plot(epoch_data, target_movement, predicted_name, confidence, result['sound_added'])
|
| 285 |
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
left_hand_audio =
|
| 289 |
-
right_hand_audio =
|
| 290 |
-
left_leg_audio =
|
| 291 |
-
right_leg_audio =
|
| 292 |
-
tongue_audio =
|
| 293 |
|
| 294 |
# Debug: Print classification result
|
| 295 |
print(f"DEBUG start_automatic_composition: predicted={predicted_name}, confidence={confidence:.3f}, sound_added={result['sound_added']}")
|
| 296 |
|
| 297 |
# Handle audio display based on current phase
|
| 298 |
if sound_manager.current_phase == "dj_effects":
|
| 299 |
-
# DJ Effects Phase -
|
| 300 |
-
if result.get('mixed_composition'):
|
| 301 |
-
# Show the mixed composition (all sounds combined) in one player
|
| 302 |
-
left_hand_audio = result['mixed_composition'] # Use first player for mixed audio
|
| 303 |
-
print(f"DEBUG DJ: Playing mixed composition with effects: {result['mixed_composition']}")
|
| 304 |
-
else:
|
| 305 |
-
# Fallback to showing accumulated sounds
|
| 306 |
-
sounds = get_movement_sounds()
|
| 307 |
-
completed_movements = sound_manager.movements_completed
|
| 308 |
-
if 'left_hand' in completed_movements and 'left_hand' in sounds:
|
| 309 |
-
left_hand_audio = sounds['left_hand']
|
| 310 |
-
else:
|
| 311 |
-
# Building Phase - show ALL accumulated sounds (layered composition)
|
| 312 |
sounds = get_movement_sounds()
|
|
|
|
|
|
|
| 313 |
completed_movements = sound_manager.movements_completed
|
| 314 |
-
|
| 315 |
-
print(f"DEBUG: Completed movements: {completed_movements}")
|
| 316 |
-
|
| 317 |
-
# Display all completed movement sounds (cumulative layering)
|
| 318 |
if 'left_hand' in completed_movements and 'left_hand' in sounds:
|
| 319 |
left_hand_audio = sounds['left_hand']
|
| 320 |
-
print(f"DEBUG:
|
| 321 |
if 'right_hand' in completed_movements and 'right_hand' in sounds:
|
| 322 |
right_hand_audio = sounds['right_hand']
|
| 323 |
-
print(f"DEBUG:
|
| 324 |
if 'left_leg' in completed_movements and 'left_leg' in sounds:
|
| 325 |
left_leg_audio = sounds['left_leg']
|
| 326 |
-
print(f"DEBUG:
|
| 327 |
if 'right_leg' in completed_movements and 'right_leg' in sounds:
|
| 328 |
right_leg_audio = sounds['right_leg']
|
| 329 |
-
print(f"DEBUG:
|
| 330 |
if 'tongue' in completed_movements and 'tongue' in sounds:
|
| 331 |
tongue_audio = sounds['tongue']
|
| 332 |
-
print(f"DEBUG:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 333 |
|
| 334 |
-
#
|
| 335 |
-
|
| 336 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 337 |
left_hand_audio = sounds['left_hand']
|
| 338 |
-
|
|
|
|
| 339 |
right_hand_audio = sounds['right_hand']
|
| 340 |
-
|
|
|
|
| 341 |
left_leg_audio = sounds['left_leg']
|
| 342 |
-
|
|
|
|
| 343 |
right_leg_audio = sounds['right_leg']
|
| 344 |
-
|
|
|
|
| 345 |
tongue_audio = sounds['tongue']
|
| 346 |
-
|
|
|
|
|
|
|
| 347 |
|
| 348 |
# Check for phase transition to DJ effects
|
| 349 |
completed_count = len(sound_manager.movements_completed)
|
| 350 |
total_count = len(sound_manager.current_movement_sequence)
|
| 351 |
|
| 352 |
# Transition to DJ effects if all movements completed but still in building phase
|
| 353 |
-
if completed_count >=
|
| 354 |
sound_manager.transition_to_dj_phase()
|
| 355 |
|
| 356 |
# Format display based on current phase
|
|
@@ -547,123 +548,54 @@ def continue_automatic_composition():
|
|
| 547 |
# Create visualization
|
| 548 |
fig = create_eeg_plot(epoch_data, target_movement, predicted_name, confidence, result['sound_added'])
|
| 549 |
|
| 550 |
-
# Initialize all audio components to
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
|
| 554 |
-
|
| 555 |
-
|
| 556 |
-
tongue_audio = silent_file
|
| 557 |
|
| 558 |
# Handle audio differently based on phase
|
| 559 |
if sound_manager.current_phase == "dj_effects":
|
| 560 |
-
# DJ Mode:
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
# Use the same file as before to prevent Gradio from restarting audio
|
| 571 |
-
tongue_audio = app_state['last_audio_state']['tongue_audio']
|
| 572 |
-
# No debug print to reduce spam
|
| 573 |
-
else:
|
| 574 |
-
# Handle case where cached state is None - use the current file
|
| 575 |
-
tongue_audio = sound_manager.mixed_composition_file
|
| 576 |
-
app_state['last_audio_state']['tongue_audio'] = sound_manager.mixed_composition_file
|
| 577 |
-
print(f"DEBUG continue: DJ mode - Loading mixed composition (state was None): {sound_manager.mixed_composition_file}")
|
| 578 |
-
# Note: We don't update with processed effects files to prevent audio restarts
|
| 579 |
else:
|
| 580 |
-
# Building Mode:
|
|
|
|
| 581 |
sounds = get_movement_sounds()
|
| 582 |
completed_movements = sound_manager.movements_completed
|
| 583 |
print(f"DEBUG continue: Available sounds: {list(sounds.keys())}")
|
| 584 |
print(f"DEBUG continue: Completed movements: {completed_movements}")
|
| 585 |
|
| 586 |
-
|
| 587 |
-
|
| 588 |
-
|
| 589 |
-
|
| 590 |
-
|
| 591 |
-
|
| 592 |
-
print(f"DEBUG continue:
|
| 593 |
-
|
| 594 |
-
|
| 595 |
-
|
| 596 |
-
|
| 597 |
-
|
| 598 |
-
|
| 599 |
-
|
| 600 |
-
|
| 601 |
-
|
| 602 |
-
|
| 603 |
-
|
| 604 |
-
|
| 605 |
-
print(f"DEBUG continue: ALWAYS UPDATE right_hand_audio: {new_right_hand}")
|
| 606 |
-
|
| 607 |
-
if 'left_leg' in completed_movements and 'left_leg' in sounds:
|
| 608 |
-
new_left_leg = sounds['left_leg']
|
| 609 |
-
if app_state['last_audio_state']['left_leg_audio'] != new_left_leg:
|
| 610 |
-
left_leg_audio = new_left_leg
|
| 611 |
-
app_state['last_audio_state']['left_leg_audio'] = new_left_leg
|
| 612 |
-
print(f"DEBUG continue: NEW left_leg_audio: {new_left_leg}")
|
| 613 |
-
elif app_state['last_audio_state']['left_leg_audio'] is not None:
|
| 614 |
-
left_leg_audio = app_state['last_audio_state']['left_leg_audio']
|
| 615 |
-
else:
|
| 616 |
-
# Handle case where cached state is None - use the current file
|
| 617 |
-
left_leg_audio = new_left_leg
|
| 618 |
-
app_state['last_audio_state']['left_leg_audio'] = new_left_leg
|
| 619 |
-
|
| 620 |
-
if 'right_leg' in completed_movements and 'right_leg' in sounds:
|
| 621 |
-
new_right_leg = sounds['right_leg']
|
| 622 |
-
if app_state['last_audio_state']['right_leg_audio'] != new_right_leg:
|
| 623 |
-
right_leg_audio = new_right_leg
|
| 624 |
-
app_state['last_audio_state']['right_leg_audio'] = new_right_leg
|
| 625 |
-
print(f"DEBUG continue: NEW right_leg_audio: {new_right_leg}")
|
| 626 |
-
elif app_state['last_audio_state']['right_leg_audio'] is not None:
|
| 627 |
-
right_leg_audio = app_state['last_audio_state']['right_leg_audio']
|
| 628 |
-
else:
|
| 629 |
-
# Handle case where cached state is None - use the current file
|
| 630 |
-
right_leg_audio = new_right_leg
|
| 631 |
-
app_state['last_audio_state']['right_leg_audio'] = new_right_leg
|
| 632 |
|
| 633 |
-
|
| 634 |
-
new_tongue = sounds['tongue']
|
| 635 |
-
# Note: Don't update tongue audio in building mode if we're about to transition to DJ mode
|
| 636 |
-
if sound_manager.current_phase == "building":
|
| 637 |
-
if app_state['last_audio_state']['tongue_audio'] != new_tongue:
|
| 638 |
-
tongue_audio = new_tongue
|
| 639 |
-
app_state['last_audio_state']['tongue_audio'] = new_tongue
|
| 640 |
-
print(f"DEBUG continue: NEW tongue_audio: {new_tongue}")
|
| 641 |
-
elif app_state['last_audio_state']['tongue_audio'] is not None:
|
| 642 |
-
tongue_audio = app_state['last_audio_state']['tongue_audio']
|
| 643 |
-
else:
|
| 644 |
-
# Handle case where cached state is None - use the current file
|
| 645 |
-
tongue_audio = new_tongue
|
| 646 |
-
app_state['last_audio_state']['tongue_audio'] = new_tongue
|
| 647 |
-
|
| 648 |
-
# If a sound was just added, make sure it gets updated immediately (override state check)
|
| 649 |
-
if result['sound_added'] and predicted_name in sounds:
|
| 650 |
-
new_sound = sounds[predicted_name]
|
| 651 |
-
if predicted_name == 'left_hand':
|
| 652 |
-
left_hand_audio = new_sound
|
| 653 |
-
app_state['last_audio_state']['left_hand_audio'] = new_sound
|
| 654 |
-
elif predicted_name == 'right_hand':
|
| 655 |
-
right_hand_audio = new_sound
|
| 656 |
-
app_state['last_audio_state']['right_hand_audio'] = new_sound
|
| 657 |
-
elif predicted_name == 'left_leg':
|
| 658 |
-
left_leg_audio = new_sound
|
| 659 |
-
app_state['last_audio_state']['left_leg_audio'] = new_sound
|
| 660 |
-
elif predicted_name == 'right_leg':
|
| 661 |
-
right_leg_audio = new_sound
|
| 662 |
-
app_state['last_audio_state']['right_leg_audio'] = new_sound
|
| 663 |
-
elif predicted_name == 'tongue':
|
| 664 |
-
tongue_audio = new_sound
|
| 665 |
-
app_state['last_audio_state']['tongue_audio'] = new_sound
|
| 666 |
-
print(f"DEBUG continue: Force update - just added {predicted_name} sound: {new_sound}")
|
| 667 |
|
| 668 |
# Format display with progress information
|
| 669 |
completed_count = len(sound_manager.movements_completed)
|
|
@@ -745,27 +677,26 @@ def classify_epoch():
|
|
| 745 |
# Create visualization
|
| 746 |
fig = create_eeg_plot(epoch_data, target_movement, predicted_name, confidence, result['sound_added'])
|
| 747 |
|
| 748 |
-
# Initialize all audio components to
|
| 749 |
-
|
| 750 |
-
|
| 751 |
-
|
| 752 |
-
|
| 753 |
-
|
| 754 |
-
tongue_audio = silent_file
|
| 755 |
|
| 756 |
-
#
|
| 757 |
-
|
| 758 |
-
|
| 759 |
-
|
| 760 |
-
|
| 761 |
-
|
| 762 |
-
|
| 763 |
-
|
| 764 |
-
|
| 765 |
-
|
| 766 |
-
|
| 767 |
-
|
| 768 |
-
|
| 769 |
|
| 770 |
# Format next target
|
| 771 |
next_target = sound_manager.get_current_target_movement()
|
|
|
|
| 9 |
import matplotlib.pyplot as plt
|
| 10 |
import time
|
| 11 |
import threading
|
| 12 |
+
import os
|
| 13 |
from typing import Dict, Tuple, Any, List
|
| 14 |
|
| 15 |
# Import our custom modules
|
|
|
|
| 41 |
'demo_labels': None,
|
| 42 |
'classification_history': [],
|
| 43 |
'composition_active': False,
|
| 44 |
+
'auto_mode': False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
}
|
| 46 |
|
| 47 |
# Initialize components
|
|
|
|
| 122 |
|
| 123 |
# Process classification
|
| 124 |
result = sound_manager.process_classification(predicted_name, confidence, CONFIDENCE_THRESHOLD)
|
| 125 |
+
|
| 126 |
+
# Always check for DJ mode transition after classification
|
| 127 |
+
dj_transitioned = sound_manager.transition_to_dj_phase()
|
| 128 |
+
print(f"DEBUG: DJ mode transitioned: {dj_transitioned}, current_phase: {sound_manager.current_phase}")
|
| 129 |
+
|
| 130 |
# Create visualization
|
| 131 |
fig = create_eeg_plot(epoch_data, target_movement, predicted_name, confidence, result['sound_added'])
|
| 132 |
|
| 133 |
+
# Initialize all audio components to None (no sound by default)
|
| 134 |
+
left_hand_audio = None
|
| 135 |
+
right_hand_audio = None
|
| 136 |
+
left_leg_audio = None
|
| 137 |
+
right_leg_audio = None
|
| 138 |
+
tongue_audio = None
|
|
|
|
| 139 |
|
| 140 |
# Debug: Print classification result
|
| 141 |
print(f"DEBUG start_composition: predicted={predicted_name}, confidence={confidence:.3f}, sound_added={result['sound_added']}")
|
| 142 |
|
| 143 |
# Only play the sound if it was just added and matches the prediction
|
| 144 |
+
if result['sound_added']: # might add confidence threshold for sound output here
|
| 145 |
sounds = get_movement_sounds()
|
| 146 |
print(f"DEBUG: Available sounds: {list(sounds.keys())}")
|
| 147 |
if predicted_name == 'left_hand' and 'left_hand' in sounds:
|
|
|
|
| 212 |
app_state['composition_active'] = True
|
| 213 |
app_state['auto_mode'] = True
|
| 214 |
sound_manager.start_new_cycle() # Reset composition only when starting fresh
|
| 215 |
+
|
| 216 |
if app_state['demo_data'] is None:
|
| 217 |
+
return "β No data", "β No data", "β No data", "β No data", None, None, None, None, None, None, "No EEG data available", gr.update(visible=True), gr.update(visible=False)
|
| 218 |
+
|
| 219 |
# Get current target
|
| 220 |
target_movement = sound_manager.get_current_target_movement()
|
| 221 |
print(f"DEBUG start_automatic_composition: current target = {target_movement}")
|
|
|
|
| 280 |
# Create visualization
|
| 281 |
fig = create_eeg_plot(epoch_data, target_movement, predicted_name, confidence, result['sound_added'])
|
| 282 |
|
| 283 |
+
|
| 284 |
+
# Initialize all audio components to None (no sound by default)
|
| 285 |
+
left_hand_audio = None
|
| 286 |
+
right_hand_audio = None
|
| 287 |
+
left_leg_audio = None
|
| 288 |
+
right_leg_audio = None
|
| 289 |
+
tongue_audio = None
|
| 290 |
|
| 291 |
# Debug: Print classification result
|
| 292 |
print(f"DEBUG start_automatic_composition: predicted={predicted_name}, confidence={confidence:.3f}, sound_added={result['sound_added']}")
|
| 293 |
|
| 294 |
# Handle audio display based on current phase
|
| 295 |
if sound_manager.current_phase == "dj_effects":
|
| 296 |
+
# DJ Effects Phase - continue showing individual sounds in their players
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 297 |
sounds = get_movement_sounds()
|
| 298 |
+
# Always check for phase transition to DJ effects after each classification
|
| 299 |
+
sound_manager.transition_to_dj_phase()
|
| 300 |
completed_movements = sound_manager.movements_completed
|
| 301 |
+
# Display each completed movement sound in its respective player (same as building mode)
|
|
|
|
|
|
|
|
|
|
| 302 |
if 'left_hand' in completed_movements and 'left_hand' in sounds:
|
| 303 |
left_hand_audio = sounds['left_hand']
|
| 304 |
+
print(f"DEBUG DJ: Left hand playing: {sounds['left_hand']}")
|
| 305 |
if 'right_hand' in completed_movements and 'right_hand' in sounds:
|
| 306 |
right_hand_audio = sounds['right_hand']
|
| 307 |
+
print(f"DEBUG DJ: Right hand playing: {sounds['right_hand']}")
|
| 308 |
if 'left_leg' in completed_movements and 'left_leg' in sounds:
|
| 309 |
left_leg_audio = sounds['left_leg']
|
| 310 |
+
print(f"DEBUG DJ: Left leg playing: {sounds['left_leg']}")
|
| 311 |
if 'right_leg' in completed_movements and 'right_leg' in sounds:
|
| 312 |
right_leg_audio = sounds['right_leg']
|
| 313 |
+
print(f"DEBUG DJ: Right leg playing: {sounds['right_leg']}")
|
| 314 |
if 'tongue' in completed_movements and 'tongue' in sounds:
|
| 315 |
tongue_audio = sounds['tongue']
|
| 316 |
+
print(f"DEBUG DJ: Tongue playing: {sounds['tongue']}")
|
| 317 |
+
print(f"DEBUG DJ: {len(completed_movements)} individual sounds playing with effects applied")
|
| 318 |
+
else:
|
| 319 |
+
# Building Phase - create and show layered composition
|
| 320 |
+
sounds = get_movement_sounds()
|
| 321 |
+
completed_movements = sound_manager.movements_completed
|
| 322 |
+
print(f"DEBUG: Available sounds: {list(sounds.keys())}")
|
| 323 |
+
print(f"DEBUG: Completed movements: {completed_movements}")
|
| 324 |
|
| 325 |
+
# Display individual sounds in their respective players for layered composition
|
| 326 |
+
# All completed movement sounds will play simultaneously, creating natural layering
|
| 327 |
+
if len(completed_movements) > 0:
|
| 328 |
+
print(f"DEBUG: Showing individual sounds that will layer together: {list(completed_movements)}")
|
| 329 |
+
|
| 330 |
+
# Display each completed movement sound in its respective player
|
| 331 |
+
if 'left_hand' in completed_movements and 'left_hand' in sounds:
|
| 332 |
left_hand_audio = sounds['left_hand']
|
| 333 |
+
print(f"DEBUG: Left hand playing: {sounds['left_hand']}")
|
| 334 |
+
if 'right_hand' in completed_movements and 'right_hand' in sounds:
|
| 335 |
right_hand_audio = sounds['right_hand']
|
| 336 |
+
print(f"DEBUG: Right hand playing: {sounds['right_hand']}")
|
| 337 |
+
if 'left_leg' in completed_movements and 'left_leg' in sounds:
|
| 338 |
left_leg_audio = sounds['left_leg']
|
| 339 |
+
print(f"DEBUG: Left leg playing: {sounds['left_leg']}")
|
| 340 |
+
if 'right_leg' in completed_movements and 'right_leg' in sounds:
|
| 341 |
right_leg_audio = sounds['right_leg']
|
| 342 |
+
print(f"DEBUG: Right leg playing: {sounds['right_leg']}")
|
| 343 |
+
if 'tongue' in completed_movements and 'tongue' in sounds:
|
| 344 |
tongue_audio = sounds['tongue']
|
| 345 |
+
print(f"DEBUG: Tongue playing: {sounds['tongue']}")
|
| 346 |
+
|
| 347 |
+
print(f"DEBUG: {len(completed_movements)} individual sounds will play together creating layered composition")
|
| 348 |
|
| 349 |
# Check for phase transition to DJ effects
|
| 350 |
completed_count = len(sound_manager.movements_completed)
|
| 351 |
total_count = len(sound_manager.current_movement_sequence)
|
| 352 |
|
| 353 |
# Transition to DJ effects if all movements completed but still in building phase
|
| 354 |
+
if completed_count >= total_count and sound_manager.current_phase == "building":
|
| 355 |
sound_manager.transition_to_dj_phase()
|
| 356 |
|
| 357 |
# Format display based on current phase
|
|
|
|
| 548 |
# Create visualization
|
| 549 |
fig = create_eeg_plot(epoch_data, target_movement, predicted_name, confidence, result['sound_added'])
|
| 550 |
|
| 551 |
+
# Initialize all audio components to None (no sound by default)
|
| 552 |
+
left_hand_audio = None
|
| 553 |
+
right_hand_audio = None
|
| 554 |
+
left_leg_audio = None
|
| 555 |
+
right_leg_audio = None
|
| 556 |
+
tongue_audio = None
|
|
|
|
| 557 |
|
| 558 |
# Handle audio differently based on phase
|
| 559 |
if sound_manager.current_phase == "dj_effects":
|
| 560 |
+
# DJ Mode: Show only the full mixed track and route effects to it
|
| 561 |
+
mixed_track = sound_manager.get_current_mixed_composition()
|
| 562 |
+
print(f"DEBUG continue: DJ Mode - Showing full mixed track: {mixed_track}")
|
| 563 |
+
# Hide individual movement sounds by setting them to None
|
| 564 |
+
left_hand_audio = None
|
| 565 |
+
right_hand_audio = None
|
| 566 |
+
left_leg_audio = None
|
| 567 |
+
right_leg_audio = None
|
| 568 |
+
tongue_audio = None
|
| 569 |
+
# The mixed_track will be shown in a dedicated gr.Audio component in the UI (update UI accordingly)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 570 |
else:
|
| 571 |
+
# Building Mode: Display individual sounds in their respective players for layered composition
|
| 572 |
+
# All completed movement sounds will play simultaneously, creating natural layering
|
| 573 |
sounds = get_movement_sounds()
|
| 574 |
completed_movements = sound_manager.movements_completed
|
| 575 |
print(f"DEBUG continue: Available sounds: {list(sounds.keys())}")
|
| 576 |
print(f"DEBUG continue: Completed movements: {completed_movements}")
|
| 577 |
|
| 578 |
+
if len(completed_movements) > 0:
|
| 579 |
+
print(f"DEBUG continue: Showing individual sounds that will layer together: {list(completed_movements)}")
|
| 580 |
+
|
| 581 |
+
# Display each completed movement sound in its respective player
|
| 582 |
+
if 'left_hand' in completed_movements and 'left_hand' in sounds:
|
| 583 |
+
left_hand_audio = sounds['left_hand']
|
| 584 |
+
print(f"DEBUG continue: Left hand playing: {sounds['left_hand']}")
|
| 585 |
+
if 'right_hand' in completed_movements and 'right_hand' in sounds:
|
| 586 |
+
right_hand_audio = sounds['right_hand']
|
| 587 |
+
print(f"DEBUG continue: Right hand playing: {sounds['right_hand']}")
|
| 588 |
+
if 'left_leg' in completed_movements and 'left_leg' in sounds:
|
| 589 |
+
left_leg_audio = sounds['left_leg']
|
| 590 |
+
print(f"DEBUG continue: Left leg playing: {sounds['left_leg']}")
|
| 591 |
+
if 'right_leg' in completed_movements and 'right_leg' in sounds:
|
| 592 |
+
right_leg_audio = sounds['right_leg']
|
| 593 |
+
print(f"DEBUG continue: Right leg playing: {sounds['right_leg']}")
|
| 594 |
+
if 'tongue' in completed_movements and 'tongue' in sounds:
|
| 595 |
+
tongue_audio = sounds['tongue']
|
| 596 |
+
print(f"DEBUG continue: Tongue playing: {sounds['tongue']}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 597 |
|
| 598 |
+
print(f"DEBUG continue: {len(completed_movements)} individual sounds will play together creating layered composition")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 599 |
|
| 600 |
# Format display with progress information
|
| 601 |
completed_count = len(sound_manager.movements_completed)
|
|
|
|
| 677 |
# Create visualization
|
| 678 |
fig = create_eeg_plot(epoch_data, target_movement, predicted_name, confidence, result['sound_added'])
|
| 679 |
|
| 680 |
+
# Initialize all audio components to None (no sound by default)
|
| 681 |
+
left_hand_audio = None
|
| 682 |
+
right_hand_audio = None
|
| 683 |
+
left_leg_audio = None
|
| 684 |
+
right_leg_audio = None
|
| 685 |
+
tongue_audio = None
|
|
|
|
| 686 |
|
| 687 |
+
# Always assign all completed movement sounds to their respective audio slots
|
| 688 |
+
sounds = get_movement_sounds()
|
| 689 |
+
completed_movements = sound_manager.movements_completed
|
| 690 |
+
if 'left_hand' in completed_movements and 'left_hand' in sounds:
|
| 691 |
+
left_hand_audio = sounds['left_hand']
|
| 692 |
+
if 'right_hand' in completed_movements and 'right_hand' in sounds:
|
| 693 |
+
right_hand_audio = sounds['right_hand']
|
| 694 |
+
if 'left_leg' in completed_movements and 'left_leg' in sounds:
|
| 695 |
+
left_leg_audio = sounds['left_leg']
|
| 696 |
+
if 'right_leg' in completed_movements and 'right_leg' in sounds:
|
| 697 |
+
right_leg_audio = sounds['right_leg']
|
| 698 |
+
if 'tongue' in completed_movements and 'tongue' in sounds:
|
| 699 |
+
tongue_audio = sounds['tongue']
|
| 700 |
|
| 701 |
# Format next target
|
| 702 |
next_target = sound_manager.get_current_target_movement()
|
config.py
CHANGED
|
@@ -61,9 +61,9 @@ CLASS_DESCRIPTIONS = {
|
|
| 61 |
|
| 62 |
# Demo data paths (optional) - updated with available files
|
| 63 |
DEMO_DATA_PATHS = [
|
| 64 |
-
"data/
|
| 65 |
-
"data/
|
| 66 |
-
"data/
|
| 67 |
]
|
| 68 |
|
| 69 |
# Gradio settings
|
|
|
|
| 61 |
|
| 62 |
# Demo data paths (optional) - updated with available files
|
| 63 |
DEMO_DATA_PATHS = [
|
| 64 |
+
"data/HaLTSubjectA1602236StLRHandLegTongue.mat",
|
| 65 |
+
"data/HaLTSubjectA1603086StLRHandLegTongue.mat",
|
| 66 |
+
"data/HaLTSubjectA1603106StLRHandLegTongue.mat",
|
| 67 |
]
|
| 68 |
|
| 69 |
# Gradio settings
|
sound_library.py
CHANGED
|
@@ -129,56 +129,43 @@ class AudioEffectsProcessor:
|
|
| 129 |
|
| 130 |
@staticmethod
|
| 131 |
def process_with_effects(audio_file: str, active_effects: Dict[str, bool]) -> str:
|
| 132 |
-
"""Process
|
| 133 |
try:
|
| 134 |
-
# Check if audio_file is valid
|
| 135 |
if not audio_file or not os.path.exists(audio_file):
|
| 136 |
print(f"Invalid audio file: {audio_file}")
|
| 137 |
return audio_file
|
| 138 |
-
|
| 139 |
-
# Read audio file
|
| 140 |
data, samplerate = sf.read(audio_file)
|
| 141 |
-
|
| 142 |
-
# Handle stereo to mono conversion if needed
|
| 143 |
if len(data.shape) > 1:
|
| 144 |
data = np.mean(data, axis=1)
|
| 145 |
-
|
| 146 |
-
# Apply effects based on active states
|
| 147 |
processed_data = np.copy(data)
|
| 148 |
effect_names = []
|
| 149 |
-
|
| 150 |
-
if active_effects.get("left_hand", False):
|
| 151 |
processed_data = AudioEffectsProcessor.apply_volume_fade(processed_data, "out")
|
| 152 |
effect_names.append("fade")
|
| 153 |
-
|
| 154 |
-
if active_effects.get("right_hand", False): # High Pass Filter
|
| 155 |
processed_data = AudioEffectsProcessor.apply_high_pass_filter(processed_data, samplerate)
|
| 156 |
effect_names.append("hpf")
|
| 157 |
-
|
| 158 |
-
if active_effects.get("left_leg", False): # Reverb
|
| 159 |
processed_data = AudioEffectsProcessor.apply_reverb(processed_data, samplerate)
|
| 160 |
effect_names.append("rev")
|
| 161 |
-
|
| 162 |
-
if active_effects.get("right_leg", False): # Low Pass Filter
|
| 163 |
processed_data = AudioEffectsProcessor.apply_low_pass_filter(processed_data, samplerate)
|
| 164 |
effect_names.append("lpf")
|
| 165 |
-
|
| 166 |
-
if active_effects.get("tongue", False): # Bass Boost
|
| 167 |
processed_data = AudioEffectsProcessor.apply_bass_boost(processed_data, samplerate)
|
| 168 |
effect_names.append("bass")
|
| 169 |
-
|
| 170 |
# Create unique filename based on active effects
|
| 171 |
base_name = os.path.splitext(audio_file)[0]
|
| 172 |
effects_suffix = "_".join(effect_names) if effect_names else "clean"
|
| 173 |
processed_file = f"{base_name}_fx_{effects_suffix}.wav"
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
except Exception as e:
|
| 183 |
print(f"Audio processing failed: {e}")
|
| 184 |
return os.path.abspath(audio_file) if audio_file else None
|
|
@@ -281,13 +268,14 @@ class SoundManager:
|
|
| 281 |
"""Generate a new random sequence of movements for the current cycle."""
|
| 282 |
import random
|
| 283 |
# Choose which movements to include based on configuration
|
| 284 |
-
|
|
|
|
| 285 |
random.shuffle(movements_for_cycle)
|
| 286 |
-
self.current_movement_sequence = movements_for_cycle
|
| 287 |
self.movements_completed = set()
|
| 288 |
-
|
| 289 |
-
cycle_size = len(movements_for_cycle)
|
| 290 |
print(f"π― New random sequence ({cycle_size} movements): {' β '.join([m.replace('_', ' ').title() for m in self.current_movement_sequence])}")
|
|
|
|
| 291 |
|
| 292 |
def get_current_target_movement(self) -> str:
|
| 293 |
"""Get the current movement the user should imagine."""
|
|
@@ -422,9 +410,15 @@ class SoundManager:
|
|
| 422 |
|
| 423 |
def transition_to_dj_phase(self):
|
| 424 |
"""Transition from building phase to DJ effects phase."""
|
| 425 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 426 |
self.current_phase = "dj_effects"
|
| 427 |
-
# Create mixed composition for DJ effects
|
| 428 |
self._create_mixed_composition()
|
| 429 |
print("π΅ Composition Complete! Transitioning to DJ Effects Phase...")
|
| 430 |
print("π§ You are now the DJ! Use movements to control effects:")
|
|
@@ -434,6 +428,8 @@ class SoundManager:
|
|
| 434 |
print(" 𦡠Right Leg: Low Pass Filter")
|
| 435 |
print(" π
Tongue: Bass Boost")
|
| 436 |
return True
|
|
|
|
|
|
|
| 437 |
return False
|
| 438 |
|
| 439 |
def _create_mixed_composition(self):
|
|
@@ -526,10 +522,9 @@ class SoundManager:
|
|
| 526 |
if movement not in self.active_effects:
|
| 527 |
return {"effect_applied": False, "message": f"Unknown movement: {movement}"}
|
| 528 |
|
| 529 |
-
#
|
| 530 |
self.active_effects[movement] = not self.active_effects[movement]
|
| 531 |
effect_status = "ON" if self.active_effects[movement] else "OFF"
|
| 532 |
-
|
| 533 |
effect_names = {
|
| 534 |
"left_hand": "Volume Fade",
|
| 535 |
"right_hand": "High Pass Filter",
|
|
@@ -537,10 +532,8 @@ class SoundManager:
|
|
| 537 |
"right_leg": "Low Pass Filter",
|
| 538 |
"tongue": "Bass Boost"
|
| 539 |
}
|
| 540 |
-
|
| 541 |
effect_name = effect_names.get(movement, movement)
|
| 542 |
print(f"ποΈ {effect_name}: {effect_status}")
|
| 543 |
-
|
| 544 |
# Process audio with current active effects
|
| 545 |
if self.mixed_composition_file and os.path.exists(self.mixed_composition_file):
|
| 546 |
processed_file = AudioEffectsProcessor.process_with_effects(
|
|
@@ -559,7 +552,7 @@ class SoundManager:
|
|
| 559 |
else:
|
| 560 |
print("Failed to create mixed composition, using fallback")
|
| 561 |
processed_file = self.mixed_composition_file
|
| 562 |
-
|
| 563 |
return {
|
| 564 |
"effect_applied": True,
|
| 565 |
"effect_name": effect_name,
|
|
@@ -651,6 +644,15 @@ class SoundManager:
|
|
| 651 |
first_audio_file = os.path.join(self.sound_dir, audio_files[0])
|
| 652 |
if os.path.exists(first_audio_file):
|
| 653 |
print(f"DEBUG: Using first audio file as mixed composition: {os.path.basename(first_audio_file)} (FILE SAVING DISABLED)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 654 |
return first_audio_file
|
| 655 |
|
| 656 |
# Fallback: if mixed composition file already exists, use it
|
|
|
|
| 129 |
|
| 130 |
@staticmethod
|
| 131 |
def process_with_effects(audio_file: str, active_effects: Dict[str, bool]) -> str:
|
| 132 |
+
"""Process the full track (mixed composition) with DJ effects only."""
|
| 133 |
try:
|
|
|
|
| 134 |
if not audio_file or not os.path.exists(audio_file):
|
| 135 |
print(f"Invalid audio file: {audio_file}")
|
| 136 |
return audio_file
|
|
|
|
|
|
|
| 137 |
data, samplerate = sf.read(audio_file)
|
|
|
|
|
|
|
| 138 |
if len(data.shape) > 1:
|
| 139 |
data = np.mean(data, axis=1)
|
|
|
|
|
|
|
| 140 |
processed_data = np.copy(data)
|
| 141 |
effect_names = []
|
| 142 |
+
# Apply DJ effects to the full track
|
| 143 |
+
if active_effects.get("left_hand", False):
|
| 144 |
processed_data = AudioEffectsProcessor.apply_volume_fade(processed_data, "out")
|
| 145 |
effect_names.append("fade")
|
| 146 |
+
if active_effects.get("right_hand", False):
|
|
|
|
| 147 |
processed_data = AudioEffectsProcessor.apply_high_pass_filter(processed_data, samplerate)
|
| 148 |
effect_names.append("hpf")
|
| 149 |
+
if active_effects.get("left_leg", False):
|
|
|
|
| 150 |
processed_data = AudioEffectsProcessor.apply_reverb(processed_data, samplerate)
|
| 151 |
effect_names.append("rev")
|
| 152 |
+
if active_effects.get("right_leg", False):
|
|
|
|
| 153 |
processed_data = AudioEffectsProcessor.apply_low_pass_filter(processed_data, samplerate)
|
| 154 |
effect_names.append("lpf")
|
| 155 |
+
if active_effects.get("tongue", False):
|
|
|
|
| 156 |
processed_data = AudioEffectsProcessor.apply_bass_boost(processed_data, samplerate)
|
| 157 |
effect_names.append("bass")
|
|
|
|
| 158 |
# Create unique filename based on active effects
|
| 159 |
base_name = os.path.splitext(audio_file)[0]
|
| 160 |
effects_suffix = "_".join(effect_names) if effect_names else "clean"
|
| 161 |
processed_file = f"{base_name}_fx_{effects_suffix}.wav"
|
| 162 |
+
try:
|
| 163 |
+
#sf.write(processed_file, processed_data, samplerate)
|
| 164 |
+
print(f"ποΈ Audio processed with effects: {effects_suffix} β {os.path.basename(processed_file)}")
|
| 165 |
+
return os.path.abspath(processed_file)
|
| 166 |
+
except Exception as e:
|
| 167 |
+
print(f"Failed to save processed audio: {e}")
|
| 168 |
+
return os.path.abspath(audio_file)
|
|
|
|
| 169 |
except Exception as e:
|
| 170 |
print(f"Audio processing failed: {e}")
|
| 171 |
return os.path.abspath(audio_file) if audio_file else None
|
|
|
|
| 268 |
"""Generate a new random sequence of movements for the current cycle."""
|
| 269 |
import random
|
| 270 |
# Choose which movements to include based on configuration
|
| 271 |
+
# Always use exactly 5 movements per cycle
|
| 272 |
+
movements_for_cycle = self.active_movements.copy()
|
| 273 |
random.shuffle(movements_for_cycle)
|
| 274 |
+
self.current_movement_sequence = movements_for_cycle[:5]
|
| 275 |
self.movements_completed = set()
|
| 276 |
+
cycle_size = len(self.current_movement_sequence)
|
|
|
|
| 277 |
print(f"π― New random sequence ({cycle_size} movements): {' β '.join([m.replace('_', ' ').title() for m in self.current_movement_sequence])}")
|
| 278 |
+
print(f"DEBUG: Movement sequence length = {len(self.current_movement_sequence)}")
|
| 279 |
|
| 280 |
def get_current_target_movement(self) -> str:
|
| 281 |
"""Get the current movement the user should imagine."""
|
|
|
|
| 410 |
|
| 411 |
def transition_to_dj_phase(self):
|
| 412 |
"""Transition from building phase to DJ effects phase."""
|
| 413 |
+
# Only start DJ mode if all 5 sound layers are present (not just movements completed)
|
| 414 |
+
unique_sounds = set()
|
| 415 |
+
for layer in self.composition_layers:
|
| 416 |
+
if layer.get('sound_file'):
|
| 417 |
+
unique_sounds.add(layer['sound_file'])
|
| 418 |
+
print(f"DEBUG: Unique sound files in composition_layers: {unique_sounds}")
|
| 419 |
+
print(f"DEBUG: Number of unique sounds: {len(unique_sounds)}")
|
| 420 |
+
if len(unique_sounds) >= 5:
|
| 421 |
self.current_phase = "dj_effects"
|
|
|
|
| 422 |
self._create_mixed_composition()
|
| 423 |
print("π΅ Composition Complete! Transitioning to DJ Effects Phase...")
|
| 424 |
print("π§ You are now the DJ! Use movements to control effects:")
|
|
|
|
| 428 |
print(" 𦡠Right Leg: Low Pass Filter")
|
| 429 |
print(" π
Tongue: Bass Boost")
|
| 430 |
return True
|
| 431 |
+
else:
|
| 432 |
+
print("DEBUG: Not enough unique sounds to transition to DJ mode.")
|
| 433 |
return False
|
| 434 |
|
| 435 |
def _create_mixed_composition(self):
|
|
|
|
| 522 |
if movement not in self.active_effects:
|
| 523 |
return {"effect_applied": False, "message": f"Unknown movement: {movement}"}
|
| 524 |
|
| 525 |
+
# Simple toggle logic, no BPM/beat duration, no auto-off
|
| 526 |
self.active_effects[movement] = not self.active_effects[movement]
|
| 527 |
effect_status = "ON" if self.active_effects[movement] else "OFF"
|
|
|
|
| 528 |
effect_names = {
|
| 529 |
"left_hand": "Volume Fade",
|
| 530 |
"right_hand": "High Pass Filter",
|
|
|
|
| 532 |
"right_leg": "Low Pass Filter",
|
| 533 |
"tongue": "Bass Boost"
|
| 534 |
}
|
|
|
|
| 535 |
effect_name = effect_names.get(movement, movement)
|
| 536 |
print(f"ποΈ {effect_name}: {effect_status}")
|
|
|
|
| 537 |
# Process audio with current active effects
|
| 538 |
if self.mixed_composition_file and os.path.exists(self.mixed_composition_file):
|
| 539 |
processed_file = AudioEffectsProcessor.process_with_effects(
|
|
|
|
| 552 |
else:
|
| 553 |
print("Failed to create mixed composition, using fallback")
|
| 554 |
processed_file = self.mixed_composition_file
|
| 555 |
+
|
| 556 |
return {
|
| 557 |
"effect_applied": True,
|
| 558 |
"effect_name": effect_name,
|
|
|
|
| 644 |
first_audio_file = os.path.join(self.sound_dir, audio_files[0])
|
| 645 |
if os.path.exists(first_audio_file):
|
| 646 |
print(f"DEBUG: Using first audio file as mixed composition: {os.path.basename(first_audio_file)} (FILE SAVING DISABLED)")
|
| 647 |
+
# Estimate BPM from the mixed composition audio file
|
| 648 |
+
try:
|
| 649 |
+
import librosa
|
| 650 |
+
y, sr = librosa.load(first_audio_file, sr=None)
|
| 651 |
+
tempo, _ = librosa.beat.beat_track(y=y, sr=sr)
|
| 652 |
+
self.bpm = int(tempo)
|
| 653 |
+
print(f"Estimated BPM from track: {self.bpm}")
|
| 654 |
+
except Exception as e:
|
| 655 |
+
print(f"Could not estimate BPM: {e}")
|
| 656 |
return first_audio_file
|
| 657 |
|
| 658 |
# Fallback: if mixed composition file already exists, use it
|