pippi

computer music with python

  • 所有者: luvsound/pippi
  • 平台:
  • 許可證: Other
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Pippi: Computer Music With Python

v2.0.0 - Beta 4 (In Development)

Source code: https://github.com/luvsound/pippi

Documentation: https://pippi.world

Pippi: Computer music with python

What is this?

Pippi is a library of computer music modules for python.

It includes a few handy data structures for music like
SoundBuffer & Wavetable, which are operator-overloaded
to make working with sounds and control structures simpler.

It also includes a lot of useful methods for doing common and
not-so-common transformations to sounds and control structures.

from pippi import dsp

sound1 = dsp.read('sound1.wav')
sound2 = dsp.read('sound2.flac')

# Mix two sounds
both = sound1 & sound2

# Apply a skewed hann Wavetable as an envelope to a sound
enveloped = sound * dsp.win('hann').skewed(0.6)

# Or just a sine envelope via a shortcut method on the `SoundBuffer`
enveloped = sound.env('sine')

# Synthesize a 10 second graincloud from the sound, 
# with grain length modulating between 20ms and 2s 
# over a triangle shaped curve.
cloudy = enveloped.cloud(10, grainlength=dsp.win('tri', dsp.MS*20, 2))

It comes with several oscs:

  • Alias - a highly aliased pulse train osc
  • Bar - a bar physical model (from Soundpipe)
  • Drunk - does a drunk walk on the y axis over a fixed set of random points w/hermite interpolation for smooth waveshapes (kind of like dynamic stochastic synthesis in one dimension)
  • DSS - a basic implementation of dynamic stochastic synthesis that does a drunk walk in two dimensions over a random set of breakpoints
  • FM - a basic two operator FM synth w/harmonicity ratio & modulation index controls
  • Fold - an infinite folding wavetable osc
  • Osc - an everyday wavetable osc
  • Osc2d - a 2d morphing wavetable osc
  • Pluck - a plucked string physical model (adapted from JOS)
  • Pulsar - a pulsar synthesis engine
  • Pulsar2d - a 2d morphing pulsar synthesis engine (pairs well with a stack of wavetables extracted with the Waveset module)
  • SineOsc - a simple sinewave osc (doesn't use wavetables)
  • Tukey - a tukey-window-based osc with waveshape modulation between square-like and sine-like

And many built-in effects and transformations:

  • Easy independent control over pitch and speed for any SoundBuffer
  • Paulstretch
  • Several forms of waveshaping and distortion including a crossover distortion ported from supercollider
  • Sweapable highpass, lowpass, bandpass and band reject butterworth filters from Soundpipe
  • Lots more!

As well as support for pitch and harmony transformations and non-standard tuning systems

from pippi import tune

# Get a list of frequencies from a list of scale degrees
frequencies = tune.degrees([1,3,5,9], octave=3, root='a', scale=tune.MINOR, ratios=tune.JUST)

# Get a list of frequencies from a chord symbol using a tuning system devised by Terry Riley
frequencies = tune.chord('ii69', key='g#', octave=5, ratios=tune.TERRY)

# Convert MIDI note to frequency
freq = tune.mtof(60)

# Convert frequency to MIDI note
note = tune.ftom(440.0)

# Convert a pitch to a frequency
freq = tune.ntf('C#3')

And basic graphing functionality for any SoundBuffer or Wavetable -- some dumb examples pictured in the banner above.

from pippi import dsp

sound = dsp.read('sound.wav')

# Render an image of this sound's waveform
sound.graph('mysound.png')

# Render an image of a sinc wavetable with a label and scaled range
dsp.win('sinc').graph('sinc.png', label='A sinc wavetable', y=(-.25, 1))

As well as other neat stuff like soundfont rendering support via tinysf!

from pippi import dsp, soundfont

# Play a piano sound from a soundfont with general MIDI support (program change is zero-indexed)
tada = soundfont.play('my-cool-soundfont.sf2', length=30, freq=345.9, amp=0.5, voice=0)

# Save copy to your hard disk
tada.write('tada.wav')

Tutorials

There are annotated example scripts in the tutorials directory which introduce some of pippi's functionality.

Beyond arriving at a good-enough stable API for the 2.x series of releases (and fixing bugs), my goal during the
beta phase of development is to deal with the lack of documentation for this project.

Installation

Pippi requires python 3.6+ which can be found here:

https://www.python.org/downloads/

The 3.5.x branch of python might work too, but is untested.

raspbian buster users: you must install the libatlas-base-dev package with apt to build the latest version of numpy.

To install pippi:

  • Clone this repository locally: git clone https://github.com/luvsound/pippi.git
  • (Optional but recommended) Create a virtualenv somewhere where you want to work: cd /my/pippi/projects; python3 -m venv venv; source venv/bin/activate
  • (With your virtualenv active) Go back to the pippi source directory cd /path/to/pippi and run make install

The final command does a few things:

  • Installs python deps, so make sure you're inside a virtual environment if you want to be!
  • Sets up git submodules for external libs
  • Builds and installs Soundpipe
  • Builds and installs pippi & cython extensions

Please let me know if you run into problems!

From pypi

At the moment the best place to get pippi is using the method described above. Because of some packaging issues that need to be worked out, the version on pypi is quite a bit older and does not include most of the fun stuff.

To run tests

make test

In many cases, this will produce a soundfile in the tests/renders directory for the corresponding test. (Ear-driven regression testing...)
During the beta I like to keep failing tests in the main repo, so... most tests will be passing but if they all are passing, probably you are living in the future and are looking at the first stable release.

There are also shortcuts to run only certain groups of tests, like test-wavesets -- check out the Makefile for a list of them all.

Hacking

While hacking on pippi itself, running make build will recompile the cython extensions.

If you need to build sources from a clean slate (sometimes updates to pxd files require this) then run make clean build instead.

Thanks

Project Nayuki for a compact FFT! (Used in SoundBuffer.convolve())

Paul Batchelor for all the goodness in Soundpipe that has made its way into Pippi. (See the fx and bar modules.)

Bernhard Schelling for his TinySoundFont library used in the soundfont module.

Nando Florestan for his small public domain GM soundfont used in the test suite.

Pixeldroid for their OFL licensed console font used for labeling graphs.

@noisesmith@sonomu.club for introducing me to the modulation param on tukey windows

James McCartney for his implementation of hermite interpolation used in the Wavetable module and elsewhere.

Starling Labs for their zener diode softclip simulation and state variable filter implementation available in the fx module.

Jatin Chowdhury for their lovely sounding saturating feedback wavefolder.

主要指標

概覽
名稱與所有者luvsound/pippi
主編程語言Cython
編程語言Python (語言數: 6)
平台
許可證Other
所有者活动
創建於2012-09-25 13:50:35
推送於2024-03-19 23:41:43
最后一次提交
發布數11
最新版本名稱v2.0.0-b3 (發布於 2018-09-02 01:52:25)
第一版名稱v1.0.0 (發布於 2017-05-07 11:01:01)
用户参与
星數718
關注者數38
派生數36
提交數1.2k
已啟用問題?
問題數125
打開的問題數24
拉請求數7
打開的拉請求數0
關閉的拉請求數11
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?