Python: module boodle.music

boodle.music | index boodle/music.py

`music: Utility functions for musical computation.
get_pitch() -- the pitch factor that corresponds to a given number of semitones
decibel() -- the volume factor that corresponds to a given number of decibels`

Modules
`` |  |
math |  |  |

Functions
`` |  | decibel(val=0) `decibel(val=0) -> float Return the volume factor that corresponds to a given number of decibels. If val is zero, this returns 1. If val is negative, this returns a value less than 1 (but greater than zero); this value will reduce a sound by the given number of decibels. If val is positive, this returns a value greater than 1, which will amplify a sound. Example: Fading a sound by three decibels will approximately halve its amplitude; therefore, decibel(-3) is approximately 0.5.` get_pitch(semi) `get_pitch(semi) -> float Return the pitch factor that corresponds to a given number of semitones. The argument must be an integer. If val is zero, this returns 1. If val is negative, this returns a value less than 1 (but greater than zero); this value will lower a sound by the given number of semitones. If val is positive, this returns a value greater than 1, which will raise a sound. Example: Raising a sound by one octave (twelve semitones) will exactly double its pitch; therefore, get_pitch(12) is 2.0.`

Data
`` |  | chromatic_octave = [1.0, 1.0594630943592953, 1.122462048309373, 1.189207115002721, 1.2599210498948732, 1.3348398541700344, 1.4142135623730951, 1.4983070768766815, 1.5874010519681994, 1.681792830507429, 1.7817974362806785, 1.8877486253633868] decibel_factor = 0.23025850929940461 ix = 7 octaves = [1, 2, 4, 8, 16, 32, 64, 128] val = 128