AadamZ5 / AadamZ5/chords

Support note tunings

未關閉
#3 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Rust
星號
0
分支
0
PR 合併指標
30 天內沒有已合併 PR

描述

The `Note` object currently supports conversion to Hertz, but no conversion back. We have Hertz values hard-coded, meaning a different tuning isn't possible.

We should allow users to use a new `Tuning` object that specifies how to calculate the hertz value for the notes. We could implement this as a Trait, meaning it could be extended by library users.

ex:
```rust
pub trait Tuning {
fn to_hertz(&self, &Note) -> u32;
fn from_hertz(&self, u32) -> Option;
fn from_hertz_nearest(&self, u32) -> Note;
}
```

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

Look at the existing Note struct and its to_hertz method. The new Tuning trait should be defined in a module like src/tuning.rs. Implement a default equal-temperament tuning first. Check how Note is constructed and where hertz values are currently hardcoded to replace them with the trait. Write tests for conversion round-trips.

由索引模型根據 Issue 內容生成。

評估

領域
backend-api-design
Issue 類型
功能
難度
3/5
預估耗時
1-2 天
活躍度
冷清
描述清晰度
描述清楚
新手友好度
65/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。