Skip to content

Added TCN Carnatic beat tracking module#113

Merged
thomasgnuttall merged 17 commits intoMTG:masterfrom
vivekvjyn:vivek-beattrack
Feb 19, 2026
Merged

Added TCN Carnatic beat tracking module#113
thomasgnuttall merged 17 commits intoMTG:masterfrom
vivekvjyn:vivek-beattrack

Conversation

@vivekvjyn
Copy link
Contributor

  • Added a new module compiam.rhythm.meter.tcn_carnatic.TCNTracker
  • Models available in zenodo. There are 3 models the user can choose while calling TCNTracker.__int__() by passing model_version= 42, 52, 62. which are the seeds each model was trained on (as per the paper).
  • requires optional dependency madmom fork in my github temporarily
  • numpy downgrade to numpy==1.23.5, which works for all other modules.

Copy link
Collaborator

@thomasgnuttall thomasgnuttall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Vivek. I have tested the model and it looks good! I have requested a small change regarding hardcoded parameters. These should be abstracted out so as to be passed to the top level API. i.e. TCNTracker()

import numpy as np

fps= 100 # frames per second for the DBN processors
min_bpm= 55.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be parameters of the model, not hardcoded

def beat_tracker(beats_act):
beats_act = clip_probabilities(beats_act)
beat_dbn = DBNBeatTrackingProcessor(
min_bpm=min_bpm, max_bpm=max_bpm, fps=fps, transition_lambda=100, online=False)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other model parameters, not hardcoded.


class PreProcessor(SequentialProcessor):
def __init__(self, frame_size=2048, num_bands=12, log=np.log, add=1e-6, fps=100):
sig = SignalProcessor(num_channels=1, sample_rate=44100)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this hardcoded going to cause a problem for datasets not at 44100Hz?

from compiam.data import TESTDIR
from compiam.exceptions import ModelNotTrainedError


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great!

"essentia",
"full_ml",
"all",
"madmom @ git+https://github.com/vivekvjyn/madmom.git"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can allow this for now but perhaps should think about moving this to the MTG workspace

@vivekvjyn
Copy link
Contributor Author

  • Parameters are now inside the function - fps, max_bpm and min_bpm are optimal parameters for the model. so it is not necessary to pass it as an argument.
  • Fixed sample rate issue, now sr is a parameter of TCNTracker().predict(),

@thomasgnuttall
Copy link
Collaborator

  • Parameters are now inside the function - fps, max_bpm and min_bpm are optimal parameters for the model. so it is not necessary to pass it as an argument.
  • Fixed sample rate issue, now sr is a parameter of TCNTracker().predict(),

They are not parameters of the model, they are parameters for the madmom post-processing. A carnatic performance could feasibly be at a tempo higher than 230bpm and whilst the the results might be optimal for the range studied in the paper it would be good to give users the flexbility to decide for themselves if the model is valuable at higher bpms.

I would pass them as parameters to the process and set the defaults to those in the paper, which is generally a good development practice anyway. I think fps is not so important but min_bpm, max_bpm, and beats_per_bar should be optional parameters for the higher-level API.

Thanks for the sr change!

@thomasgnuttall
Copy link
Collaborator

Please go through the code and ensure that sample rate is not hardcoded (for example in pre.py)

Copy link
Collaborator

@thomasgnuttall thomasgnuttall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous comments

@vivekvjyn
Copy link
Contributor Author

there are no hard-coded parameters now, except for meter_change_prob=1e-3 and observation_weight=4 which are not really user level.

@thomasgnuttall thomasgnuttall merged commit 5d91c2e into MTG:master Feb 19, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants