Akkorde, Gitarrengriffe, Taktraster, Strumming-Schätzung und Song-Hilfswerkzeug
- Akkorderkennung aus der Begleitung, Akkordleiste und -karte - Gitarrengriffe (Dur/Moll) und Strumming-Anzeige - Taktraster ([grid]) mit Taktstrichen, Raster-Editor und songsynchronem Metronom - Tempo aus Akkordwechseln (genauer als aus Anschlägen) - UltraStar-Import mit automatischer Zeit- und Oktavprüfung - tools/fetch_song.py: Audio laden und in Gesang/Begleitung trennen Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
//! Piano-Roll-Ansicht: scrollende Tonhöhenkurve. Abbildung und Segmentierung sind rein und getestet.
|
||||
|
||||
use crate::chart::{ChordSpan, NoteChart, NoteKind};
|
||||
use crate::chart::{ChordSpan, Grid, NoteChart, NoteKind};
|
||||
use crate::config::UiConfig;
|
||||
use crate::pitch::{HistoryPoint, note_name};
|
||||
use crate::score::ChartScore;
|
||||
@ -297,6 +297,8 @@ pub struct ChartOverlay<'a> {
|
||||
/// Akkordleiste (leer = ausgeblendet) und ob mit Been geschrieben wird.
|
||||
pub chords: &'a [ChordSpan],
|
||||
pub chord_flats: bool,
|
||||
/// Taktraster für Taktstriche und Zählzeiten (None = ohne).
|
||||
pub grid: Option<Grid>,
|
||||
pub now_ms: f64,
|
||||
pub result: Option<&'a ChartScore>,
|
||||
}
|
||||
@ -384,6 +386,7 @@ pub fn draw(
|
||||
}
|
||||
|
||||
if let Some(o) = overlay {
|
||||
draw_grid_lines(&painter, vp, o);
|
||||
draw_chord_lane(&painter, vp, o);
|
||||
draw_notes(&painter, vp, o);
|
||||
for seg in o.original {
|
||||
@ -470,6 +473,39 @@ fn score_color(total: f32) -> Color32 {
|
||||
Color32::from_rgb((220.0 - 130.0 * t) as u8, (70.0 + 140.0 * t) as u8, 90)
|
||||
}
|
||||
|
||||
/// Taktstriche (kräftig, mit Taktnummer unten) und Zählzeiten (schwach) hinter den Noten.
|
||||
fn draw_grid_lines(painter: &egui::Painter, vp: &Viewport, o: &ChartOverlay<'_>) {
|
||||
let Some(g) = o.grid else { return };
|
||||
let (t_left, t_right) = (vp.t_now + vp.lead_s - vp.window_s, vp.t_now + vp.lead_s);
|
||||
for (ms, beat, bar) in g.beats_between(t_left * 1000.0, t_right * 1000.0) {
|
||||
let x = vp.x(ms / 1000.0);
|
||||
if x < vp.rect.left() || x > vp.rect.right() {
|
||||
continue;
|
||||
}
|
||||
let top = vp.rect.top();
|
||||
if beat == 0 {
|
||||
painter.line_segment(
|
||||
[pos2(x, top), pos2(x, vp.rect.bottom())],
|
||||
Stroke::new(1.6, Color32::from_white_alpha(70)),
|
||||
);
|
||||
if bar >= 1 {
|
||||
painter.text(
|
||||
pos2(x + 4.0, vp.rect.bottom() - 4.0),
|
||||
Align2::LEFT_BOTTOM,
|
||||
format!("{bar}"),
|
||||
FontId::proportional(12.0),
|
||||
Color32::from_white_alpha(130),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
painter.line_segment(
|
||||
[pos2(x, top), pos2(x, vp.rect.bottom())],
|
||||
Stroke::new(1.0, Color32::from_white_alpha(22)),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Akkordleiste am oberen Rand: ein Feld je Akkord, der gerade klingende ist hervorgehoben.
|
||||
fn draw_chord_lane(painter: &egui::Painter, vp: &Viewport, o: &ChartOverlay<'_>) {
|
||||
const H: f32 = 22.0;
|
||||
|
||||
Reference in New Issue
Block a user