From 06cb8a4b0a04469fc7024a1436bea9896f90c242 Mon Sep 17 00:00:00 2001 From: Niklas Halle Date: Mon, 5 Apr 2021 16:50:08 +0200 Subject: updates --- theremin.m | 9 +++++---- theremin_ui.mlapp | Bin 149110 -> 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 Binary files a/theremin_ui.mlapp and b/theremin_ui.mlapp differ -- cgit v1.2.3-54-g00ecf