OSCR

Decoding selective auditory attention to musical elements in ecologically valid music listening.

Code ↔ Paper

The paper beside its authors' code: matches between them have not been computed for this paper yet.

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

Python · 186 lines · 7 KB · no license

  1. import argparse
  2. from torch.utils.data import DataLoader
  3. import pytorch_lightning as pl
  4. from pytorch_lightning.callbacks import EarlyStopping
  5. from pytorch_lightning import Trainer
  6. from pytorch_lightning.loggers import TensorBoardLogger
  7. from audiomentations import AddGaussianNoise, Gain
  8. from datasets import get_dataset
  9. from models import SampleCNN2DEEG
  10. from modules import EEGContrastiveLearning
  11. from utils import yaml_config_hook, get_logger, file_writer
  12. from preprocessing import eeg_data_processing, experiment_data_processing
  13. import pandas as pd
  14. import datetime
  15. import random
  16. from pathlib import Path
  17. import torch
  18. if __name__ == "__main__":
  19. parser = argparse.ArgumentParser(description="PredANN")
  20. config = yaml_config_hook("/codes_attention/config/config.yaml")
  21. for k, v in config.items():
  22. parser.add_argument(f"--{k}", default=v, type=type(v))
  23. parser.add_argument('--mode', type=str)
  24. parser.add_argument('--start_position', type=int)
  25. parser.add_argument('--evaluation_length', type=int)
  26. parser.add_argument('--attention_values', type=int, nargs='+')
  27. parser.add_argument('--subject_id', type=int, default=None)
  28. parser.add_argument('--song_id', type=int, default=None)
  29. parser.add_argument('--key', type=str)
  30. parser.add_argument('--test_window_size', type=int)
  31. parser.add_argument('--test_stride', type=int)
  32. args = parser.parse_args()
  33. pl.seed_everything(args.seed, workers=True)
  34. train_transform = {}
  35. if args.openmiir_augmentation == "gaussiannoise":
  36. train_transform = [
  37. AddGaussianNoise(min_amplitude=args.min_amplitude,
  38. max_amplitude=args.max_amplitude, p=0.5),
  39. ]
  40. print("augematation is gaussiannoise")
  41. elif args.openmiir_augmentation == "gain":
  42. train_transform = [
  43. Gain(min_gain_in_db=-12, max_gain_in_db=12, p=0.5)
  44. ]
  45. print("augematation is gain")
  46. elif args.openmiir_augmentation == "gaussiannoise+gain":
  47. train_transform = [
  48. AddGaussianNoise(min_amplitude=args.min_amplitude,
  49. max_amplitude=args.max_amplitude, p=0.5),
  50. Gain(min_gain_in_db=-12, max_gain_in_db=12, p=0.5)
  51. ]
  52. print("augematation is gaussiannoise+gain")
  53. else:
  54. print("no augmentation")
  55. train_log = pd.DataFrame(
  56. columns=["Loss/train", "Accuracy/train_eeg", "Accuracy/train_audio"])
  57. valid_log = pd.DataFrame(
  58. columns=["Loss/valid", "Accuracy/valid_eeg", "Accuracy/valid_audio"])
  59. train_dataset = get_dataset(
  60. args.dataset, args.dataset_dir, subset="train", download=False)
  61. train_dataset.set_sliding_window_parameters(args.window_size, args.stride)
  62. train_dataset.set_eeg_normalization(
  63. args.eeg_normalization, args.clamp_value)
  64. train_dataset.set_other_parameters( args.eeg_length, args.audio_clip_length, args.shifting_time, args.start_position)
  65. random.seed(42)
  66. train_random_numbers = [random.randint(
  67. 0, args.eeg_sample_rate * 30 - args.eeg_length - 1) for _ in range(1200)]
  68. train_dataset.set_random_numbers(train_random_numbers)
  69. if args.openmiir_augmentation != "no_augmentation":
  70. train_dataset.set_transform(train_transform)
  71. train_loader = DataLoader(
  72. train_dataset,
  73. batch_size=args.batch_size,
  74. num_workers=args.workers,
  75. drop_last=True,
  76. shuffle=True,
  77. )
  78. valid_dataset = get_dataset(
  79. args.dataset, args.dataset_dir, subset="valid", download=False)
  80. valid_dataset.set_sliding_window_parameters(args.window_size, args.stride)
  81. valid_dataset.set_eeg_normalization(
  82. args.eeg_normalization, args.clamp_value)
  83. valid_dataset.set_other_parameters( args.eeg_length, args.audio_clip_length, args.shifting_time, args.start_position)
  84. random.seed(42)
  85. valid_random_numbers = [random.randint(
  86. 0, args.window_size - args.eeg_length - 1) for _ in range(1200)]
  87. valid_dataset.set_random_numbers(valid_random_numbers)
  88. valid_loader = DataLoader(
  89. valid_dataset,
  90. batch_size=args.batch_size,
  91. num_workers=args.workers,
  92. drop_last=True,
  93. shuffle=False,
  94. )
  95. test_dataset = get_dataset(
  96. args.test_dataset, args.dataset_dir, subset="test", download=False)
  97. test_dataset.set_test_data_length(args.test_data_length)
  98. test_dataset.set_sliding_window_parameters(args.test_window_size, args.test_stride)
  99. test_dataset.set_eeg_normalization(
  100. args.eeg_normalization, args.clamp_value)
  101. test_dataset.set_other_parameters(
  102. args.eeg_length, args.audio_clip_length, args.shifting_time, args.start_position)
  103. random.seed(42)
  104. test_random_numbers = [random.randint(
  105. 0, args.window_size - args.eeg_length - 1) for _ in range(1200)]
  106. test_dataset.set_random_numbers(test_random_numbers)
  107. test_loader = DataLoader(
  108. test_dataset,
  109. batch_size=args.batch_size,
  110. num_workers=args.workers,
  111. drop_last=True,
  112. shuffle=False,
  113. )
  114. print(f"Size of train dataset: {len(train_dataset)}")
  115. print(f"Size of valid dataset: {len(valid_dataset)}")
  116. print(f"Size of test dataset: {len(test_dataset)}")
  117. if args.dataset == "preprocessing_eegmusic":
  118. encoder_eeg = SampleCNN2DEEG(
  119. out_dim=train_dataset.labels(),
  120. kernal_size=3,
  121. )
  122. encoder_vocal = SampleCNN2DEEG(
  123. out_dim=train_dataset.labels(),
  124. kernal_size=3,
  125. )
  126. encoder_drum = SampleCNN2DEEG(
  127. out_dim=train_dataset.labels(),
  128. kernal_size=3,
  129. )
  130. encoder_bass = SampleCNN2DEEG(
  131. out_dim=train_dataset.labels(),
  132. kernal_size=3,
  133. )
  134. encoder_others = SampleCNN2DEEG(
  135. out_dim=train_dataset.labels(),
  136. kernal_size=3,
  137. )
  138. print('EEG Contrastive learning')
  139. module = EEGContrastiveLearning(
  140. valid_dataset, args, encoder_eeg, encoder_vocal, encoder_drum, encoder_bass, encoder_others,key=args.key)
  141. logger = TensorBoardLogger(
  142. "runs/{}".format(args.training_date), name="nmed-CL-{}".format(args.dataset))
  143. early_stop_callback = EarlyStopping(
  144. monitor="Valid/loss", patience=10
  145. )
  146. trainer = Trainer.from_argparse_args(
  147. args,
  148. logger=logger,
  149. sync_batchnorm=True,
  150. max_epochs=args.max_epochs,
  151. deterministic=True,
  152. log_every_n_steps=1,
  153. check_val_every_n_epoch=1,
  154. accelerator=args.accelerator,
  155. resume_from_checkpoint='/checkpoint_path',
  156. accumulate_grad_batches=6
  157. )
  158. print('[[[ START ]]]', datetime.datetime.now())
  159. checkpoint_path = "/checkpoint_path"
  160. checkpoint = torch.load(checkpoint_path)
  161. module.load_state_dict(checkpoint['state_dict'])
  162. trainer.test(module,dataloaders=test_loader)
  163. print('[[[ FINISH ]]]', datetime.datetime.now())

checkpoint_test.py at commit e82ea29, no license · at the source

Overview

Authors: Taketo Akama1, Zhuohao Zhang1, Tsukasa Nagashima1, Yutaka Takagi1, Shun Minamikawa1, Natalia Polouliakh1
  1. Sony Computer Science Laboratories, Inc,Tokyo, Japan
Journal: Scientific reports, volume 16, issue 1, article 24486
Dates: received 9 January 2026; accepted 24 May 2026; published online 28 May 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s41598-026-55371-6 · PMID 42209637 · PMCID PMC13451197 · OpenAlex W4417143000
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: EEG (modality), human (organism), cognitive (subfield)
Methods: Smoothing, state filtering, decompositions, Connectivity, Machine learning
Keywords: Neuroscience, Psychology
MeSH: Attention*, Auditory Perception*, Music*, Acoustic Stimulation, Adult, Electroencephalography, Female, Humans, Male, Young Adult (* major topic)
Topic: Neuroscience and Music Perception (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Citations: not cited yet (Europe PMC); 53 references in the paper

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repository

Its files are read in the Code ↔ Paper reader above.

JURIUENO11/Music_attention

License: none: the authors keep all their rights
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: e82ea29e3ecb6d7d87ee6b41c2fbcc79c3d42892, 20 April 2026
Languages: Python (21), Shell (2)
Size: 97 files, 23 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README, environment (codes_attention/requirements.txt)
Not found: license file, CITATION.cff, tests, continuous integration, documentation
Tools: PyTorch (12 files), NumPy (8 files), pandas (7 files), PyTorch Lightning (3 files), MNE-Python (2 files), TensorFlow (2 files), scikit-learn (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
24 files

Code availability statement

The paper has a code availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1038/s41598-026-55371-6.

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;
  • 23 scripts, each with its path and the digest of its content;
  • no match between paragraphs and code yet;
  • 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

Datasets cited

Data availability statement

The paper has a data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1038/s41598-026-55371-6.

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 1, 28 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 6 authors, 2 keywords, 10 MeSH terms, 38 references.

Cite

This paper

Akama, T., Zhang, Z., Nagashima, T., Takagi, Y., Minamikawa, S., & Polouliakh, N. (2026). Decoding selective auditory attention to musical elements in ecologically valid music listening. Scientific reports, 16(1), 24486. https://doi.org/10.1038/s41598-026-55371-6

BibTeX

@article{akama2026decoding,
author = {Akama, Taketo and Zhang, Zhuohao and Nagashima, Tsukasa and Takagi, Yutaka and Minamikawa, Shun and Polouliakh, Natalia},
title = {{Decoding selective auditory attention to musical elements in ecologically valid music listening}},
journal = {Scientific reports},
year = {2026},
month = may,
volume = {16},
number = {1},
pages = {24486},
publisher = {Nature Publishing Group},
issn = {2045-2322},
doi = {10.1038/s41598-026-55371-6},
url = {https://doi.org/10.1038/s41598-026-55371-6},
pmid = {42209637},
pmcid = {PMC13451197}
}

RIS

TY - JOUR
AU - Akama, Taketo
AU - Zhang, Zhuohao
AU - Nagashima, Tsukasa
AU - Takagi, Yutaka
AU - Minamikawa, Shun
AU - Polouliakh, Natalia
TI - Decoding selective auditory attention to musical elements in ecologically valid music listening
T2 - Scientific reports
J2 - Sci Rep
PY - 2026
DA - 2026/05/28
VL - 16
IS - 1
SP - 24486
SN - 2045-2322
PB - Nature Publishing Group
DO - 10.1038/s41598-026-55371-6
UR - https://doi.org/10.1038/s41598-026-55371-6
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41598-026-55371-6",
"type": "article-journal",
"title": "Decoding selective auditory attention to musical elements in ecologically valid music listening",
"container-title": "Scientific reports",
"author": [
{
"family": "Akama",
"given": "Taketo"
},
{
"family": "Zhang",
"given": "Zhuohao"
},
{
"family": "Nagashima",
"given": "Tsukasa"
},
{
"family": "Takagi",
"given": "Yutaka"
},
{
"family": "Minamikawa",
"given": "Shun"
},
{
"family": "Polouliakh",
"given": "Natalia"
}
],
"container-title-short": "Sci Rep",
"volume": "16",
"issue": "1",
"page": "24486",
"DOI": "10.1038/s41598-026-55371-6",
"PMID": "42209637",
"PMCID": "PMC13451197",
"ISSN": "2045-2322",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41598-026-55371-6",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
28
]
]
}
}

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.1111/ejn.70538 [code]
Neural Tracking of Sustained Attention, Attention Switching, and Natural Conversation in Audiovisual Environments Using Wearable EEG.
Journal: The European journal of neuroscience
In common: MNE-Python, pandas, NumPy, EEG, cognitive, 4 references
[2] doi:10.1162/imag.a.1207 [code]
Investigating the temporal dynamics and modeling of mid-level feature representations in humans.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: PyTorch Lightning, MNE-Python, PyTorch, 3 other tools, EEG, cognitive
[3] doi:10.1038/s41598-026-56070-y [code]
SSDLabeler: realistic semi-synthetic data generation for multi-label artifact classification in EEG.
Journal: Scientific reports
In common: PyTorch Lightning, PyTorch, scikit-learn, 2 other tools, EEG, 1 reference
[4] doi:10.1038/s41467-026-75455-1 [code]
Shared latent representations of speech production for cross-patient speech decoding.
Journal: Nature communications
In common: PyTorch Lightning, TensorFlow, PyTorch, 3 other tools, cognitive
[5] doi:10.1038/s41562-026-02414-7 [code]
Optimized feature gains explain and predict successes and failures of human selective listening.
Journal: Nature human behaviour
In common: PyTorch Lightning, TensorFlow, PyTorch, 3 other tools, cognitive
[6] doi:10.1093/bioinformatics/btag169 [code]
Bidirectional Mamba-2 boosts EEG super-resolution via regression and diffusion.
Journal: Bioinformatics (Oxford, England)
In common: PyTorch Lightning, MNE-Python, PyTorch, 3 other tools, EEG
[7] doi:10.1523/eneuro.0023-26.2026 [code]
Real-Time Segmentation and Classification of Birdsong Syllables for Learning Experiments.
Journal: eNeuro
In common: PyTorch Lightning, TensorFlow, PyTorch, 3 other tools, cognitive
[8] doi:10.7554/elife.100056 [code]
Multi-talker speech comprehension at different temporal scales in listeners with normal and impaired hearing.
Journal: eLife
In common: MNE-Python, PyTorch, scikit-learn, 2 other tools, EEG, cognitive, 1 reference
[9] doi:10.3389/fpsyg.2026.1774068 [code]
Analysis of cognitive mechanisms in phoneme perception and pronunciation errors among Korean language learners.
Journal: Frontiers in psychology
In common: TensorFlow, MNE-Python, PyTorch, 3 other tools, EEG, cognitive
[10] doi:10.1038/s42003-026-10957-8 [code]
Brain defence by the extracellular matrix protein Cochlin.
Journal: Communications biology
In common: PyTorch Lightning, TensorFlow, PyTorch, 3 other tools

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.

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: 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.