Support note tunings
- Linguagem predominante
- Rust
- Estrelas
- 0
- Forks
- 0
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
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;
}
```
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Domínio
- backend-api-design
- Tipo de issue
- Funcionalidade
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Pouca atividade
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 65/100