summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--theremin.m9
-rw-r--r--theremin_ui.mlappbin149110 -> 38823 bytes
2 files changed, 5 insertions, 4 deletions
diff --git a/theremin.m b/theremin.m
index 3a1ebfe..b2a1e6c 100644
--- a/theremin.m
+++ b/theremin.m
@@ -101,9 +101,9 @@ while gesture_count < const_frames_per_second
buffer_under_flow = deviceWriter(signal(:));
- if buffer_under_flow ~= 0
- disp("Buffer ran empty!");
- end
+ %if buffer_under_flow ~= 0
+ % disp("Buffer ran empty!");
+ %end
complete_signal = [complete_signal signal];
end
@@ -162,10 +162,11 @@ disp('If you want to save your audio, run `audiowrite(<.wav filename>, complete_
function [sound,offset] = get_theremin_sound_bit(x, y, offset, generator)
% the values used here are mostly empirical
+
volume = y / 1300;
% How it works:
% https://web.physics.ucsb.edu/~lecturedemonstrations/Composer/Pages/60.17.html
- frequency = max(0.003, (x - 50) / 220) * 1000; % have at least 3Hz
+ frequency = max(3, (x + 155) * pi); % have at least 3Hz
% here we generate the array to put into sin(), but offset it with the
% the previous frames offset..
diff --git a/theremin_ui.mlapp b/theremin_ui.mlapp
index 5f7863f..c04559a 100644
--- a/theremin_ui.mlapp
+++ b/theremin_ui.mlapp
Binary files differ