Neural and Behavioral Tracking of Musical Phrases Occurs Without Temporal Regularity.
The 11 matches
- [1] § Methods › Neural Tracking of Phrase Structure ↔ eeg_analysis/7_TRF_power_random_phrase_boundary.m, lines 1–67 · score 0.79 · ft_freqanalysis, FieldTrip, phrase tracking, 2.48, wavelet, phrase boundaries
- [2] § Methods › Neural Tracking of Phrase Structure ↔ eeg_analysis/6_TRF_power_with_acoustic_predictors.m, lines 2–67 · score 0.79 · ft_freqanalysis, FieldTrip, 2.48, phrase tracking, wavelet, widths
- [3] § Results › Phrase Boundary Detection Relies on Structural Cues Rather Than Local Acoustic Changes ↔ behavioural_analysis/analysis_behavioural.Rmd, lines 583–641 · score 0.73 · linear model, boundary detection, acoustic features, frequency interval, fitted, phrase boundaries
- [4] § Methods › Stimuli ↔ behavioural_analysis/analysis_behavioural.Rmd, lines 396–463 · score 0.69 · frequency interval, acoustic features, lme4, binomial, glmer, model
- [5] § Results › Listeners Are Able to Detect Phrase Boundaries ↔ behavioural_analysis/analysis_behavioural.Rmd, lines 177–198 · score 0.67 · Tukey HSD, post hoc, Krippendorff, agreement, adj, ANOVA
- [6] § Methods › EEG Data Preprocessing ↔ eeg_analysis/2_MCCA.m, lines 51–101 · score 0.64 · pass filter, FieldTrip, Epochs, preprocessed, MATLAB, ICA
- [7] § Methods › EEG Data Preprocessing ↔ eeg_analysis/1_read_data.m, lines 9–95 · score 0.63 · FieldTrip toolbox, preprocessed, MATLAB, filter, offset, 35 Hz
- [8] § Results › Neural Tracking of Phrase Boundaries Is the Strongest for Regular Phrases ↔ eeg_analysis/7_TRF_power_random_phrase_boundary.m, lines 223–345 · score 0.60 · randomized boundary predictors, phrase boundary predictor, TRF models, band, positions, power
- [9] § Methods › Cerebral–Acoustic Coherence (Cacoh) ↔ eeg_analysis/3_Cacoh.m, lines 30–83 · score 0.60 · 0.1–20 Hz, Hanning, mscohere, coherence, Cacoh, 0.1 Hz
- [10] § Methods › Analysis of Behavioral Data ↔ behavioural_analysis/analysis_behavioural.Rmd, lines 583–641 · score 0.57 · Detection rate, frequency interval, fitted, model, phrase boundary, acoustic
- [11] § Methods › Temporal Response Function (TRF) Over Acoustic Envelope ↔ eeg_analysis/stimuli_envelope_trf.m, lines 1–84 · score 0.52 · 4000 Hz, filterbank, gammatone, bands, envelope, TRF
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
R Markdown · 641 lines · 20 KB · no license · 4 matches
- # **ENVIRONMENT SET-UP**
- load required packages
- ```{r libraries}
- rm(list=ls())
- library(scales)
- library(readxl)
- library(tidyr)
- library(plyr)
- library(dplyr)
- library(ggplot2)
- library(Rmisc)
- library(tidyverse)
- #library(hrbrthemes)
- library(ggpubr)
- library(psych)
- library(slider)
- library(rstatix)
- library(lme4)
- library(irr)
- library(svglite)
- library(sjPlot)
- ```
- load data
- ```{r data, include=FALSE}
- setwd("~/Documents/Phrase_tracking/4_Analysis/1_behavioural/data")
- real_data <- read_csv('realness_rating.csv')
- df <- read_csv("df.csv")
- df_zeros <- read_csv("df_zeros.csv")
- beat_setup <- read_csv('beat_setup.csv')
- signal_theory <- read_csv('signal_theory.csv')
- signal_df <- read_csv('signal_df.csv')
- goldmsi <- read_csv('goldmsi.csv')
- stamps <- read_csv('stamps.csv')
- stamps$beat <- floor(stamps$beat)
- ```
- load variables
- ``` {r variables}
- palette = c("#D81B60", "#1E88E5", "#FFC107")
- conditions = c(
- "regular_maj_1_a", "regular_maj_2_a", "regular_min_1_a", "regular_min_2_a",
- "irregular_maj_1_a", "irregular_maj_2_a", "irregular_min_1_a", "irregular_min_2_a",
- "shuffled_maj_1_a", "shuffled_maj_2_a", "shuffled_min_1_a", "shuffled_min_2_a"
- )
- plot_DIR = "~/Documents/Phrase_tracking/4_Analysis/1_behavioural/plots"
- ```
- # **S1 - individual differences in behavioural task**
- ```{r}
- temp_cond = "regular_maj_1_a"
- df_plot <- df %>%
- filter(condition==temp_cond) ##SET THE STIMULUS NAME
- df_plot <- df_plot %>%
- group_by(number, sub_ID)
- intercept = stamps %>% filter(Stim==temp_cond)
- df_plot$sub_ID <- sub("^.{3}", "", df_plot$sub_ID)
- ind_plot = df_plot %>%
- ggplot(aes(x=number, y=N)) +
- geom_col(fill="#2E75B6", color="#2E75B6", alpha=0.6)+
- theme_minimal()+
- # ggtitle("Regular major - version 1") + ##CHANGE TITLE ACCORDING TO THE SIMULUS
- theme(plot.title = element_text(size=15),
- #axis.text.x =element_blank(),
- axis.text.y =element_blank(),
- strip.text.y = element_text(angle = 0),
- #axis.title.x = element_text(hjust=0.95),
- axis.title.y = element_text(hjust=0.95),
- text=element_text(size=11, family="Arial"),
- panel.border = element_blank(),
- #panel.grid.major = element_blank(),
- #panel.grid.minor = element_blank(),
- panel.background = element_blank())+
- #axis.line = element_line(colour = "black")
- scale_x_continuous(breaks = seq(0, 100, 5))+
- scale_y_continuous(breaks = seq(0, 2, 2))+
- ylab(" ")+
- xlab("Time (in beats of musical piece)")+
- theme(legend.position="none")+
- facet_grid(rows = vars(sub_ID))+
- geom_vline(xintercept = intercept$beat, alpha=0.6)
- ggsave(filename = file.path(plot_DIR, 'indiv_data.svg'), plot = ind_plot, width = 10, height = 7, units = "in")
- ```
- ```{r aggregated data from participants}
- df_plot <- df_plot %>%
- group_by(number) %>%
- summarise(total=sum(N))
- intercept = stamps %>% filter(Stim==temp_cond)
- agg_plot = df_plot %>%
- ggplot(aes(x=number, y=total)) +
- geom_col(fill="#2E75B6", color="#2E75B6", alpha=0.6)+
- theme_classic()+
- theme(plot.title = element_text(size=15),
- axis.text.x =element_blank(),
- # axis.text.y =element_blank(),
- strip.text.y = element_text(angle = 0),
- axis.title.y = element_text(hjust=0.95),
- text=element_text(size=11, family="Arial"),
- panel.border = element_blank(),
- panel.background = element_blank())+
- scale_x_continuous(breaks = seq(0, 100, 5))+
- scale_y_continuous(breaks = seq(0, 15, 3))+
- ylab(" ")+
- xlab(" ")+
- theme(legend.position="none")+
- geom_vline(xintercept = intercept$beat, alpha=0.6)
- ggsave(filename = file.path(plot_DIR, 'agg_data.svg'), plot = agg_plot, width = 14, height = 3, units = "in")
- ```
- # **REALNESS OF THE MELODY**
- ```{r plot}
- real_data %>%
- ggplot(aes(x=items, y=scores, fill=category)) +
- scale_fill_manual(values=palette)+
- geom_boxplot(varwidth = TRUE, alpha=0.3) +
- theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
- stat_summary(fun=mean, colour="black", geom="point",
- shape=20, size=2, show.legend=FALSE, alpha=0.5) #+
- geom_jitter(color="black", size=0.4, alpha=0.9) # add or remove jitter
- ```
- ```{r data prep}
- real_data_agr <- aggregate(scores ~ items+category+subject, data = real_data, FUN=mean)
- names(real_data_agr)[2] <- "condition"
- res.aov = aov(scores ~ condition, data = real_data_agr)
- summary(res.aov)
- ```
- ```{r models}
- real.model = lmer(scores ~ condition + (1|items) + (1|subject), data = real_data_agr, REML = F)
- summary(real.model)
- tab_model(real.model)
- null.model = lmer(scores ~ 1 + (1|items) + (1|subject), data = real_data_agr, REML =F )
- summary(null.model)
- anova(real.model, null.model)
- ```
- # **KRIPPENDORFF'S ALPHA**
- ```{r compute kripp's alpha}
- process_condition <- function(data, cond) {
- condition_data <- data %>%
- filter(condition == cond) %>%
- select(-(1:5)) %>%
- as.matrix()
- condition_data <- condition_data[rowSums(condition_data, na.rm = TRUE) > 1, ] #remove rows with 1 or less observations
- kripp.alpha(condition_data)[[5]]
- }
- agreement_scores <- matrix(nrow = length(conditions), ncol = 2)
- colnames(agreement_scores) <- c("condition", "alpha")
- agreement_scores[, 1] <- conditions
- for (i in seq_along(conditions)) {
- agreement_scores[i, 2] <- process_condition(df_zeros, conditions[i])
- }
- agreement_scores <- as.data.frame(agreement_scores)
- agreement_scores$alpha <- as.numeric(agreement_scores$alpha)
- agreement_scores <- agreement_scores %>%
- mutate(category = case_when(
- startsWith(condition, "ir") ~ "irregular",
- startsWith(condition, "re") ~ "regular",
- startsWith(condition, "sh") ~ "shuffled"
- ))
- ```
- ```{r plot}
- res.aov_kripp <- agreement_scores %>% anova_test(alpha ~ category)
- post_hoc <- agreement_scores %>%
- tukey_hsd(alpha ~ category)
- post_hoc <- post_hoc %>% add_xy_position(x = "category")
- agreement_scores$category <- factor(agreement_scores$category, levels = c("irregular", "regular", "shuffled"))
- plot = ggboxplot(agreement_scores, x = "category", y = "alpha", fill = "category", alpha=0.8) +
- stat_pvalue_manual(post_hoc, label = "p.adj.signif", tip.length = 0.005, step.increase = 0.01) +
- scale_fill_manual(values=palette) +
- ylab("Krippendorff's alpha") +
- xlab("") +
- theme_classic() +
- theme(
- legend.position = "none",
- axis.text = element_text(size = 14),
- axis.title = element_text(size = 18)
- )
- plot
- ggsave(filename = file.path(plot_DIR, 'kripp_alpha.svg'), plot = plot, width = 6, height = 6, units = "in")
- ```
- ```{r model}
- kripp.model = lm(alpha ~ category, data = agreement_scores)
- summary(kripp.model)
- ```
- # **F-SCORE**
- ```{r compute}
- signal_theory[is.na(signal_theory)] <- 0
- signal_theory <- add_column(signal_theory, precision = NA)
- signal_theory <- add_column(signal_theory, recall = NA)
- signal_theory <- add_column(signal_theory, ff1 = NA)
- for (i in 1:nrow(signal_theory)) {
- #precision
- signal_theory [[i, 7]] <- signal_theory[[i, 5]]/(signal_theory[[i, 5]]+signal_theory[[i, 4]])
- #recall
- signal_theory [[i, 8]] <- signal_theory[[i,5]]/(signal_theory[[i, 5]]+signal_theory[[i, 6]])
- #ff1
- signal_theory[[i,9]] <- 2/((1/signal_theory[[i, 8]])+(1/signal_theory[[i,7]]))
- }
- ```
- ``` {r}
- signal_theory<- add_column(signal_theory, category = NA)
- signal_theory <- signal_theory %>%
- mutate(category = case_when(
- startsWith(condition, "ir") ~ "irregular",
- startsWith(condition, "re") ~ "regular",
- startsWith(condition, "sh") ~ "shuffled"
- ))
- ```
- ```{r plot}
- signal_theory_agg <- signal_theory %>%
- group_by(sub_ID, category) %>%
- summarize(avg_ff1 = mean(ff1, na.rm = TRUE), .groups = 'drop')
- stat.test_ff1 <- signal_theory_agg %>%
- anova_test(dv = avg_ff1, wid = sub_ID, within = category) %>%
- add_significance()
- post_hoc <- signal_theory_agg %>%
- pairwise_t_test(avg_ff1 ~ category, paired = TRUE, p.adjust.method = "bonferroni")
- post_hoc <- post_hoc %>%
- add_xy_position(x = "category", step.increase = 0.22)
- plot_f <- ggplot(signal_theory_agg, aes(x = category, y = avg_ff1)) +
- #geom_boxjitter(aes(fill = category),jitter.shape = 21, jitter.color = NA, outlier.color = NA, errorbar.draw = TRUE) +
- geom_violin(aes(fill=category)) +
- geom_boxplot(width = 0.4, color = 'black', alpha = 0.4) +
- scale_fill_manual(values = palette) +
- stat_pvalue_manual(post_hoc, label = 'p.adj.signif', tip.length = 0.01) +
- #labs(subtitle = get_test_label(stat.test_ff1, detailed = TRUE)) +
- scale_y_continuous(breaks = c(0, 0.25, 0.5, 0.75, 1), limits = c(0, 1), labels = c(0, 0.25, 0.5, 0.75, 1)) +
- ylab('F-score')+
- xlab('')+
- theme_classic()+
- theme(legend.position = "none",
- axis.text=element_text(size=14),
- axis.title=element_text(size=18))
- plot_f
- ggsave(filename = file.path(plot_DIR, 'ff1.svg'), plot = plot_f, width = 6, height = 6, units = "in")
- ```
- ```{r model}
- accuracy.model = lmer(ff1~ category + (1|sub_ID) + (1|condition), data=signal_theory, REML=T)
- null.model = lmer(ff1 ~ 1 + (1|sub_ID) + (1|condition), data=signal_theory,REML=T)
- anova(null.model, accuracy.model)
- summary(accuracy.model)
- ```
- # **Gold-MSI**
- ```{r data preparation}
- gold_df <- signal_theory[,-c(3:8)]
- gold_df_agg <- gold_df %>%
- group_by(sub_ID, category) %>%
- summarize(avg_ff1 = mean(ff1, na.rm = TRUE), .groups = 'drop')
- regular_irregular_avg <- gold_df_agg %>%
- filter(category %in% c("regular", "irregular")) %>%
- group_by(sub_ID) %>%
- summarize(avg_ff1 = mean(avg_ff1, na.rm = TRUE), .groups = 'drop') %>%
- mutate(category = "avg")
- # Combine the new category with the original aggregated data
- gold_df_combined <- bind_rows(gold_df_agg, regular_irregular_avg)
- gold_df_agg <- pivot_wider(gold_df_combined, names_from = category, values_from = avg_ff1)
- gold_df_agg$MT <- goldmsi$MT
- gold_df_agg$GI <- goldmsi$GI
- gold_df_agg <- pivot_longer(gold_df_agg, cols = 2:5, names_to = "category", values_to = "avg_ff1")
- gold_df_agg <- pivot_longer(gold_df_agg, cols = 2:3, names_to = "scales", values_to = "goldmsi")
- ```
- ```{r correlation}
- MT <- gold_df_agg %>%
- filter(scales == "MT") %>%
- ggplot(aes(x = goldmsi, y = avg_ff1, color = category)) +
- geom_point(alpha = 0.4, size = 0.5, aes(color = category,)) +
- #geom_smooth(method = "lm", aes(group = 1), color = "black",
- # alpha = 0.2, se = TRUE, linetype = 1, size = 0.5) + # General fit
- geom_smooth(method = "lm", alpha = 0.2, se = TRUE, linetype = 1, size = 0.5) + # Condition fits
- ylim(0, 0.85) +
- scale_color_manual(values = c('#000000', palette)) +
- xlab("Musical Training") +
- ylab("F-score") +
- theme_classic()+
- theme(legend.position = "none",
- axis.text=element_text(size=14),
- axis.title=element_text(size=18))
- GI <- gold_df_agg %>%
- filter(scales == "GI") %>%
- ggplot(aes(x = goldmsi, y = avg_ff1, color = category)) +
- geom_point(alpha = 0.4, size = 0.5, aes(color = category,)) +
- #geom_smooth(method = "lm", aes(group = 1), color = "black",
- # alpha = 0.2, se = TRUE, linetype = 1, size = 0.5) + # General fit
- geom_smooth(method = "lm", alpha = 0.2, se = TRUE, linetype = 1, size = 0.5) + # Condition fits
- ylim(0, 0.85) +
- scale_color_manual(values = c('#000000', palette)) +
- xlab("General Index") +
- ylab("F-score") +
- theme_classic()+
- theme(legend.position = "none",axis.text=element_text(size=14),
- axis.title=element_text(size=18))
- plot_g <- ggarrange(MT,GI,
- ncol = 1, nrow = 2)
- ggsave(filename = file.path(plot_DIR, 'gold_corr.svg'), plot = plot_g, width = 4, height = 6, units = "in")
- ```
- ```{r}
- # General correlation for MT
- MT_data <- gold_df_agg %>%
- filter(scales == "MT") %>%
- filter(category == 'avg')
- general_corr_MT <- cor.test(MT_data$goldmsi, MT_data$avg_ff1)
- # Print general correlation results for MT
- print(paste("MT General Correlation: r = ", round(general_corr_MT$estimate, 3),
- ", p = ", round(general_corr_MT$p.value, 3)))
- # General correlation for GI
- GI_data <- gold_df_agg %>%
- filter(scales == "GI") %>%
- filter(category == 'avg')
- general_corr_GI <- cor.test(GI_data$goldmsi, GI_data$avg_ff1)
- # Print general correlation results for GI
- print(paste("GI General Correlation: r = ", round(general_corr_GI$estimate, 3),
- ", p = ", round(general_corr_GI$p.value, 3)))
- # Category-specific correlations for MT
- category_corr_MT <- gold_df_agg %>%
- filter(scales == "MT") %>%
- group_by(category) %>%
- summarize(
- correlation = map_dbl(list(cor.test(goldmsi, avg_ff1)), ~ .x$estimate), # Extract correlation coefficient (r)
- p_value = map_dbl(list(cor.test(goldmsi, avg_ff1)), ~ .x$p.value), # Extract p-value
- df = map_dbl(list(cor.test(goldmsi, avg_ff1)), ~ .x$parameter)
- )
- # Print category-specific correlations for MT
- print("MT Category-Specific Correlations:")
- print(category_corr_MT)
- # Category-specific correlations for GI
- category_corr_GI <- gold_df_agg %>%
- filter(scales == "GI") %>%
- group_by(category) %>%
- summarize(
- correlation = map_dbl(list(cor.test(goldmsi, avg_ff1)), ~ .x$estimate), # Extract correlation coefficient (r)
- p_value = map_dbl(list(cor.test(goldmsi, avg_ff1)), ~ .x$p.value), # Extract p-value
- df = map_dbl(list(cor.test(goldmsi, avg_ff1)), ~ .x$parameter)
- )
- # Print category-specific correlations for GI
- print("GI Category-Specific Correlations:")
- print(category_corr_GI)
- ```
- # ** ACOUSTIC PREDICTORS **
- ```{r}
- conditions <- c(
- "regular_maj_1_a", "regular_maj_2_a", "regular_min_1_a", "regular_min_2_a",
- "irregular_maj_1_a", "irregular_maj_2_a", "irregular_min_1_a", "irregular_min_2_a"
- )
- load_acoustic_features <- function(condition_name) {
- file_path <- paste0("~/Documents/Phrase_tracking/3_Experiment/6_stimuli/original/conditions/",
- condition_name, ".csv")
- df <- read_delim(file_path, delim = ";", col_names = TRUE, show_col_types = FALSE)
- df <- df %>%
- mutate(
- # Previous note duration (0 for first note)
- previous_duration = ifelse(row_number() == 1, 0, lag(duration)),
- # Frequency interval (0 for first note)
- prev_freq = lag(freq),
- freq_interval = ifelse(row_number() == 1, 0, abs(freq - prev_freq)),
- # Add stimulus name
- stimulus = condition_name,
- # Add melody identifier (each stimulus is a melody)
- melody = condition_name
- ) %>%
- select(melody, stimulus, onset_sec, boundary, duration, previous_duration,
- freq, freq_interval)
- return(df)
- }
- acoustic_data <- map_dfr(conditions, load_acoustic_features)
- acoustic_data <- acoustic_data %>%
- mutate(
- condition = case_when(
- startsWith(stimulus, "regular") ~ "regular",
- startsWith(stimulus, "irregular") ~ "irregular",
- TRUE ~ "other"
- ),
- condition_factor = factor(condition, levels = c("irregular", "regular"))
- )
- acoustic_data <- acoustic_data %>%
- mutate(
- previous_duration_z = scale(previous_duration)[,1],
- freq_interval_z = scale(freq_interval)[,1]
- )
- acoustic_data_clean <- acoustic_data %>%
- group_by(melody) %>%
- filter(row_number() > 1) %>%
- ungroup()
- boundary_model <- glmer(
- boundary ~ previous_duration_z * condition_factor +
- freq_interval_z * condition_factor +
- (1|melody),
- data = acoustic_data_clean,
- family = binomial(link = "logit"),
- control = glmerControl(optimizer = "bobyqa")
- )
- tab_model(boundary_model)
- summary(boundary_model)
- ```
- # *RT at boundary*
- ```{r}
- setwd("~/Documents/Phrase_tracking/4_Analysis/1_behavioural")
- data <- readxl::read_excel("excel_test.xlsx", sheet="processed")
- stamps <- readxl::read_excel("~/Documents/Phrase_tracking/3_Experiment/6_stimuli/stim - time stamps.xlsx")
- df <- read_csv("df.csv")
- df_zeros <- read_csv("df_zeros.csv")
- data <- data[ -c(2:6)]
- data$hit <- 0
- data <- data %>%
- mutate(category = case_when(
- startsWith(STIMULUS, "ir") ~ "irregular",
- startsWith(STIMULUS, "re") ~ "regular",
- startsWith(STIMULUS, "sh") ~ "shuffled"
- ))
- data$gt <- 0
- data <- data %>%
- filter(category != "shuffled")
- stamps <- stamps %>%
- filter(phrase_dur_s != "onset")
- for (j in 1:nrow(data)){
- value <- as.numeric(data[j, 4])
- cur_stim <- as.character(data[j, 2])
- temp_df <- stamps %>%
- filter(Stim ==cur_stim)
- for (i in 1:nrow(temp_df)) {
- bound <- as.numeric(temp_df[i, 4])
- bef <- bound - 1
- af <- bound + 1
- if (data[j, 5]==0){
- if(value >= bef & value <= af){
- data[j, 5] <- 1
- data[j, 7] <- bound
- } else {
- data[j, 5] <- 0
- }
- }
- }
- }
- hits <- data %>%
- filter(hit==1)
- hits$distance <- NA
- for (k in 1:nrow(hits)) {
- bound <- as.numeric(hits[k, 7])
- click <- as.numeric(hits[k, 4])
- dist <- as.numeric(click - bound)
- hits[k, 8] <- dist
- }
- cat("\nOverall statistics:\n")
- cat("Mean:", mean(hits$distance, na.rm = TRUE), "\n")
- cat("SD:", sd(hits$distance, na.rm = TRUE), "\n")
- distance_summary <- hits %>%
- group_by(category) %>%
- summarise(
- mean_distance = mean(distance, na.rm = TRUE),
- sd_distance = sd(distance, na.rm = TRUE),
- n = n(),
- se_distance = sd_distance / sqrt(n)
- )
- print(distance_summary)
- # T-test comparing regular vs irregular
- t_test_result <- t.test(distance ~ category, data = hits)
- print(t_test_result)
- # Create the plot
- colors <- c("regular" = "#1E88E5", "irregular" = "#D81B60")
- plot_distance <- ggplot(hits, aes(x = category, y = distance, fill = category)) +
- scale_fill_manual(values = colors) +
- geom_violin(width = 0.6) +
- geom_boxplot(alpha=0.4, width = 0.3)+
- labs(
- title = "Mean Distance from Phrase Boundary by Category",
- x = "Category",
- y = "Mean Distance (s)",
- fill = "Category"
- ) +
- theme_minimal() +
- theme(
- legend.position = "none",
- plot.title = element_text(hjust = 0.5, face = "bold"),
- axis.text = element_text(size = 12),
- axis.title = element_text(size = 13, face = "bold")
- )
- print(plot_distance)
- plot_distance <- ggplot(hits, aes(x = category, y = distance, fill = category)) +
- geom_violin(alpha = 1, width=0.3) +
- geom_boxplot(width = 0.2, color = 'black', alpha = 0.4) +
- scale_fill_manual(values = palette) +
- scale_y_continuous(lim = c(-2, 2))+
- #stat_pvalue_manual(stat_test, label = 'p.adj.signif', tip.length = 0.01) +
- ylab('Distance from boundary (s)') +
- xlab('') +
- theme_classic() +
- theme(
- legend.position = "none",
- axis.text = element_text(size = 14),
- axis.title = element_text(size = 18)
- )
- print(plot_distance)
- ggsave('time_difference.svg', plot = plot_distance)
- ```
- # *ACCURACY OF PHRASE BOUNDARY DETECTION AND ACOUSTIC PREDICTORS*
- ```{r}
- acoustics_boundary <- acoustic_data_clean %>%
- filter(boundary == 1)
- signal_df_boundary <- signal_df %>%
- mutate(
- is_boundary = ground_truth == 1 &
- lag(ground_truth, default = 0) == 1 &
- lead(ground_truth, default = 0) == 1
- ) %>%
- filter(is_boundary)
- signal_with_acoustics <- signal_df_boundary %>%
- group_by(sub_ID, condition) %>%
- mutate(boundary_number = row_number()) %>%
- ungroup() %>%
- left_join(
- acoustics_boundary %>%
- group_by(melody) %>%
- mutate(boundary_number = row_number()) %>%
- ungroup(),
- by = c("condition" = "melody", "boundary_number")
- )
- signal_with_acoustics <- signal_with_acoustics %>%
- mutate(hit = ifelse(detection == "hit", 1, 0))
- # Calculate detection rate for each boundary across participants
- boundary_detection_rate <- signal_df_boundary %>%
- group_by(condition, number) %>%
- summarise(
- detection_rate = mean(detection == "hit"),
- n_participants = n(),
- .groups = "drop"
- ) %>%
- # Add boundary number within each melody
- group_by(condition) %>%
- mutate(boundary_number = row_number()) %>%
- ungroup()
- # Join with acoustic features
- boundary_analysis <- boundary_detection_rate %>%
- left_join(
- acoustics_boundary %>%
- group_by(melody) %>%
- mutate(boundary_number = row_number()) %>%
- ungroup(),
- by = c("condition" = "melody", "boundary_number")
- )
- # Fit linear model
- model <- lmer(detection_rate ~ previous_duration_z * freq_interval_z + (1 | condition),
- data = boundary_analysis)
- summary(model)
- tab_model(model)
- ```
analysis_behavioural.Rmd, no license · at the source
Overview
- Max‐Planck‐Institute for Empirical Aesthetics Frankfurt Germany
- Institute of Applied Psychology, Faculty of Management and Social Communication Jagiellonian University Kraków Poland
- Max‐Planck‐Institute for Human Cognitive and Brain Sciences Leipzig Germany
- Institute of Biology, Faculty of Life Sciences University of Leipzig Leipzig Germany
- Department of Psychology Chinese University of Hong Kong Shatin New Territories, Hong Kong SAR China
- Brain and Mind Institute The Chinese University of Hong Kong Shatin New Territories, Hong Kong SAR China
Abstract
When listening to music or speech, people naturally divide continuous sound streams into segments for easier and faster processing of information. The segmentation boundaries are not random. Listeners agree on the points of segmentation, which are consistent with arbitrary rules—for example, those established by music theory—and often occur at regular time intervals. It is thus unclear whether phrase tracking relies on understanding of musical structure or merely on temporal predictability. To address this, we examined how non‐musicians process both regular (temporally predictable) and irregular musical phrases derived from J.S. Bach's compositions. This approach preserved authentic musical structure while manipulating temporal predictability. We also included control stimuli matched in acoustic properties but lacking musical structure. Behavioral and EEG measures revealed that listeners could accurately detect phrase boundaries in both regular and irregular conditions. Neural activity, indexed by an increase in low‐frequency EEG power, reflected the tracking structural boundaries regardless of temporal regularity. These findings demonstrate that musical segmentation depends fundamentally on implicit understanding of musical structure, rather than on temporal predictability alone.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 11 matches between paragraphs and lines of code.
OSF btmxa
Availability: 1 check, the latest on 28 September 2026: the link answers (HTTP 200)
- 28 September 2026: the link answers (HTTP 200)
22 files
- acoustic_analysis/
acoustic_analysis.R , R, 200 lines - behavioural_analysis/
analysis_behavioural.Rmd , R, 641 lines, 4 matches - eeg_analysis/
1_read_data.m , MATLAB, 176 lines, 1 match - eeg_analysis/
2_MCCA.m , MATLAB, 272 lines, 1 match - eeg_analysis/
3_Cacoh.m , MATLAB, 160 lines, 1 match - eeg_analysis/
4_TRF_over_envelope.m , MATLAB, 334 lines - eeg_analysis/
5_TRF_power.m , MATLAB, 207 lines - eeg_analysis/
6_TRF_power_with_acousti , MATLAB, 481 lines, 1 matchc_predictors.m - eeg_analysis/
7_TRF_power_random_phras , MATLAB, 480 lines, 2 matchese_boundary.m - eeg_analysis/
analysis_eeg.Rmd , R, 1,151 lines - eeg_analysis/
extract length of music stimuli.m , MATLAB, 44 lines - eeg_analysis/
stimuli_envelope_trf.m , MATLAB, 102 lines, 1 match - experiment_implementatio
n/ , MATLAB, 25 lineseeg/ Generate random sequence.m - experiment_implementatio
n/ , MATLAB, 291 lineseeg/ phrase_tracking_1.m - experiment_implementatio
n/ , MATLAB, 291 lineseeg/ phrase_tracking_2.m - experiment_implementatio
n/ , MATLAB, 291 lineseeg/ phrase_tracking_3.m - experiment_implementatio
n/ , MATLAB, 291 lineseeg/ phrase_tracking_4.m - experiment_implementatio
n/ , MATLAB, 291 lineseeg/ phrase_tracking_5.m - experiment_implementatio
n/ , MATLAB, 291 lineseeg/ phrase_tracking_6.m - experiment_implementatio
n/ , MATLAB, 276 lineseeg/ phrase_tracking_EEGrecor ding_1.m - experiment_implementatio
n/ , MATLAB, 48 lineseeg/ run_script.m - README.txt, Text, 39 lines
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 21 scripts, each with its path and the digest of its content;
- 11 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Data Availability Statement
Behavioral data, as well as preprocessed EEG data, stimuli, and preprocessing and analysis scripts are available at https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 2, 28 September 2026
- Publisher: n/a → Wiley
Version 1, 28 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 3 authors, 5 keywords, 10 MeSH terms, 1 funder, 51 references.
Cite
This paper
Hołubowska, Z. A., Teng, X., & Larrouy‐Maestri, P. (2026). Neural and Behavioral Tracking of Musical Phrases Occurs Without Temporal Regularity. The European journal of neuroscience, 63(7), e70481. https://
BibTeX
@article{houbowska2026ne
author = {Hołubowska, Zofia Anna and Teng, Xiangbin and Larrouy‐Maestri, Pauline},
title = {{Neural and Behavioral Tracking of Musical Phrases Occurs Without Temporal Regularity}},
journal = {The European journal of neuroscience},
year = {2026},
month = apr,
volume = {63},
number = {7},
pages = {e70481},
publisher = {Wiley},
issn = {0953-816X},
doi = {10.1111/
url = {https://
pmid = {41968537},
pmcid = {PMC13071237}
}
RIS
TY - JOUR
AU - Hołubowska, Zofia Anna
AU - Teng, Xiangbin
AU - Larrouy‐Maestri, Pauline
TI - Neural and Behavioral Tracking of Musical Phrases Occurs Without Temporal Regularity
T2 - The European journal of neuroscience
J2 - Eur J Neurosci
PY - 2026
DA - 2026/
VL - 63
IS - 7
SP - e70481
SN - 0953-816X
PB - Wiley
DO - 10.1111/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1111/
"type": "article-journal",
"title": "Neural and Behavioral Tracking of Musical Phrases Occurs Without Temporal Regularity",
"container-title": "The European journal of neuroscience",
"author": [
{
"family": "Hołubowska",
"given": "Zofia Anna"
},
{
"family": "Teng",
"given": "Xiangbin"
},
{
"family": "Larrouy‐Maestri",
"given": "Pauline"
}
],
"container-title-short":
"volume": "63",
"issue": "7",
"page": "e70481",
"DOI": "10.1111/
"PMID": "41968537",
"PMCID": "PMC13071237",
"ISSN": "0953-816X",
"publisher": "Wiley",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
1
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1162/nol.a.249 [code]
- How Low-Frequency Neural Activity Structures Language in Time.Journal: Neurobiology of language (Cambridge, Mass.)In common: FieldTrip, lme4, ggpubr, 3 other tools, cognitive, 5 references
- [2] doi:10.1016/j.neuroimage.2026.122115 [code]
- Midfrontal theta power relates to response speeding following frustrative nonreward.Journal: NeuroImageIn common: psych, rstatix, lme4, 5 other tools, EEG, cognitive, 1 reference
- [3] doi:10.1038/s41593-026-02345-6 [code]
- Human hippocampal ripples tune cortical responses based on predicted uncertainty.Journal: Nature neuroscienceIn common: boundedline, FieldTrip, lme4, 4 other tools, cognitive, 2 references
- [4] doi:10.1371/journal.pbio.3003979 [code]
- Impaired midfrontal‑motor theta phase synchronization characterizes maladaptive motivational behavior in people with obsessive‑compulsive disorder.Journal: PLoS biologyIn common: boundedline, psych, FieldTrip, 3 other tools, EEG, 3 references
- [5] doi:10.1038/s41467-026-74565-0 [code]
- The functional neurobiology of dispositions towards negative emotions.Journal: Nature communicationsIn common: boundedline, psych, FieldTrip, 5 other tools, cognitive
- [6] doi:10.1016/j.isci.2026.116458 [code]
- Neural tracking of prosodic and statistical rhythms jointly supports artificial language learning.Journal: iScienceIn common: Psychtoolbox, FieldTrip, lme4, 2 other tools, cognitive, 4 references
- [7] doi:10.64898/2026.05.08.26348885 [code]
- Insights from nine nights of self-applied, low-density sleep EEG during sleep restriction therapy: a proof-of-concept evaluationJournal: medRxiv (preprint)In common: rstatix, FieldTrip, lme4, 5 other tools, EEG, 1 reference
- [8] doi:10.1162/imag.a.1245 [code]
- Towards precision EEG connectomics: Evaluating the benefits of dense sampling.Journal: Imaging neuroscience (Cambridge, Mass.)In common: psych, rstatix, FieldTrip, 5 other tools, EEG
- [9] doi:10.1016/j.nicl.2026.104012 [code]
- Structural-functional multilayer brain network properties and outcome of combined repetitive transcranial magnetic stimulation and psychotherapy for obsessive-compulsive disorder.Journal: NeuroImage. ClinicalIn common: psych, rstatix, lme4, 5 other tools
- [10] doi:10.1038/s41467-026-74331-2 [code]
- Trial-by-trial fMRI-neurofeedback dissociates fusiform and occipital contributions to face detection and recognition.Journal: Nature communicationsIn common: Psychtoolbox, rstatix, lme4, 4 other tools, 1 reference
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 21 scripts, and 11 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:d5286cb9d4190230…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[.
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
