Skip to content

Commit a12323b

Browse files
author
klaus
committed
Fxied some small bug in find_wba_by_phrases, formmatting, typos
1 parent bdf248e commit a12323b

7 files changed

+19
-12
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: parkR
22
Type: Package
33
Title: Generating monophonic jazz solos for chord sequences and more
4-
Version: 0.5.6
4+
Version: 0.5.7
55
Authors@R: c(
66
person("Klaus", "Frieler", email = "[email protected]", role = c("aut","cre"))
77
)

R/bigram_stack.R

+8-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,14 @@ get_all_subgrams <- function(bigram_stack, bi_enc, level, mode = "all"){
243243
}
244244

245245
#' @export
246-
ngram_analysis <- function(x, max_level = Inf, with_overlap = T, min_level = 2, min_n = 2, min_DF = 1, excess_n = 1, ids = NULL){
246+
ngram_analysis <- function(x,
247+
max_level = Inf,
248+
with_overlap = T,
249+
min_level = 2,
250+
min_n = 2,
251+
min_DF = 1,
252+
excess_n = 1,
253+
ids = NULL){
247254
#if(is.null(ids)){
248255
# if("id" %in% names(x) && is.dataframe(x)){
249256
# ids <- x$ids

R/convert.R

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ beats_per_bar <- 4
44

55
#' phrase_to_mcsv2
66
#'
7-
#' This function format a generated phrase to mcsv2-like data fraem
7+
#' This function format a generated phrase to mcsv2-like data frame
88
#'
99
#' @param phrase_tbl (data frame) generated phrase data.frame
1010
#' @param tempo (double scale) Tempo (bpm) of the generated solo.
@@ -38,7 +38,7 @@ phrase_to_mcsv2 <- function(phrase_tbl, tempo = 120, phrase_id = 1, chorus_id =
3838

3939
#' chorus_to_mcsv2
4040
#'
41-
#' This function formats a generated chorus to mcsv2-compatible data fraem
41+
#' This function formats a generated chorus to mcsv2-compatible data frame
4242
#'
4343
#' @param chorus_tbl (data frame) generated phrases in data.frame
4444
#' @param tempo (double scale) Tempo (bpm) of the generated solo.
@@ -55,7 +55,7 @@ chorus_to_mcsv2 <- function(chorus_tbl, tempo = 120, chorus_id = 1){
5555

5656
#' solo_to_mcsv2
5757
#'
58-
#' This function formats a generated solo to mcsv2-compatible data fraem
58+
#' This function formats a generated solo to mcsv2-compatible data frame
5959
#'
6060
#' @param solo_tbl (data frame) generated phrases in data.frame
6161
#' @param tempo (double scale) Tempo (bpm) of the generated solo.

R/interval_grammar.R

+4-4
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ int_span <- function(start, end){
9292

9393
#' @export
9494
vec_to_value <- function(int_vec){
95-
sprintf("[%s]", paste(int_vec, collapse=","))
95+
sprintf("[%s]", paste(int_vec, collapse = ","))
9696
}
9797

9898
add_overlaps <- function(data, type = c("all", "pre", "post")) {
@@ -479,8 +479,7 @@ fill_up_classes <- function(int_vector, class_df){
479479
direction = sign(sum(int_vector[1:l])),
480480
value = vec_to_value(int_vector[1:l]),
481481
start = 1,
482-
end = l,
483-
stringsAsFactors = F)
482+
end = l)
484483
return(prefix)
485484
}
486485
events <- int_span(class_df$start, class_df$end)
@@ -1005,9 +1004,10 @@ find_wba_by_phrase <- function(data, id = NULL){
10051004
}
10061005
phrases <- unique(data$phrase_id)
10071006
ret <- list()
1007+
int_col <- ifelse("int" %in% names(data), "int", "int_raw")
10081008
for(i in phrases){
10091009
#print(sprintf("Checking phrase %d", i))
1010-
int_vector <- data[data$phrase_id == i,]$int_raw %>% na.omit()
1010+
int_vector <- data[data$phrase_id == i, ] %>% pull(!!int_col) %>% na.omit()
10111011
#ignore last interval because it belongs to next phrase
10121012
tmp <- find_wba(int_vector[1:(length(int_vector)-1)])
10131013
tmp$phrase_id <- i

man/chorus_to_mcsv2.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/phrase_to_mcsv2.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/solo_to_mcsv2.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)