An open API service indexing awesome lists of open source software.

https://github.com/danigb/pitch-fifths

Pitches and intervals expressed in fifths
https://github.com/danigb/pitch-fifths

Last synced: 11 months ago
JSON representation

Pitches and intervals expressed in fifths

Awesome Lists containing this project

README

          

# pitch-fifths

Pitches and intervals expressed in fifths and octaves:

```js
var fifths = require('pitch-fifths')
fifths([1, 0, 0]) // => [2, -1]
fifths.toPitch([2, -1]) // => [1, 0, 0]
```

This library converts from [a-pitch](https://github.com/danigb/a-pitch) arrays to a `[fifths, octaves]` array. This representation of pitches (or intervals) are useful to do [interval arithmetic](https://github.com/danigb/pitch-op).

This is a low level library. Probably you want to use [tonal](https://github.com/danigb/tonal)

## API









fifths(apitch) → {Array}





Get a pitch or interval measured in fifths and octaves


Every interval (or pitch) can be expressed by repeating ascending or descending
fifths and octaves. For exaple, interval major second is two fifths up and
one octave down:
fifths([1, 0, 0]) // => [2, -1]


This representation is useful for calculating interval distances, transpositions
or keys



Parameters:

Name
Type
Description

apitch

Array

the pitch or interval as a-pitch


Source:



Returns:


an array with the form [fifths, octaves] where both are integers





Type


Array


Example

var fifths = require('pitch-fifths')

fifths([0, 0, 0]) // => [0, 0]
fifths([0, 0, 1]) // => [0, 1]
fifths([1, 0, 0]) // => [2, -1]




toPitch(coord) → {Array}





Get the a-pitch structure from a
fifths array



Parameters:

Name
Type
Description

coord

Array

the fifths array


Source:



Returns:


the a-pitch structure





Type


Array


Example

var fifths = require('pitch-fifths')

fifths.toPitch([3, -1]) // => [6, 0, 1]


*generated with [docme](https://github.com/thlorenz/docme)*

## License

MIT License