Neural and Behavioral Tracking of Musical Phrases Occurs Without Temporal Regularity.
10 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.
The 11 matches
- [1] § Methods › Neural Tracking of Phrase Structure ↔ eeg_analysis/7_TRF_power_random_phrase_boundary.m, lines 1 to 67 · score 0.79 · ft_freqanalysis, FieldTrip, phrase tracking, 2.48, wavelet, phrase boundaries · block
oscr:b:PP8MRQQ1CG99A-O· Report a mismatch - [2] § Methods › Neural Tracking of Phrase Structure ↔ eeg_analysis/6_TRF_power_with_acoustic_predictors.m, lines 2 to 67 · score 0.79 · ft_freqanalysis, FieldTrip, 2.48, phrase tracking, wavelet, widths · block
oscr:b:TNDCXHXFWPTSW-V· Report a mismatch - [3] § Results › Phrase Boundary Detection Relies on Structural Cues Rather Than Local Acoustic Changes ↔ behavioural_analysis/analysis_behavioural.Rmd, lines 583 to 641 · score 0.73 · linear model, boundary detection, acoustic features, frequency interval, fitted, phrase boundaries · block
oscr:b:AG1RSYF857KPJ-6· Report a mismatch - [4] § Methods › Stimuli ↔ behavioural_analysis/analysis_behavioural.Rmd, lines 396 to 463 · score 0.69 · frequency interval, acoustic features, lme4, binomial, glmer, model · block
oscr:b:ETK6WFQ4BVJDQ-Y· Report a mismatch - [5] § Results › Listeners Are Able to Detect Phrase Boundaries ↔ behavioural_analysis/analysis_behavioural.Rmd, lines 177 to 198 · score 0.67 · Tukey HSD, post hoc, Krippendorff, agreement, adj, ANOVA · block
oscr:b:XKH06ARGVSTXT-W· Report a mismatch - [6] § Methods › EEG Data Preprocessing ↔ eeg_analysis/2_MCCA.m, lines 51 to 101 · score 0.64 · pass filter, FieldTrip, Epochs, preprocessed, MATLAB, ICA · block
oscr:b:7EWK5QP53M7VT-M· Report a mismatch - [7] § Methods › EEG Data Preprocessing ↔ eeg_analysis/1_read_data.m, lines 9 to 95 · score 0.63 · FieldTrip toolbox, preprocessed, MATLAB, filter, offset, 35 Hz · block
oscr:b:YKZQ122559XWJ-D· Report a mismatch - [8] § Results › Neural Tracking of Phrase Boundaries Is the Strongest for Regular Phrases ↔ eeg_analysis/7_TRF_power_random_phrase_boundary.m, lines 223 to 345 · score 0.60 · randomized boundary predictors, phrase boundary predictor, TRF models, band, positions, power · block
oscr:b:PYFYMN4ZJA3HR-W· Report a mismatch - [9] § Methods › Cerebral–Acoustic Coherence (Cacoh) ↔ eeg_analysis/3_Cacoh.m, lines 30 to 83 · score 0.60 · 0.1–20 Hz, Hanning, mscohere, coherence, Cacoh, 0.1 Hz · block
oscr:b:EXQTSGVH6WQWM-N· Report a mismatch - [10] § Methods › Analysis of Behavioral Data ↔ behavioural_analysis/analysis_behavioural.Rmd, lines 583 to 641 · score 0.57 · Detection rate, frequency interval, fitted, model, phrase boundary, acoustic · block
oscr:b:AG1RSYF857KPJ-6· Report a mismatch - [11] § Methods › Temporal Response Function (TRF) Over Acoustic Envelope ↔ eeg_analysis/stimuli_envelope_trf.m, lines 1 to 84 · score 0.52 · 4000 Hz, filterbank, gammatone, bands, envelope, TRF · block
oscr:b:FKX2PMR9YAT7Z-6· Report a mismatch
Paper
Loaded from Europe PMC by your browser; OSCR does not store it: 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.1038/s44271-023-00053-6 [code]
- Auditory-motor synchronization and perception suggest partially distinct time scales in speech and music.Journal: Communications psychologyIn common: Psychtoolbox, Signal Processing Toolbox, cognitive, 7 references
- [3] doi:10.1371/journal.pbio.3003456
- Eye blinks synchronize with musical beats during music listening.Journal: PLoS biologyIn common: EEG, cognitive, 5 references, author Xiangbin Teng
- [4] doi:10.7554/elife.99383 [code]
- Sequential temporal anticipation characterized by neural power modulation and in recurrent neural networks.Journal: eLifeIn common: boundedline, FieldTrip, Signal Processing Toolbox, 1 other tool, 1 reference, author Xiangbin Teng
- [5] doi:10.1093/cercor/bhac094 [code]
- Expectations boost the reconstruction of auditory features from electrophysiological responses to noisy speech.Journal: Cerebral cortex (New York, N.Y. : 1991)In common: FieldTrip, lme4, Signal Processing Toolbox, 1 other tool, EEG, cognitive, 5 references
- [6] doi:10.1371/journal.pone.0320519 [code]
- Anatomically distinct cortical tracking of music and speech by slow (1-8Hz) and fast (70-120Hz) oscillatory activity.Journal: PloS oneIn common: rstatix, FieldTrip, lme4, 3 other tools, cognitive, 3 references
- [7] doi:10.1038/s41598-022-18162-3 [code]
- Overt and implicit prosody contribute to neurophysiological responses previously attributed to grammatical processing.Journal: Scientific reportsIn common: psych, lme4, ggpubr, 2 other tools, EEG, cognitive, 3 references
- [8] 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
- [9] 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
- [10] doi:10.1038/s41598-025-86895-y [code]
- Beta oscillations predict the envelope sharpness in a rhythmic beat sequence.Journal: Scientific reportsIn common: boundedline, FieldTrip, Signal Processing Toolbox, 1 other tool, EEG, cognitive, 4 references
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:a116a6631e62b159…
Add the badge to the code's README
If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.
Markdown
<!-- oscr-badge:start -->
[](https://openscicode.org/badge/doi/10.1111/ejn.70481)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1111/ejn.70481.svg
:target: https://openscicode.org/badge/doi/10.1111/ejn.70481
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1111/ejn.70481"><img src="https://openscicode.org/badge/doi/10.1111/ejn.70481.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.
Report a mismatch between the code and the paper · Report a code error (signed in)
Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.
Report a reproduction failure (signed in)
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
