summaryrefslogtreecommitdiffstats
path: root/theremin.m
diff options
context:
space:
mode:
authorNiklas Halle <niklas@niklashalle.net>2021-04-05 16:50:08 +0200
committerNiklas Halle <niklas@niklashalle.net>2021-04-05 16:50:08 +0200
commit06cb8a4b0a04469fc7024a1436bea9896f90c242 (patch)
tree706275b1f43ce6342530edc1cebd67d3c79eee94 /theremin.m
parentcf424d42e34700b72173c265c75485ae81a5ab05 (diff)
downloadwdti_project-06cb8a4b0a04469fc7024a1436bea9896f90c242.tar.gz
wdti_project-06cb8a4b0a04469fc7024a1436bea9896f90c242.zip
updates
Diffstat (limited to 'theremin.m')
-rw-r--r--theremin.m9
1 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..