Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/reesporte/jc3000

a python package for making music
https://github.com/reesporte/jc3000

music python

Last synced: 3 days ago
JSON representation

a python package for making music

Awesome Lists containing this project

README

        

# jc3000
A small python package for generating music. Inspired by [this](https://walkerart.org/collections/artworks/wind-chime-after-dream) which was inspired by [this](https://en.wikipedia.org/wiki/John_Cage).

You can generate any notes you want based on any [fundamental](https://en.wikipedia.org/wiki/Fundamental_frequency) _(the frequency of concert A in this case, fundamental is used kind of loosely)_. You can also use either just or equal [temperament](https://en.wikipedia.org/wiki/Musical_temperament).

No guarantees things won't break in the future, I'm still tweaking things, but I think the general API should stay fairly consistent.

## Installation
You can install it via pip. It requires numpy. Probably not compatible with python <= 3.6.

```
python3 -m pip install jc3000
```

## Examples

* Play the licc
```
from jc3000 import Sequence

s = Sequence(fs=44100, fundamental=440, equal=True)
s.add_note('d', duration=.125)
s.add_note('e', .125)
s.add_note('f', .125)
s.add_note('g', .125)
s.add_note('e', .257) # .257 for ~swing-iness~
s.add_note('c', .125)
s.add_note('d', .25)

s.write_file('the_licc.wav')
```

* Play the C major scale with concert A set to 432 Hz.
```
from jc3000 import Sequence

s = Sequence(fundamental=432)

notes = ['cdefgabc']

for i, note in enumerate(notes):
if i < 5:
s.add_note(note)
else:
s.add_note(note, octave=1)

s.write_file('cmajor_432hz.wav')
```

## More
Default sample rate is [44,100 Hz](https://en.wikipedia.org/wiki/44,100_Hz#Origin).
Default concert A is [440 Hz](https://en.wikipedia.org/wiki/A440_(pitch_standard)).