Skip to content

Commit d508b57

Browse files
author
klaus
committed
Fixed bug in find_chords
1 parent 657fcc9 commit d508b57

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

R/interval_grammar.R

+5-4
Original file line numberDiff line numberDiff line change
@@ -361,19 +361,19 @@ find_chords <- function(int_vector){
361361
arp_int_vector <- sign(int_vector) * get_arp_int_from_int(int_vector)
362362
tmp <- get_rle_df(arp_int_vector)
363363
tmp2 <- tmp %>% filter(value != 0, length > 1)
364-
if(nrow(tmp2) == 0){
364+
365+
if(!all( get_arp_int_from_int(int_vector))){
365366
iv <- int_vector[int_vector != 0] %>% cumsum()
366367
iv <- iv %% 12 %>% sort() %>% diff()
367368
if(length(setdiff(iv, c(3, 4))) != 0){
368369
return(NULL)
369370
}
370371
tmp <- tibble(length = length(int_vector),
371-
direction = sign(cumsum(int_vector)[-1]),
372+
direction = sign(cumsum(int_vector)[length(int_vector)]),
372373
start = 1,
373374
end = length(int_vector))
374375
}
375-
browser()
376-
376+
#browser()
377377
tmp$type <- "J"
378378
tmp$value <- values_from_positions(int_vector, tmp)
379379
triads<- !as.logical(
@@ -535,6 +535,7 @@ normalize <- function(data){
535535

536536
find_classes <- function(int_vector, debug = F){
537537
if(debug) cat("Testing", paste(int_vector, collapse = ","), "\n")
538+
browser()
538539
repetitions <- find_repetitions(int_vector)
539540
#print(repetitions)
540541
scales <- find_scales(int_vector)

0 commit comments

Comments
 (0)