From 9cb5a05744ab9f1f41eb68730a0322044be9b879 Mon Sep 17 00:00:00 2001 From: angel Date: Thu, 23 Jun 2005 06:23:13 +0000 Subject: [PATCH] Fixed ss_tempo_from_wave() algorithm. Tempo from wave printing is considered working (Closes: #1060). git-svn-id: file:///home/angel/tmp/svn-triptico/ahxm/trunk@703 c87de0a0-a11c-0410-a1e5-866214bc28b2 --- TODO | 2 +- ss_core.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index 1440dd2..0d5760b 100644 --- a/TODO +++ b/TODO @@ -5,7 +5,6 @@ Release Critical Bugs --------------------- * 1052: Add quantizations. - * 1060: Add print_tempo_from_wave to language. * 1079: Move midiin.c functionality to main.c. * 1086: MIDI output is still done to stdout (file descriptor 2). * 1055: Add signal control to cleanly close the devices. @@ -207,5 +206,6 @@ Closed the ahxm programmer to change it manually (Closed by 1060; Tue, 21 Jun 2005 16:13:09 +0200). * 1067: Fill the extended commands document (Tue, 21 Jun 2005 17:19:28 +0200). + * 1060: Add print_wave_tempo to language (Thu, 23 Jun 2005 08:22:06 +0200). Email bugs to angel@triptico.com diff --git a/ss_core.c b/ss_core.c index 5d9d176..f24390c 100644 --- a/ss_core.c +++ b/ss_core.c @@ -229,13 +229,14 @@ double ss_tempo_from_wave(struct ss_wave * w, int note, double len) d=ss_note_frequency(note) / w->base_freq; /* get the length of a whole, in seconds */ - d *= w->size / w->s_rate; + d *= w->s_rate / w->size; /* convert to minutes */ d *= 60.0; - /* convert to the desired whole notes */ - d *= len; + /* then to bpm,s */ + d *= 4.0; + d /= len; return(d); } -- 2.11.4.GIT