Skip to content

Make some improvements to the pitch tracker widget#274

Merged
tlecomte merged 3 commits into
tlecomte:masterfrom
celeste-sinead:pitch_tracker_improvements
May 7, 2024
Merged

Make some improvements to the pitch tracker widget#274
tlecomte merged 3 commits into
tlecomte:masterfrom
celeste-sinead:pitch_tracker_improvements

Conversation

@celeste-sinead

Copy link
Copy Markdown
Contributor
  • adds a display of the current pitch and note to the right of the graph, which is nice for controlling pitch in real time. At this point Feature request: display note name (like how a tuner does) #234 seems quite fully satisfied.
  • shows minor grid lines in the frequency axis, instead of time, since that's usually what one wants more precision for in this graph
  • replaces minimum SNR with minimum amplitude, which is kinda crude and needs tweaking to each environment, but once tweaked generally does a good job of avoiding detecting pitches in background noise (including pitched background sounds).

Because the user is probably more interested in small differences in pitch
than small differences in time.
Using SNR (as formulated) didn't work great because, surprise, it turns out
that the dumb approximation of mean level for noise level is correlated with
signal power.

Amplitude is simple and works as desired in practice, although it probably
requires tuning to any given environment for best results -.-

@tlecomte tlecomte left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks @celeste-sinead, that looks really nice and works well.

I confirm that the dB/SNR mechanism to find out if the pitch is relevant is not perfect in my tests either.

I've added 2 comments regarding the design of the view/viewModel. Let me know if you'd like to address that in this MR or separately.

Comment thread friture/pitch_tracker.py

self.gridLayout.addWidget(self.quickWidget, 0, 0, 1, 1)

self.pitch_view_model = PitchViewModel(self)

@tlecomte tlecomte May 7, 2024

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

In practice, there is already a viewModel here, it's Scope_Data above. Could Scope_Data be used as a base for a new class that adds the pitch properties, like Spectrum_Data extends Scope_Data ?

Comment thread friture/pitch_tracker.py

self.pitch_view_model = PitchViewModel(self)
pitch_window = QQuickWindow()
pitch_component = QQmlComponent(engine, qml_url("PitchView.qml"), self)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Instead of having 2 views next to each other in the layout, could we have a new single view (that replaces Scope.qml) ?

My idea behind that is that at some point in the future, I would like to migrate the whole layout of Friture from QWidget to QML. So if each audio widget is a single QML component, that makes it easier.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah I had the same thought as I was putting together these pull requests. Pretty sure it would have saved a lot of hair pulling trying to get the widgets to size correctly if I'd thought of it to begin with 🙃. I think the other comment on the model probably dovetails nicely.

I think I'd rather do that all as a follow-up, rather than amending this PR.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Alright, let's do it in a follow-up PR then. I'm merging as is.

@tlecomte

tlecomte commented May 7, 2024

Copy link
Copy Markdown
Owner

Thanks again @celeste-sinead !

@tlecomte tlecomte merged commit 4fed2d5 into tlecomte:master May 7, 2024
@celeste-sinead celeste-sinead deleted the pitch_tracker_improvements branch May 7, 2024 20:39
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