Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

a python framework for programming music applications

Project description

cFlat

cFlat is a python framework exposing a simple api that enables programmers to create music-based applications. It focuses mainly on plucked-string, tempered instruments such as guitars, basses, ukuleles and such...


API

class Note():

Note instances are the lowest-level objects of the framework and have 3 main attributes:

  • (str) chr
  • (str) alt
  • (int) oct

Only the chr argument is required to create an instance. Arguments alt and oct will default to '' and 3 respectively.

>>> from cFlat import Note
>>> e = Note('e')
>>> e
E³

Note objects implement comparison operators based on their semitone intervals:

>>> f = Note('F')
>>> f 
F³
>>> f > e
True

Therefore, enharmonic relationships can be evaluated as follows:

>>> n1 = Note('F', '#', 5)
>>> n2 = Note('G', 'b', 5)
>>> n1, n2
(F♯⁵, G♭⁵)
>>> n1 != n2
False

Notes with double alterations are also supported:

>>> n3 = Note('A', 'bb', 1)
>>> n3
A𝄫¹
>>> n4 = Note('F', '##', 1)
>>> n4
F𝄪¹

Given that python lacks a === operator, Notes can be compared for a "stricter" equality using their is_a() method:

>>> n3 == n4
True
>>> n3.is_a(n4)
False

This method directly compares Note attributes instead of their semitone interval. Set the ignore_oct argument appropriately for a less strict comparison:

>>> n1
F♯⁵
>>> n1.is_a(Note('F', '#', 3))
False
>>> n1.is_a(Note('F', '#', 3), ignore_oct=False)
True

class DiatonicKey():

class ChromaticKey():

class String():

class StringInstrument():

Arguments

  • -h --help

  • -f --frets [int]

  • -v --verbose [int]

Project details


Release history Release notifications

This version

0.5

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for cFlat, version 0.5
Filename, size File type Python version Upload date Hashes
Filename, size cFlat-0.5-py3-none-any.whl (11.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size cFlat-0.5.tar.gz (9.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page