https://github.com/math2001/piano
https://github.com/math2001/piano
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/math2001/piano
- Owner: math2001
- Created: 2019-12-07T00:25:42.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-07T09:36:47.000Z (over 6 years ago)
- Last Synced: 2025-08-04T17:55:41.525Z (11 months ago)
- Language: Go
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Piano
Something which will eventually be able to play some music of its own.
## Convention
In tests, always print the actual result and then the expected one. I just
couldn't chose, so I went with alphabetical order.
## Piece
When using a `Piece`, `.Render` it and paste it as a comment above the `Note`
field. It makes it much easier to understand what's going on. For example:
```go
p := &Piece{
// 440: *** <- the .Render
// 523: *
Notes: []Note{
Note{
Frequency: 440,
Duration: frac.N(3),
Start: frac.N(0),
},
Note{
Frequency: 523.25,
Duration: frac.N(1),
Start: frac.N(1),
},
},
}
```
**Make sure they stay updated**
(is there an easy thing to build which would automatically update those?)
## TODO
### Use `beep.Buffer` when generating waves
When I generate a wave, I just use a regular `[][2]float64` which takes up a
lot of room, as said in the wiki. I should probably use a `beep.Buffer` using a
`.wav` format
### Use a polynomial approximation instead of `math.Sin`
(Measure the performance gain before doing that)
Then, I could vary the precision and optimise it for the period of the wave