├── .github ├── dependabot.yml └── workflows │ └── build_manylinux_wheels.yml ├── .gitignore ├── .vscode ├── c_cpp_properties.json ├── launch.json ├── settings.json └── tasks.json ├── ChangeLog ├── LICENSE ├── MANIFEST.in ├── README.md ├── TODO.md ├── docs ├── .nojekyll ├── _images │ ├── E-PyoIcon.png │ └── structure.png ├── _modules │ ├── index.html │ ├── pyo.html │ └── pyo │ │ └── lib │ │ ├── _core.html │ │ ├── _maps.html │ │ ├── analysis.html │ │ ├── arithmetic.html │ │ ├── controls.html │ │ ├── dynamics.html │ │ ├── effects.html │ │ ├── events.html │ │ ├── expression.html │ │ ├── filters.html │ │ ├── fourier.html │ │ ├── generators.html │ │ ├── hrtf.html │ │ ├── listener.html │ │ ├── matrix.html │ │ ├── matrixprocess.html │ │ ├── midi.html │ │ ├── mmlmusic.html │ │ ├── opensndctrl.html │ │ ├── pan.html │ │ ├── pattern.html │ │ ├── phasevoc.html │ │ ├── players.html │ │ ├── randoms.html │ │ ├── server.html │ │ ├── tableprocess.html │ │ ├── tables.html │ │ ├── triggers.html │ │ ├── utils.html │ │ └── wxgui.html ├── _sources │ ├── about.rst.txt │ ├── api │ │ ├── alphabetical.rst.txt │ │ ├── classes │ │ │ ├── _core.rst.txt │ │ │ ├── analysis.rst.txt │ │ │ ├── arithmetic.rst.txt │ │ │ ├── controls.rst.txt │ │ │ ├── dynamics.rst.txt │ │ │ ├── effects.rst.txt │ │ │ ├── events.rst.txt │ │ │ ├── expression.rst.txt │ │ │ ├── filters.rst.txt │ │ │ ├── fourier.rst.txt │ │ │ ├── generators.rst.txt │ │ │ ├── index.rst.txt │ │ │ ├── internals.rst.txt │ │ │ ├── listener.rst.txt │ │ │ ├── map.rst.txt │ │ │ ├── matrices.rst.txt │ │ │ ├── matrixprocess.rst.txt │ │ │ ├── midi.rst.txt │ │ │ ├── mmlmusic.rst.txt │ │ │ ├── opensndctrl.rst.txt │ │ │ ├── pan.rst.txt │ │ │ ├── pattern.rst.txt │ │ │ ├── players.rst.txt │ │ │ ├── pvoc.rst.txt │ │ │ ├── randoms.rst.txt │ │ │ ├── server.rst.txt │ │ │ ├── tableprocess.rst.txt │ │ │ ├── tables.rst.txt │ │ │ ├── triggers.rst.txt │ │ │ ├── utils.rst.txt │ │ │ └── wxgui.rst.txt │ │ ├── constants.rst.txt │ │ ├── functions │ │ │ ├── audio.rst.txt │ │ │ ├── conv.rst.txt │ │ │ ├── index.rst.txt │ │ │ ├── midi.rst.txt │ │ │ ├── sampling.rst.txt │ │ │ ├── server.rst.txt │ │ │ ├── sndfile.rst.txt │ │ │ └── util.rst.txt │ │ └── index.rst.txt │ ├── compiling.rst.txt │ ├── download.rst.txt │ ├── examples │ │ ├── index.rst.txt │ │ ├── x01-intro │ │ │ ├── 01-audio-server.rst.txt │ │ │ ├── 02-sine-tone.rst.txt │ │ │ ├── 03-parallel-proc.rst.txt │ │ │ ├── 04-serial-proc.rst.txt │ │ │ ├── 05-output-channels.rst.txt │ │ │ └── index.rst.txt │ │ ├── x02-controls │ │ │ ├── 01-fixed-control.rst.txt │ │ │ ├── 02-dynamic-control.rst.txt │ │ │ ├── 03-output-range.rst.txt │ │ │ ├── 04-building-lfo.rst.txt │ │ │ ├── 05-math-ops.rst.txt │ │ │ ├── 06-multichannel-expansion.rst.txt │ │ │ ├── 07-multichannel-expansion-2.rst.txt │ │ │ ├── 08-handling-channels.rst.txt │ │ │ ├── 09-handling-channels-2.rst.txt │ │ │ ├── 10-handling-channels-3.rst.txt │ │ │ ├── 11-handling-channels-4.rst.txt │ │ │ └── index.rst.txt │ │ ├── x03-generators │ │ │ ├── 01-complex-oscs.rst.txt │ │ │ ├── 02-band-limited-oscs.rst.txt │ │ │ ├── 03-fm-generators.rst.txt │ │ │ ├── 04-noise-generators.rst.txt │ │ │ ├── 05-strange-attractors.rst.txt │ │ │ ├── 06-random-generators.rst.txt │ │ │ └── index.rst.txt │ │ ├── x04-soundfiles │ │ │ ├── 01-read-from-disk.rst.txt │ │ │ ├── 02-read-from-disk-2.rst.txt │ │ │ ├── 03-read-from-ram.rst.txt │ │ │ ├── 04-record-perf.rst.txt │ │ │ ├── 05-record-streams.rst.txt │ │ │ ├── 06-record-table.rst.txt │ │ │ └── index.rst.txt │ │ ├── x05-envelopes │ │ │ ├── 01-data-signal-conversion.rst.txt │ │ │ ├── 02-linear-ramp.rst.txt │ │ │ ├── 03-exponential-ramp.rst.txt │ │ │ ├── 04-simple-envelopes.rst.txt │ │ │ ├── 05-breakpoints-functions.rst.txt │ │ │ └── index.rst.txt │ │ ├── x06-filters │ │ │ ├── 01-lowpass-filters.rst.txt │ │ │ ├── 02-bandpass-filters.rst.txt │ │ │ ├── 03-complex-resonator.rst.txt │ │ │ ├── 04-phasing.rst.txt │ │ │ ├── 05-convolution-filters.rst.txt │ │ │ ├── 06-vocoder.rst.txt │ │ │ ├── 07-hilbert-transform.rst.txt │ │ │ └── index.rst.txt │ │ ├── x07-effects │ │ │ ├── 01-flanger.rst.txt │ │ │ ├── 02-schroeder-reverb.rst.txt │ │ │ ├── 03-fuzz-disto.rst.txt │ │ │ ├── 04-ping-pong-delay.rst.txt │ │ │ ├── 05-hand-made-chorus.rst.txt │ │ │ ├── 06-hand-made-harmonizer.rst.txt │ │ │ └── index.rst.txt │ │ ├── x08-dynamics │ │ │ ├── 01-dynamic-range.rst.txt │ │ │ ├── 02-ducking.rst.txt │ │ │ ├── 03-gated-verb.rst.txt │ │ │ ├── 04-rms-tracing.rst.txt │ │ │ └── index.rst.txt │ │ ├── x09-callbacks │ │ │ ├── 01-periodic-calls.rst.txt │ │ │ ├── 02-score-calls.rst.txt │ │ │ ├── 03-delayed-calls.rst.txt │ │ │ └── index.rst.txt │ │ ├── x10-tables │ │ │ ├── 01-envelopes.rst.txt │ │ │ ├── 02-scrubbing.rst.txt │ │ │ ├── 03-looping.rst.txt │ │ │ ├── 04-granulation.rst.txt │ │ │ ├── 05-micro-montage.rst.txt │ │ │ ├── 06-table-stutter.rst.txt │ │ │ ├── 07-moving-points.rst.txt │ │ │ ├── 08-table-lookup.rst.txt │ │ │ ├── 09-partial-table.rst.txt │ │ │ └── index.rst.txt │ │ ├── x14-spectral │ │ │ ├── 01-fft-filter.rst.txt │ │ │ ├── 02-fft-cross-synth.rst.txt │ │ │ ├── 03-fft-morphing.rst.txt │ │ │ ├── 04-fft-spectral-delay.rst.txt │ │ │ ├── 05-fft-time-stretch.rst.txt │ │ │ └── index.rst.txt │ │ ├── x15-matrix │ │ │ ├── 01-wave-terrain-synthesis.rst.txt │ │ │ ├── 02-matrix-record.rst.txt │ │ │ ├── 03-record-loop-chunks.rst.txt │ │ │ ├── 04-algo-with-matrix.rst.txt │ │ │ └── index.rst.txt │ │ ├── x16-midi │ │ │ ├── 01-midi-scan.rst.txt │ │ │ ├── 02-notein-object.rst.txt │ │ │ ├── 03-midi-envelope.rst.txt │ │ │ ├── 04-simple-midi-synth.rst.txt │ │ │ ├── 05-control-change.rst.txt │ │ │ ├── 06-midi-out.rst.txt │ │ │ ├── 07-midifile-with-mido.rst.txt │ │ │ └── index.rst.txt │ │ ├── x17-osc │ │ │ ├── 01-osc-scan.rst.txt │ │ │ ├── 02-receive-streams.rst.txt │ │ │ ├── 03-send-streams.rst.txt │ │ │ ├── 04-receive-list.rst.txt │ │ │ ├── 05-send-receive-data.rst.txt │ │ │ └── index.rst.txt │ │ ├── x19-multirate │ │ │ ├── 01-multi-rate-processing.rst.txt │ │ │ ├── 02-multi-rate-synthesis.rst.txt │ │ │ └── index.rst.txt │ │ ├── x20-multicore │ │ │ ├── 01-processes-spawning.rst.txt │ │ │ ├── 02-sharing-audio.rst.txt │ │ │ ├── 03-synchronization.rst.txt │ │ │ ├── 04-data-control.rst.txt │ │ │ └── index.rst.txt │ │ ├── x21-utilities │ │ │ ├── 01-list-to-audio-file.rst.txt │ │ │ ├── 02-get-method.rst.txt │ │ │ ├── 03-set-method.rst.txt │ │ │ ├── 04-buffer-interface.rst.txt │ │ │ ├── 05-batch-processing.rst.txt │ │ │ ├── 06-batch-synthesis.rst.txt │ │ │ ├── 07-upsamp-processing.rst.txt │ │ │ ├── 08-multiple-threads.rst.txt │ │ │ ├── 09-audio-mixer.rst.txt │ │ │ └── index.rst.txt │ │ ├── x22-events │ │ │ ├── 01-simple-sequences.rst.txt │ │ │ ├── 02-parameters.rst.txt │ │ │ ├── 03-instruments.rst.txt │ │ │ ├── 04-custom-params.rst.txt │ │ │ ├── 05-complex-sequences.rst.txt │ │ │ ├── 06-randoms.rst.txt │ │ │ ├── 07-managing-scales.rst.txt │ │ │ ├── 08-function-calls.rst.txt │ │ │ ├── 09-embedding-generators.rst.txt │ │ │ ├── 10-arithmetic-ops.rst.txt │ │ │ ├── 11-filters.rst.txt │ │ │ ├── 12-sharing-values.rst.txt │ │ │ ├── 13-using-audio-objects.rst.txt │ │ │ ├── 14-post-processing.rst.txt │ │ │ └── index.rst.txt │ │ └── x23-expression │ │ │ ├── 01-simple-expression.rst.txt │ │ │ ├── 02-audio-in.rst.txt │ │ │ ├── 03-multiple-inputs.rst.txt │ │ │ ├── 04-let-function.rst.txt │ │ │ ├── 05-define-function.rst.txt │ │ │ ├── 06-var-function.rst.txt │ │ │ ├── 07-condition.rst.txt │ │ │ ├── 08-load-function.rst.txt │ │ │ ├── 09-multiple-outputs.rst.txt │ │ │ └── index.rst.txt │ ├── gettingstarted.rst.txt │ ├── index.rst.txt │ ├── perftips.rst.txt │ ├── structure.rst.txt │ ├── tutorials │ │ ├── index.rst.txt │ │ ├── pyoobject1.rst.txt │ │ ├── pyoobject2.rst.txt │ │ └── pyotableobject1.rst.txt │ └── winaudioinspect.rst.txt ├── _static │ ├── E-PyoIcon.ico │ ├── E-PyoIcon.png │ ├── agogo.css │ ├── autoclasstoc.css │ ├── basic.css │ ├── bgfooter.png │ ├── bgtop.png │ ├── doctools.js │ ├── documentation_options.js │ ├── file.png │ ├── language_data.js │ ├── minus.png │ ├── nature.css │ ├── plus.png │ ├── pygments.css │ ├── searchtools.js │ ├── sphinx-codeautolink.css │ ├── sphinx_highlight.js │ └── structure.png ├── about.html ├── api │ ├── alphabetical.html │ ├── classes │ │ ├── _core.html │ │ ├── analysis.html │ │ ├── arithmetic.html │ │ ├── controls.html │ │ ├── dynamics.html │ │ ├── effects.html │ │ ├── events.html │ │ ├── expression.html │ │ ├── filters.html │ │ ├── fourier.html │ │ ├── generators.html │ │ ├── index.html │ │ ├── internals.html │ │ ├── listener.html │ │ ├── map.html │ │ ├── matrices.html │ │ ├── matrixprocess.html │ │ ├── midi.html │ │ ├── mmlmusic.html │ │ ├── opensndctrl.html │ │ ├── pan.html │ │ ├── pattern.html │ │ ├── players.html │ │ ├── pvoc.html │ │ ├── randoms.html │ │ ├── server.html │ │ ├── tableprocess.html │ │ ├── tables.html │ │ ├── triggers.html │ │ ├── utils.html │ │ └── wxgui.html │ ├── constants.html │ ├── functions │ │ ├── audio.html │ │ ├── conv.html │ │ ├── index.html │ │ ├── midi.html │ │ ├── sampling.html │ │ ├── server.html │ │ ├── sndfile.html │ │ └── util.html │ └── index.html ├── compiling.html ├── download.html ├── examples │ ├── index.html │ ├── x01-intro │ │ ├── 01-audio-server.html │ │ ├── 02-sine-tone.html │ │ ├── 03-parallel-proc.html │ │ ├── 04-serial-proc.html │ │ ├── 05-output-channels.html │ │ └── index.html │ ├── x02-controls │ │ ├── 01-fixed-control.html │ │ ├── 02-dynamic-control.html │ │ ├── 03-output-range.html │ │ ├── 04-building-lfo.html │ │ ├── 05-math-ops.html │ │ ├── 06-multichannel-expansion.html │ │ ├── 07-multichannel-expansion-2.html │ │ ├── 08-handling-channels.html │ │ ├── 09-handling-channels-2.html │ │ ├── 10-handling-channels-3.html │ │ ├── 11-handling-channels-4.html │ │ └── index.html │ ├── x03-generators │ │ ├── 01-complex-oscs.html │ │ ├── 02-band-limited-oscs.html │ │ ├── 03-fm-generators.html │ │ ├── 04-noise-generators.html │ │ ├── 05-strange-attractors.html │ │ ├── 06-random-generators.html │ │ └── index.html │ ├── x04-soundfiles │ │ ├── 01-read-from-disk.html │ │ ├── 02-read-from-disk-2.html │ │ ├── 03-read-from-ram.html │ │ ├── 04-record-perf.html │ │ ├── 05-record-streams.html │ │ ├── 06-record-table.html │ │ └── index.html │ ├── x05-envelopes │ │ ├── 01-data-signal-conversion.html │ │ ├── 02-linear-ramp.html │ │ ├── 03-exponential-ramp.html │ │ ├── 04-simple-envelopes.html │ │ ├── 05-breakpoints-functions.html │ │ └── index.html │ ├── x06-filters │ │ ├── 01-lowpass-filters.html │ │ ├── 02-bandpass-filters.html │ │ ├── 03-complex-resonator.html │ │ ├── 04-phasing.html │ │ ├── 05-convolution-filters.html │ │ ├── 06-vocoder.html │ │ ├── 07-hilbert-transform.html │ │ └── index.html │ ├── x07-effects │ │ ├── 01-flanger.html │ │ ├── 02-schroeder-reverb.html │ │ ├── 03-fuzz-disto.html │ │ ├── 04-ping-pong-delay.html │ │ ├── 05-hand-made-chorus.html │ │ ├── 06-hand-made-harmonizer.html │ │ └── index.html │ ├── x08-dynamics │ │ ├── 01-dynamic-range.html │ │ ├── 02-ducking.html │ │ ├── 03-gated-verb.html │ │ ├── 04-rms-tracing.html │ │ └── index.html │ ├── x09-callbacks │ │ ├── 01-periodic-calls.html │ │ ├── 02-score-calls.html │ │ ├── 03-delayed-calls.html │ │ └── index.html │ ├── x10-tables │ │ ├── 01-envelopes.html │ │ ├── 02-scrubbing.html │ │ ├── 03-looping.html │ │ ├── 04-granulation.html │ │ ├── 05-micro-montage.html │ │ ├── 06-table-stutter.html │ │ ├── 07-moving-points.html │ │ ├── 08-table-lookup.html │ │ ├── 09-partial-table.html │ │ └── index.html │ ├── x14-spectral │ │ ├── 01-fft-filter.html │ │ ├── 02-fft-cross-synth.html │ │ ├── 03-fft-morphing.html │ │ ├── 04-fft-spectral-delay.html │ │ ├── 05-fft-time-stretch.html │ │ └── index.html │ ├── x15-matrix │ │ ├── 01-wave-terrain-synthesis.html │ │ ├── 02-matrix-record.html │ │ ├── 03-record-loop-chunks.html │ │ ├── 04-algo-with-matrix.html │ │ └── index.html │ ├── x16-midi │ │ ├── 01-midi-scan.html │ │ ├── 02-notein-object.html │ │ ├── 03-midi-envelope.html │ │ ├── 04-simple-midi-synth.html │ │ ├── 05-control-change.html │ │ ├── 06-midi-out.html │ │ ├── 07-midifile-with-mido.html │ │ └── index.html │ ├── x17-osc │ │ ├── 01-osc-scan.html │ │ ├── 02-receive-streams.html │ │ ├── 03-send-streams.html │ │ ├── 04-receive-list.html │ │ ├── 05-send-receive-data.html │ │ └── index.html │ ├── x19-multirate │ │ ├── 01-multi-rate-processing.html │ │ ├── 02-multi-rate-synthesis.html │ │ └── index.html │ ├── x20-multicore │ │ ├── 01-processes-spawning.html │ │ ├── 02-sharing-audio.html │ │ ├── 03-synchronization.html │ │ ├── 04-data-control.html │ │ └── index.html │ ├── x21-utilities │ │ ├── 01-list-to-audio-file.html │ │ ├── 02-get-method.html │ │ ├── 03-set-method.html │ │ ├── 04-buffer-interface.html │ │ ├── 05-batch-processing.html │ │ ├── 06-batch-synthesis.html │ │ ├── 07-upsamp-processing.html │ │ ├── 08-multiple-threads.html │ │ ├── 09-audio-mixer.html │ │ └── index.html │ ├── x22-events │ │ ├── 01-simple-sequences.html │ │ ├── 02-parameters.html │ │ ├── 03-instruments.html │ │ ├── 04-custom-params.html │ │ ├── 05-complex-sequences.html │ │ ├── 06-randoms.html │ │ ├── 07-managing-scales.html │ │ ├── 08-function-calls.html │ │ ├── 09-embedding-generators.html │ │ ├── 10-arithmetic-ops.html │ │ ├── 11-filters.html │ │ ├── 12-sharing-values.html │ │ ├── 13-using-audio-objects.html │ │ ├── 14-post-processing.html │ │ └── index.html │ └── x23-expression │ │ ├── 01-simple-expression.html │ │ ├── 02-audio-in.html │ │ ├── 03-multiple-inputs.html │ │ ├── 04-let-function.html │ │ ├── 05-define-function.html │ │ ├── 06-var-function.html │ │ ├── 07-condition.html │ │ ├── 08-load-function.html │ │ ├── 09-multiple-outputs.html │ │ └── index.html ├── genindex.html ├── gettingstarted.html ├── index.html ├── objects.inv ├── perftips.html ├── search.html ├── searchindex.js ├── structure.html ├── tutorials │ ├── index.html │ ├── pyoobject1.html │ ├── pyoobject2.html │ └── pyotableobject1.html └── winaudioinspect.html ├── documentation ├── build.py └── source │ ├── _static │ ├── E-PyoIcon.ico │ ├── E-PyoIcon.png │ ├── nature.css │ └── structure.png │ ├── about.rst │ ├── api │ ├── alphabetical.rst │ ├── classes │ │ ├── _core.rst │ │ ├── analysis.rst │ │ ├── arithmetic.rst │ │ ├── controls.rst │ │ ├── dynamics.rst │ │ ├── effects.rst │ │ ├── events.rst │ │ ├── expression.rst │ │ ├── filters.rst │ │ ├── fourier.rst │ │ ├── generators.rst │ │ ├── index.rst │ │ ├── internals.rst │ │ ├── listener.rst │ │ ├── map.rst │ │ ├── matrices.rst │ │ ├── matrixprocess.rst │ │ ├── midi.rst │ │ ├── mmlmusic.rst │ │ ├── opensndctrl.rst │ │ ├── pan.rst │ │ ├── pattern.rst │ │ ├── players.rst │ │ ├── pvoc.rst │ │ ├── randoms.rst │ │ ├── server.rst │ │ ├── tableprocess.rst │ │ ├── tables.rst │ │ ├── triggers.rst │ │ ├── utils.rst │ │ └── wxgui.rst │ ├── constants.rst │ ├── functions │ │ ├── audio.rst │ │ ├── conv.rst │ │ ├── index.rst │ │ ├── midi.rst │ │ ├── sampling.rst │ │ ├── server.rst │ │ ├── sndfile.rst │ │ └── util.rst │ └── index.rst │ ├── compiling.rst │ ├── conf.py │ ├── download.rst │ ├── gettingstarted.rst │ ├── index.rst │ ├── perftips.rst │ ├── structure.rst │ ├── tutorials │ ├── index.rst │ ├── pyoobject1.rst │ ├── pyoobject2.rst │ └── pyotableobject1.rst │ └── winaudioinspect.rst ├── embedded ├── bela │ └── README.md ├── juceplugin │ ├── PyoClass.cpp │ ├── PyoClass.h │ ├── README.md │ └── test.py ├── m_pyo.h ├── openframeworks │ ├── PyoClass.cpp │ ├── PyoClass.h │ └── README └── puredata │ ├── Makefile │ ├── examples │ ├── cvlverb.py │ ├── midi_synth.py │ ├── random_waves.py │ ├── resonators.py │ └── resonators_add_delays.py │ ├── pyo~-help.pd │ ├── pyo~-meta.pd │ └── pyo~.c ├── externals ├── README ├── external-template.py ├── externalmodule-template.c └── externalmodule-template.h ├── include ├── ad_coreaudio.h ├── ad_jack.h ├── ad_portaudio.h ├── dummymodule.h ├── fft.h ├── interpolation.h ├── matrixmodule.h ├── md_portmidi.h ├── pvstreammodule.h ├── pyomodule.h ├── servermodule.h ├── streammodule.h ├── tablemodule.h ├── vbap.h └── wind.h ├── manylinux-pre-build-script.sh ├── pyo ├── __init__.py ├── _linux_wheel_fix_symlinks.py ├── editor │ ├── EPyo.py │ ├── Tutorial_01_RingMod.py │ ├── Tutorial_02_Flanger.py │ ├── Tutorial_03_TriTable.py │ ├── __init__.py │ ├── snippets │ │ ├── Audio │ │ │ ├── SoundPlayer │ │ │ ├── TableOsc │ │ │ └── __init__.py │ │ ├── Control │ │ │ ├── ChorusJit │ │ │ ├── Vibrato │ │ │ └── __init__.py │ │ ├── Interface │ │ │ ├── NewFrame │ │ │ ├── PaintPanel │ │ │ └── __init__.py │ │ ├── Utilities │ │ │ ├── ChooseAudioDev │ │ │ ├── Incrementor │ │ │ └── __init__.py │ │ └── __init__.py │ └── styles │ │ ├── Custom │ │ ├── Default │ │ ├── Espresso │ │ ├── Monokai-Soda │ │ ├── Smooth │ │ ├── Soft │ │ ├── Solarized (dark) │ │ ├── Solarized (light) │ │ └── __init__.py ├── examples │ ├── __init__.py │ ├── algorithmic │ │ ├── 01_music_box.py │ │ ├── 02_scale_snap.py │ │ ├── 03_melody_algo.py │ │ ├── 04_drum_machine.py │ │ └── __init__.py │ ├── sampling │ │ ├── 01_sound_cloud.py │ │ ├── 02_live_looper.py │ │ ├── 03_rec_and_loop.py │ │ ├── 04_live_convolution.py │ │ └── __init__.py │ ├── sequencing │ │ ├── 01_starttime_duration.py │ │ ├── 02_random_score.py │ │ ├── 03_function_call.py │ │ └── __init__.py │ ├── snds │ │ ├── __init__.py │ │ ├── alum1.wav │ │ ├── alum2.wav │ │ ├── alum3.wav │ │ ├── alum4.wav │ │ ├── baseballmajeur_m.aif │ │ ├── drumloop.wav │ │ ├── flute.aif │ │ ├── mapleleafrag.mid │ │ ├── ounkmaster.aif │ │ ├── snd_1.aif │ │ ├── snd_2.aif │ │ ├── snd_3.aif │ │ ├── snd_4.aif │ │ ├── snd_5.aif │ │ └── snd_6.aif │ ├── synthesis │ │ ├── 01_pulsar_synthesis.py │ │ ├── 02_FM3.py │ │ ├── 03_cos_waveshaping.py │ │ ├── 04_degrade_synthesis.py │ │ ├── 04_granule.py │ │ ├── 05_ring_mod_class.py │ │ ├── 06_lfo_controls.py │ │ ├── 06_paf.py │ │ ├── 07_split_sideband_synthesis.py │ │ ├── 08_bucket_brigade_device.py │ │ └── __init__.py │ ├── wxgui │ │ ├── 01_gui_widgets_example.py │ │ └── __init__.py │ ├── x01-intro │ │ ├── 01-audio-server.py │ │ ├── 02-sine-tone.py │ │ ├── 03-parallel-proc.py │ │ ├── 04-serial-proc.py │ │ ├── 05-output-channels.py │ │ └── __init__.py │ ├── x02-controls │ │ ├── 01-fixed-control.py │ │ ├── 02-dynamic-control.py │ │ ├── 03-output-range.py │ │ ├── 04-building-lfo.py │ │ ├── 05-math-ops.py │ │ ├── 06-multichannel-expansion.py │ │ ├── 07-multichannel-expansion-2.py │ │ ├── 08-handling-channels.py │ │ ├── 09-handling-channels-2.py │ │ ├── 10-handling-channels-3.py │ │ ├── 11-handling-channels-4.py │ │ └── __init__.py │ ├── x03-generators │ │ ├── 01-complex-oscs.py │ │ ├── 02-band-limited-oscs.py │ │ ├── 03-fm-generators.py │ │ ├── 04-noise-generators.py │ │ ├── 05-strange-attractors.py │ │ ├── 06-random-generators.py │ │ └── __init__.py │ ├── x04-soundfiles │ │ ├── 01-read-from-disk.py │ │ ├── 02-read-from-disk-2.py │ │ ├── 03-read-from-ram.py │ │ ├── 04-record-perf.py │ │ ├── 05-record-streams.py │ │ ├── 06-record-table.py │ │ └── __init__.py │ ├── x05-envelopes │ │ ├── 01-data-signal-conversion.py │ │ ├── 02-linear-ramp.py │ │ ├── 03-exponential-ramp.py │ │ ├── 04-simple-envelopes.py │ │ ├── 05-breakpoints-functions.py │ │ └── __init__.py │ ├── x06-filters │ │ ├── 01-lowpass-filters.py │ │ ├── 02-bandpass-filters.py │ │ ├── 03-complex-resonator.py │ │ ├── 04-phasing.py │ │ ├── 05-convolution-filters.py │ │ ├── 06-vocoder.py │ │ ├── 07-hilbert-transform.py │ │ └── __init__.py │ ├── x07-effects │ │ ├── 01-flanger.py │ │ ├── 02-schroeder-reverb.py │ │ ├── 03-fuzz-disto.py │ │ ├── 04-ping-pong-delay.py │ │ ├── 05-hand-made-chorus.py │ │ ├── 06-hand-made-harmonizer.py │ │ └── __init__.py │ ├── x08-dynamics │ │ ├── 01-dynamic-range.py │ │ ├── 02-ducking.py │ │ ├── 03-gated-verb.py │ │ ├── 04-rms-tracing.py │ │ └── __init__.py │ ├── x09-callbacks │ │ ├── 01-periodic-calls.py │ │ ├── 02-score-calls.py │ │ ├── 03-delayed-calls.py │ │ └── __init__.py │ ├── x10-tables │ │ ├── 01-envelopes.py │ │ ├── 02-scrubbing.py │ │ ├── 03-looping.py │ │ ├── 04-granulation.py │ │ ├── 05-micro-montage.py │ │ ├── 06-table-stutter.py │ │ ├── 07-moving-points.py │ │ ├── 08-table-lookup.py │ │ └── __init__.py │ ├── x14-spectral │ │ ├── 01-fft-filter.py │ │ ├── 02-fft-cross-synth.py │ │ ├── 03-fft-morphing.py │ │ ├── 04-fft-spectral-delay.py │ │ ├── 05-fft-time-stretch.py │ │ └── __init__.py │ ├── x15-matrix │ │ ├── 01-wave-terrain-synthesis.py │ │ ├── 02-matrix-record.py │ │ ├── 03-record-loop-chunks.py │ │ ├── 04-algo-with-matrix.py │ │ └── __init__.py │ ├── x16-midi │ │ ├── 01-midi-scan.py │ │ ├── 02-notein-object.py │ │ ├── 03-midi-envelope.py │ │ ├── 04-simple-midi-synth.py │ │ ├── 05-control-change.py │ │ ├── 06-midi-out.py │ │ ├── 07-midifile-with-mido.py │ │ └── __init__.py │ ├── x17-osc │ │ ├── 01-osc-scan.py │ │ ├── 02-receive-streams.py │ │ ├── 03-send-streams.py │ │ ├── 04-receive-list.py │ │ ├── 05-send-receive-data.py │ │ └── __init__.py │ ├── x19-multirate │ │ ├── 01-multi-rate-processing.py │ │ ├── 02-multi-rate-synthesis.py │ │ └── __init__.py │ ├── x20-multicore │ │ ├── 01-processes-spawning.py │ │ ├── 02-sharing-audio.py │ │ ├── 03-synchronization.py │ │ ├── 04-data-control.py │ │ └── __init__.py │ ├── x21-utilities │ │ ├── 01-list-to-audio-file.py │ │ ├── 02-get-method.py │ │ ├── 03-set-method.py │ │ ├── 04-buffer-interface.py │ │ ├── 05-batch-processing.py │ │ ├── 06-batch-synthesis.py │ │ ├── 07-upsamp-processing.py │ │ ├── 08-multiple-threads.py │ │ ├── 09-audio-mixer.py │ │ └── __init__.py │ ├── x22-events │ │ ├── 01-simple-sequences.py │ │ ├── 02-parameters.py │ │ ├── 03-instruments.py │ │ ├── 04-custom-params.py │ │ ├── 05-complex-sequences.py │ │ ├── 06-randoms.py │ │ ├── 07-managing-scales.py │ │ ├── 08-function-calls.py │ │ ├── 09-embedding-generators.py │ │ ├── 10-arithmetic-ops.py │ │ ├── 11-filters.py │ │ ├── 12-sharing-values.py │ │ ├── 13-using-audio-objects.py │ │ ├── 14-post-processing.py │ │ └── __init__.py │ └── x23-expression │ │ ├── 01-simple-expression.py │ │ ├── 02-audio-in.py │ │ ├── 03-multiple-inputs.py │ │ ├── 04-let-function.py │ │ ├── 05-define-function.py │ │ ├── 06-var-function.py │ │ ├── 07-condition.py │ │ ├── 08-load-function.py │ │ ├── 09-multiple-outputs.py │ │ ├── __init__.py │ │ ├── attractors.expr │ │ ├── filters.expr │ │ ├── generators.expr │ │ └── utils.expr └── lib │ ├── COPYING.txt │ ├── __init__.py │ ├── _core.py │ ├── _maps.py │ ├── _tkwidgets.py │ ├── _widgets.py │ ├── _wxwidgets.py │ ├── analysis.py │ ├── arithmetic.py │ ├── controls.py │ ├── dynamics.py │ ├── effects.py │ ├── events.py │ ├── expression.py │ ├── filters.py │ ├── fourier.py │ ├── generators.py │ ├── hrtf.py │ ├── listener.py │ ├── matrix.py │ ├── matrixprocess.py │ ├── midi.py │ ├── mmlmusic.py │ ├── opensndctrl.py │ ├── pan.py │ ├── pattern.py │ ├── phasevoc.py │ ├── players.py │ ├── randoms.py │ ├── server.py │ ├── snds │ ├── ControlRead_example_test_000 │ ├── ControlRead_example_test_001 │ ├── IRMediumHallStereo.wav │ ├── NoteinRead_example_test_000 │ ├── NoteinRead_example_test_001 │ ├── __init__.py │ ├── accord.aif │ └── transparent.aif │ ├── tableprocess.py │ ├── tables.py │ ├── triggers.py │ ├── utils.py │ └── wxgui.py ├── pyo64 └── __init__.py ├── pyproject.toml ├── release-notes ├── pyo_release_0.8.1.txt ├── pyo_release_0.8.2.txt ├── pyo_release_0.8.4.txt ├── pyo_release_0.8.5.txt ├── pyo_release_0.8.6.txt ├── pyo_release_0.8.7.txt ├── pyo_release_0.8.8.txt ├── pyo_release_0.8.9.txt ├── pyo_release_0.9.0.txt ├── pyo_release_0.9.1.txt ├── pyo_release_1.0.0.txt ├── pyo_release_1.0.1.txt ├── pyo_release_1.0.2.txt ├── pyo_release_1.0.3.txt ├── pyo_release_1.0.4.txt └── pyo_release_1.0.5.txt ├── scripts ├── cleanup_older_pyo_versions.py ├── example_listing.md ├── release_doc_src.sh ├── release_wheels_OSX.sh ├── release_wheels_OSX_arm64.sh ├── release_wheels_Win.bat ├── win │ └── windows-10-64bit-build-routine.txt └── win_audio_drivers_inspector.py ├── setup.py ├── src ├── engine │ ├── ad_coreaudio.c │ ├── ad_jack.c │ ├── ad_portaudio.c │ ├── dummymodule.c │ ├── fft.c │ ├── inputfadermodule.c │ ├── interpolation.c │ ├── md_portmidi.c │ ├── midilistenermodule.c │ ├── mixmodule.c │ ├── osclistenermodule.c │ ├── pvstreammodule.c │ ├── pyomodule.c │ ├── servermodule.c │ ├── streammodule.c │ ├── vbap.c │ └── wind.c └── objects │ ├── analysismodule.c │ ├── arithmeticmodule.c │ ├── bandsplitmodule.c │ ├── chorusmodule.c │ ├── compressmodule.c │ ├── convolvemodule.c │ ├── delaymodule.c │ ├── distomodule.c │ ├── exprmodule.c │ ├── fadermodule.c │ ├── fftmodule.c │ ├── filtremodule.c │ ├── freeverbmodule.c │ ├── granulatormodule.c │ ├── harmonizermodule.c │ ├── hilbertmodule.c │ ├── hrtfmodule.c │ ├── inputmodule.c │ ├── lfomodule.c │ ├── matrixmodule.c │ ├── matrixprocessmodule.c │ ├── metromodule.c │ ├── midimodule.c │ ├── mmlmodule.c │ ├── noisemodule.c │ ├── oscbankmodule.c │ ├── oscilmodule.c │ ├── oscmodule.c │ ├── panmodule.c │ ├── patternmodule.c │ ├── phasevocmodule.c │ ├── randommodule.c │ ├── recordmodule.c │ ├── selectmodule.c │ ├── sfplayermodule.c │ ├── sigmodule.c │ ├── tablemodule.c │ ├── trigmodule.c │ ├── utilsmodule.c │ └── wgverbmodule.c ├── tests ├── bébêtte │ ├── IRMediumHallStereo.wav │ ├── encoding_test.py │ ├── noise.aif │ └── transparent.aif ├── encoding_test.py ├── play_all_manual_examples.py ├── pytests │ ├── conftest.py │ ├── test_baseObjects.py │ ├── test_functions.py │ └── utilities.py ├── test_Expr_object │ ├── TODO_EXPR.py │ ├── expr_test_01_simple.py │ ├── expr_test_02_audioin.py │ ├── expr_test_03_let.py │ ├── expr_test_04_define.py │ ├── expr_test_05_var.py │ ├── expr_test_06_cond.py │ ├── expr_test_07_load.py │ ├── expr_test_08_multiout.py │ ├── filters.expr │ ├── generators.expr │ └── utils.expr ├── test_all_attribute_i_a_combinations.py ├── test_auto_start_children.py ├── test_math_ops.py ├── test_portaudio_functions.py ├── test_table_failure.py └── valgrind │ ├── run_all.sh │ ├── test_memleak_PyoMatrixObject.py │ ├── test_memleak_PyoObject.py │ ├── test_memleak_PyoPVObject.py │ ├── test_memleak_PyoTableObject.py │ ├── test_memleak_TableProcess.py │ ├── test_memleak_analysis.py │ ├── test_memleak_arithmetic.py │ ├── test_memleak_bandsplit.py │ ├── test_memleak_controls.py │ ├── test_memleak_dsl.py │ ├── test_memleak_effects.py │ ├── test_memleak_fft.py │ ├── test_memleak_filters.py │ ├── test_memleak_functions.py │ ├── test_memleak_generators.py │ ├── test_memleak_granulator.py │ ├── test_memleak_masteronly_funcs.py │ ├── test_memleak_masteronly_objects.py │ ├── test_memleak_randoms.py │ ├── test_memleak_triggers.py │ ├── test_memleak_utils.py │ ├── valgrind-python.supp │ └── valgrind-python3.9.supp └── work-in-progress ├── 0001-Added-get-method-to-_base-objects.patch ├── EventParser.py └── test_event_parser.py /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Keep GitHub Actions up to date with GitHub's Dependabot... 2 | # https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot 3 | # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem 4 | version: 2 5 | updates: 6 | - package-ecosystem: github-actions 7 | directory: / 8 | groups: 9 | github-actions: 10 | patterns: 11 | - "*" # Group all Actions updates into a single larger pull request 12 | schedule: 13 | interval: weekly 14 | -------------------------------------------------------------------------------- /.github/workflows/build_manylinux_wheels.yml: -------------------------------------------------------------------------------- 1 | on: 2 | workflow_dispatch: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | 8 | jobs: 9 | deploy: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v4 13 | - name: Set up Python 14 | uses: actions/setup-python@v5 15 | with: 16 | python-version: 3.9 17 | - name: Install dependencies 18 | run: | 19 | python -m pip install --upgrade pip 20 | pip install twine 21 | - name: Build manylinux Python wheels 22 | uses: RalfG/python-wheels-manylinux-build@v0.5.0-manylinux2014_x86_64 23 | with: 24 | python-versions: 'cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313' 25 | system-packages: 'guile-devel zlib-devel gettext portaudio-devel portmidi-devel autogen libdb-devel wget' 26 | pre-build-command: 'sh manylinux-pre-build-script.sh' 27 | pip-wheel-args: '-w ./dist --config-setting="--build-option=--use-double" --config-setting="--build-option=--use-jack"' 28 | - name: Publish wheels to test PyPI 29 | env: 30 | TWINE_USERNAME: __token__ 31 | TWINE_PASSWORD: pypi-AgENdGVzdC5weXBpLm9yZwIkY2FkY2Y2MzktODE1NC00MDY1LTg5ZDctMzY0ODE1NGExYjgwAAILWzEsWyJweW8iXV0AAixbMixbIjJmMTZmZWQ3LTQ0ZmEtNGRmMC1hY2I0LTQ0M2ZmNDFkNzE5YiJdXQAABiD0UYJSUVETU3c-I0RJ8-E5Yi7dmtrH7fuMjngDX67khA 32 | run: | 33 | twine upload --verbose --repository testpypi dist/*-manylinux*.whl 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | *.egg-info/ 23 | .installed.cfg 24 | *.egg 25 | 26 | # PyInstaller 27 | # Usually these files are written by a python script from a template 28 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 29 | *.manifest 30 | *.spec 31 | 32 | # Installer logs 33 | pip-log.txt 34 | pip-delete-this-directory.txt 35 | 36 | # Unit test / coverage reports 37 | htmlcov/ 38 | .tox/ 39 | .coverage 40 | .coverage.* 41 | .cache 42 | nosetests.xml 43 | coverage.xml 44 | *,cover 45 | 46 | # Translations 47 | *.mo 48 | *.pot 49 | 50 | # Django stuff: 51 | *.log 52 | 53 | # Sphinx documentation 54 | docs/_build/ 55 | 56 | # PyBuilder 57 | target/ 58 | 59 | # OSX 60 | .DS_Store 61 | 62 | # venv 63 | .venv/ 64 | venv/ 65 | -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Linux", 5 | "includePath": [ 6 | "${workspaceFolder}/**", 7 | "/usr/include/python3.9/**" 8 | ], 9 | "defines": [], 10 | "compilerPath": "/usr/bin/gcc", 11 | "cStandard": "c11", 12 | "cppStandard": "c++14", 13 | "intelliSenseMode": "clang-x64" 14 | } 15 | ], 16 | "version": 4 17 | } -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Python: Current File (Integrated Terminal)", 6 | "type": "python", 7 | "request": "launch", 8 | "program": "${file}", 9 | "console": "integratedTerminal", 10 | "cwd": "${fileDirname}" 11 | }, 12 | { 13 | "name": "Python: Current File (Integrated Terminal with Jack)", 14 | "type": "python", 15 | "request": "launch", 16 | "program": "${file}", 17 | "console": "integratedTerminal", 18 | "cwd": "${fileDirname}" 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "pyo_version": "1.0.6", 3 | "activate_venv": "source .venv/bin/activate", 4 | "build_linux_debug": "python3 -m build --wheel --config-setting=\"--build-option=--use-jack\" --config-setting=\"--build-option=--debug\" --config-setting=\"--build-option=--fast-compile\"", 5 | "build_linux_single": "python3 -m build --wheel --config-setting=\"--build-option=--use-jack\"", 6 | "build_linux_double": "python3 -m build --wheel --config-setting=\"--build-option=--use-jack\" --config-setting=\"--build-option=--use-double\"", 7 | "install_linux": "python3 -m pip install --force-reinstall dist/pyo-*-cp311-cp311-linux_x86_64.whl", 8 | } -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | graft embedded 2 | graft externals 3 | graft include 4 | graft scripts 5 | graft src 6 | 7 | -------------------------------------------------------------------------------- /docs/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/docs/.nojekyll -------------------------------------------------------------------------------- /docs/_images/E-PyoIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/docs/_images/E-PyoIcon.png -------------------------------------------------------------------------------- /docs/_images/structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/docs/_images/structure.png -------------------------------------------------------------------------------- /docs/_sources/about.rst.txt: -------------------------------------------------------------------------------- 1 | About pyo 2 | ================= 3 | 4 | Pyo is a Python module written in C to help digital signal processing script 5 | creation. It provides a complete set of classes to build audio softwares, 6 | compose algorithmic musics or simply explore audio processing with a simple, 7 | mature and powerful programming language. 8 | 9 | Pyo contains 10 | classes for a wide variety of audio signal processing. With pyo, the user will 11 | be able to include signal processing chains directly in Python scripts or 12 | projects, and to manipulate them in real time through the interpreter. Tools 13 | in the pyo module offer primitives, like mathematical operations on audio 14 | signals, basic signal processing (filters, delays, synthesis generators, etc.), 15 | but also complex algorithms to create sound granulation and other creative 16 | audio manipulations. pyo supports the OSC protocol (Open Sound Control) to ease 17 | communications between softwares, and the MIDI protocol for generating sound 18 | events and controlling process parameters. pyo allows the creation of 19 | sophisticated signal processing chains with all the benefits of a mature and 20 | widely used general programming language. 21 | 22 | Pyo is developed by Olivier Bélanger < belangeo@gmail.com > 23 | 24 | For questions and comments, please subscribe to the 25 | `discussions `_ list on github. 26 | 27 | To report a bug or to request a feature, use the 28 | `issues tracker `_ on github. 29 | -------------------------------------------------------------------------------- /docs/_sources/api/classes/_core.rst.txt: -------------------------------------------------------------------------------- 1 | Base Classes 2 | ====================================== 3 | 4 | .. currentmodule:: pyo 5 | 6 | Here are defined the base classes implementing common behaviors for 7 | the different kinds of objects in the library. 8 | 9 | Objects in this category 10 | ------------------------------ 11 | 12 | - :py:class:`PyoObjectBase` : Base class for all pyo objects. 13 | - :py:class:`PyoObject` : Base class for all pyo objects that manipulate vectors of samples. 14 | - :py:class:`PyoTableObject` : Base class for all pyo table objects. 15 | - :py:class:`PyoMatrixObject` : Base class for all pyo matrix objects. 16 | - :py:class:`PyoPVObject` : Base class for objects working with phase vocoder’s magnitude and frequency streams. 17 | 18 | *PyoObjectBase* 19 | -------------------------------------- 20 | 21 | .. autoclass:: PyoObjectBase 22 | :members: 23 | 24 | .. autoclasstoc:: 25 | 26 | *PyoObject* 27 | -------------------------------------- 28 | 29 | .. autoclass:: PyoObject 30 | :members: 31 | 32 | .. autoclasstoc:: 33 | 34 | *PyoTableObject* 35 | -------------------------------------- 36 | 37 | .. autoclass:: PyoTableObject 38 | :members: 39 | 40 | .. autoclasstoc:: 41 | 42 | *PyoMatrixObject* 43 | -------------------------------------- 44 | 45 | .. autoclass:: PyoMatrixObject 46 | :members: 47 | 48 | .. autoclasstoc:: 49 | 50 | *PyoPVObject* 51 | -------------------------------------- 52 | 53 | .. autoclass:: PyoPVObject 54 | :members: 55 | 56 | .. autoclasstoc:: 57 | 58 | -------------------------------------------------------------------------------- /docs/_sources/api/classes/index.rst.txt: -------------------------------------------------------------------------------- 1 | Classes by category 2 | =============================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | server 8 | listener 9 | _core 10 | analysis 11 | arithmetic 12 | controls 13 | dynamics 14 | effects 15 | events 16 | expression 17 | filters 18 | fourier 19 | pvoc 20 | generators 21 | internals 22 | matrixprocess 23 | midi 24 | mmlmusic 25 | opensndctrl 26 | pan 27 | pattern 28 | players 29 | randoms 30 | tableprocess 31 | triggers 32 | utils 33 | tables 34 | matrices 35 | map 36 | wxgui 37 | 38 | -------------------------------------------------------------------------------- /docs/_sources/api/classes/listener.rst.txt: -------------------------------------------------------------------------------- 1 | Controller listeners 2 | =================================== 3 | 4 | .. currentmodule:: pyo 5 | 6 | These objects can be used to create MIDI and/or OSC listeners without the 7 | need to boot ands start an audio server before receiving messages. 8 | 9 | Objects in this category 10 | ------------------------------ 11 | 12 | - :py:class:`MidiListener` : Self-contained midi listener thread. 13 | - :py:class:`MidiDispatcher` : Self-contained midi dispatcher thread. 14 | - :py:class:`OscListener` : Self-contained OSC listener thread. 15 | 16 | *MidiListener* 17 | ----------------------------------- 18 | 19 | .. autoclass:: MidiListener 20 | :members: 21 | 22 | .. autoclasstoc:: 23 | 24 | *MidiDispatcher* 25 | ----------------------------------- 26 | 27 | .. autoclass:: MidiDispatcher 28 | :members: 29 | 30 | .. autoclasstoc:: 31 | 32 | *OscListener* 33 | ----------------------------------- 34 | 35 | .. autoclass:: OscListener 36 | :members: 37 | 38 | .. autoclasstoc:: 39 | -------------------------------------------------------------------------------- /docs/_sources/api/classes/matrices.rst.txt: -------------------------------------------------------------------------------- 1 | Matrices 2 | =================================== 3 | 4 | .. currentmodule:: pyo 5 | 6 | Objects in this category 7 | ------------------------------ 8 | 9 | - :py:class:`NewMatrix` : Create a new matrix ready for recording. 10 | 11 | Matrices are two-dimensions containers to keep samples (sounds, envelopes, algorithmic patterns, images, etc.) 12 | in memory and access them quickly. 13 | 14 | *NewMatrix* 15 | ----------------------------------- 16 | 17 | .. autoclass:: NewMatrix 18 | :members: 19 | 20 | .. autoclasstoc:: 21 | 22 | -------------------------------------------------------------------------------- /docs/_sources/api/classes/matrixprocess.rst.txt: -------------------------------------------------------------------------------- 1 | Matrix Processing 2 | =================================== 3 | 4 | .. currentmodule:: pyo 5 | 6 | PyoObjects to perform operations on PyoMatrixObjects. 7 | 8 | PyoMatrixObjects are 2 dimensions table containers. They can be used 9 | to store audio samples or algorithmic sequences. Writing and reading 10 | are done by giving row and column positions. 11 | 12 | Objects in this category 13 | ------------------------------ 14 | 15 | - :py:class:`MatrixMorph` : Morphs between multiple PyoMatrixObjects. 16 | - :py:class:`MatrixPointer` : Matrix reader with control on the 2D pointer position. 17 | - :py:class:`MatrixRec` : MatrixRec records samples into a previously created NewMatrix. 18 | - :py:class:`MatrixRecLoop` : MatrixRecLoop records samples in loop into a previously created NewMatrix. 19 | 20 | *MatrixMorph* 21 | ----------------------------------- 22 | 23 | .. autoclass:: MatrixMorph 24 | :members: 25 | 26 | .. autoclasstoc:: 27 | 28 | *MatrixPointer* 29 | ----------------------------------- 30 | 31 | .. autoclass:: MatrixPointer 32 | :members: 33 | 34 | .. autoclasstoc:: 35 | 36 | *MatrixRec* 37 | ----------------------------------- 38 | 39 | .. autoclass:: MatrixRec 40 | :members: 41 | 42 | .. autoclasstoc:: 43 | 44 | *MatrixRecLoop* 45 | ----------------------------------- 46 | 47 | .. autoclass:: MatrixRecLoop 48 | :members: 49 | 50 | .. autoclasstoc:: 51 | 52 | -------------------------------------------------------------------------------- /docs/_sources/api/classes/pattern.rst.txt: -------------------------------------------------------------------------------- 1 | Event Sequencing 2 | =================================== 3 | 4 | .. currentmodule:: pyo 5 | 6 | Set of objects that call Python functions from triggers or number counts. 7 | Useful for event sequencing. 8 | 9 | Objects in this category 10 | ------------------------------ 11 | 12 | - :py:class:`CallAfter` : Calls a Python function after a given time. 13 | - :py:class:`Pattern` : Periodically calls a Python function. 14 | - :py:class:`Score` : Calls functions by incrementation of a preformatted name. 15 | 16 | *CallAfter* 17 | ----------------------------------- 18 | 19 | .. autoclass:: CallAfter 20 | :members: 21 | 22 | .. autoclasstoc:: 23 | 24 | *Pattern* 25 | ----------------------------------- 26 | 27 | .. autoclass:: Pattern 28 | :members: 29 | 30 | .. autoclasstoc:: 31 | 32 | *Score* 33 | ----------------------------------- 34 | 35 | .. autoclass:: Score 36 | :members: 37 | 38 | .. autoclasstoc:: 39 | 40 | -------------------------------------------------------------------------------- /docs/_sources/api/classes/players.rst.txt: -------------------------------------------------------------------------------- 1 | Soundfile Players 2 | =================================== 3 | 4 | .. currentmodule:: pyo 5 | 6 | Play soundfiles from the disk. 7 | 8 | SfMarkerXXX objects use markers features (store in the header) from 9 | an AIFF file to create more specific reading patterns. 10 | 11 | Objects in this category 12 | ------------------------------ 13 | 14 | - :py:class:`SfPlayer` : Soundfile player. 15 | - :py:class:`SfMarkerLooper` : AIFF with markers soundfile looper. 16 | - :py:class:`SfMarkerShuffler` : AIFF with markers soundfile shuffler. 17 | 18 | *SfPlayer* 19 | ----------------------------------- 20 | 21 | .. autoclass:: SfPlayer 22 | :members: 23 | 24 | .. autoclasstoc:: 25 | 26 | *SfMarkerLooper* 27 | ----------------------------------- 28 | 29 | .. autoclass:: SfMarkerLooper 30 | :members: 31 | 32 | .. autoclasstoc:: 33 | 34 | *SfMarkerShuffler* 35 | ----------------------------------- 36 | 37 | .. autoclass:: SfMarkerShuffler 38 | :members: 39 | 40 | .. autoclasstoc:: 41 | 42 | -------------------------------------------------------------------------------- /docs/_sources/api/classes/server.rst.txt: -------------------------------------------------------------------------------- 1 | Audio Server 2 | =================================== 3 | 4 | .. currentmodule:: pyo 5 | 6 | *Server* 7 | ----------------------------------- 8 | 9 | .. autoclass:: Server 10 | :members: 11 | 12 | .. autoclasstoc:: 13 | 14 | -------------------------------------------------------------------------------- /docs/_sources/api/constants.rst.txt: -------------------------------------------------------------------------------- 1 | Constants 2 | =============================== 3 | 4 | - **PYO_VERSION** : string. Current version of pyo, as a string in the format "major.minor.change". 5 | - **USE_DOUBLE** : boolean. True if using double precision (64-bit), False for single precision (32-bit). 6 | - **WITH_EXTERNALS** : boolean. True if pyo was compiled with external classes. See :ref:`compilation-flags-label`. 7 | - **SNDS_PATH** : string. Path to the pyo sound folder (located in the site-packages folder of the current Python installation. 8 | 9 | -------------------------------------------------------------------------------- /docs/_sources/api/functions/index.rst.txt: -------------------------------------------------------------------------------- 1 | Functions 2 | =================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | audio 8 | midi 9 | sndfile 10 | sampling 11 | conv 12 | server 13 | util 14 | 15 | -------------------------------------------------------------------------------- /docs/_sources/api/functions/sampling.rst.txt: -------------------------------------------------------------------------------- 1 | Resampling 2 | ======================= 3 | 4 | Functions to modify the sampling rate of an audio file. 5 | 6 | .. currentmodule:: pyo 7 | 8 | Functions in this category 9 | ------------------------------ 10 | 11 | - :py:func:`upsamp` : Increases the sampling rate of an audio file. 12 | - :py:func:`downsamp` : Decreases the sampling rate of an audio file. 13 | 14 | *upsamp* 15 | --------------------------------- 16 | 17 | .. autofunction:: upsamp(path, outfile, up=4, order=128) 18 | 19 | *downsamp* 20 | --------------------------------- 21 | 22 | .. autofunction:: downsamp(path, outfile, down=4, order=128) 23 | 24 | -------------------------------------------------------------------------------- /docs/_sources/api/functions/server.rst.txt: -------------------------------------------------------------------------------- 1 | Server Queries 2 | ====================================== 3 | 4 | Functions to query the audio server state. 5 | 6 | .. currentmodule:: pyo 7 | 8 | Functions in this category 9 | ------------------------------ 10 | 11 | - :py:func:`serverCreated` : Returns True if a Server object is already created, otherwise, returns False. 12 | - :py:func:`serverBooted` : Returns True if an already created Server is booted, otherwise, returns False. 13 | 14 | *serverCreated* 15 | --------------------------------- 16 | 17 | .. autofunction:: serverCreated 18 | 19 | *serverBooted* 20 | --------------------------------- 21 | 22 | .. autofunction:: serverBooted 23 | 24 | -------------------------------------------------------------------------------- /docs/_sources/api/functions/sndfile.rst.txt: -------------------------------------------------------------------------------- 1 | Soundfile 2 | ============================= 3 | 4 | Functions to inspect or write an audio file on disk. 5 | 6 | .. currentmodule:: pyo 7 | 8 | Functions in this category 9 | ------------------------------ 10 | 11 | - :py:func:`sndinfo` : Retrieve informations about a soundfile. 12 | - :py:func:`savefile` : Creates an audio file from a list of floats. 13 | - :py:func:`savefileFromTable` : Creates an audio file from the content of a table. 14 | 15 | *sndinfo* 16 | --------------------------------- 17 | 18 | .. autofunction:: sndinfo(path, print=False) 19 | 20 | *savefile* 21 | --------------------------------- 22 | 23 | .. autofunction:: savefile(samples, path, sr=44100, channels=1, fileformat=0, sampletype=0, quality=0.4) 24 | 25 | *savefileFromTable* 26 | --------------------------------- 27 | 28 | .. autofunction:: savefileFromTable(table, path, fileformat=0, sampletype=0, quality=0.4) 29 | 30 | -------------------------------------------------------------------------------- /docs/_sources/api/index.rst.txt: -------------------------------------------------------------------------------- 1 | API documentation 2 | =============================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | constants 8 | functions/index 9 | alphabetical 10 | classes/index 11 | -------------------------------------------------------------------------------- /docs/_sources/examples/index.rst.txt: -------------------------------------------------------------------------------- 1 | 2 | Examples 3 | ================ 4 | 5 | .. toctree:: 6 | :maxdepth: 1 7 | 8 | First steps 9 | Parameter control 10 | Synthesis generators 11 | Playing with soundfiles 12 | Amplitude envelopes 13 | Filtering 14 | Creating sound effects 15 | Dynamic range of audio signals 16 | Calling python functions from audio objects 17 | Using tables 18 | Processing in the spectral domain 19 | Using 2D tables (matrix) 20 | How to use MIDI with pyo 21 | How to use OSC with pyo 22 | Multirate audio processing 23 | Multicore audio programming 24 | Utilities 25 | Events framework 26 | Evaluating prefix expression 27 | 28 | -------------------------------------------------------------------------------- /docs/_sources/examples/x01-intro/01-audio-server.rst.txt: -------------------------------------------------------------------------------- 1 | 01-audio-server.py - Booting the audio server. 2 | ============================================================================================================================================ 3 | 4 | 5 | A Server object needs to be created before any other audio object. 6 | It is the one that handles the communication with the audio and midi 7 | drivers and also the one that keeps track of the processing chain. 8 | 9 | .. code-block:: python 10 | 11 | from pyo import * 12 | 13 | # Creates a Server object with default arguments. 14 | # See the manual about how to change the sampling rate, the buffer 15 | # size, the number of channels or one of the other global settings. 16 | s = Server() 17 | 18 | # Boots the server. This step initializes audio and midi streams. 19 | # Audio and midi configurations (if any) must be done before that call. 20 | s.boot() 21 | 22 | # Starts the server. This step activates the server processing loop. 23 | s.start() 24 | 25 | # Here comes the processing chain... 26 | 27 | # The Server object provides a Graphical User Interface with the 28 | # gui() method. One of its purpose is to keep the program alive 29 | # while computing samples over time. If the locals dictionary is 30 | # given as argument, the user can continue to send commands to the 31 | # python interpreter from the GUI. 32 | s.gui(locals()) 33 | 34 | -------------------------------------------------------------------------------- /docs/_sources/examples/x01-intro/02-sine-tone.rst.txt: -------------------------------------------------------------------------------- 1 | 02-sine-tone.py - The "hello world" of audio programming! 2 | ============================================================================================================================================ 3 | 4 | 5 | This script simply plays a 1000 Hz sine tone. 6 | 7 | .. code-block:: python 8 | 9 | from pyo import * 10 | 11 | # Creates and boots the server. 12 | # The user should send the "start" command from the GUI. 13 | s = Server().boot() 14 | # Drops the gain by 20 dB. 15 | s.amp = 0.1 16 | 17 | # Creates a sine wave player. 18 | # The out() method starts the processing 19 | # and sends the signal to the output. 20 | a = Sine().out() 21 | 22 | # Opens the server graphical interface. 23 | s.gui(locals()) 24 | 25 | -------------------------------------------------------------------------------- /docs/_sources/examples/x01-intro/03-parallel-proc.rst.txt: -------------------------------------------------------------------------------- 1 | 03-parallel-proc.py - Multiple processes on a single source. 2 | ============================================================================================================================================ 3 | 4 | 5 | This example shows how to play different audio objects side-by-side. 6 | Every processing object (ie the ones that modify an audio source) have 7 | a first argument called "input". This argument takes the audio object 8 | to process. 9 | 10 | Note the input variable given to each processing object and the call 11 | to the out() method of each object that should send its samples to the 12 | output. 13 | 14 | .. code-block:: python 15 | 16 | from pyo import * 17 | 18 | s = Server().boot() 19 | s.amp = 0.1 20 | 21 | # Creates a sine wave as the source to process. 22 | a = Sine() 23 | 24 | # Passes the sine wave through an harmonizer. 25 | hr = Harmonizer(a).out() 26 | 27 | # Also through a chorus. 28 | ch = Chorus(a).out() 29 | 30 | # And through a frequency shifter. 31 | sh = FreqShift(a).out() 32 | 33 | s.gui(locals()) 34 | 35 | -------------------------------------------------------------------------------- /docs/_sources/examples/x01-intro/04-serial-proc.rst.txt: -------------------------------------------------------------------------------- 1 | 04-serial-proc.py - Chaining processes on a single source. 2 | ============================================================================================================================================ 3 | 4 | 5 | This example shows how to chain processes on a single source. 6 | Every processing object (ie the ones that modify an audio source) have 7 | a first argument called "input". This argument takes the audio object 8 | to process. 9 | 10 | Note the input variable given to each Harmonizer. 11 | 12 | .. code-block:: python 13 | 14 | from pyo import * 15 | 16 | s = Server().boot() 17 | s.amp = 0.1 18 | 19 | # Creates a sine wave as the source to process. 20 | a = Sine().out() 21 | 22 | # Passes the sine wave through an harmonizer. 23 | h1 = Harmonizer(a).out() 24 | 25 | # Then the harmonized sound through another harmonizer. 26 | h2 = Harmonizer(h1).out() 27 | 28 | # And again... 29 | h3 = Harmonizer(h2).out() 30 | 31 | # And again... 32 | h4 = Harmonizer(h3).out() 33 | 34 | s.gui(locals()) 35 | 36 | -------------------------------------------------------------------------------- /docs/_sources/examples/x01-intro/05-output-channels.rst.txt: -------------------------------------------------------------------------------- 1 | 05-output-channels.py - Sending signals to different physical outputs. 2 | ============================================================================================================================================ 3 | 4 | 5 | The simplest way to choose the output channel where to send the sound 6 | is to give it as the first argument of the out() method. In fact, the 7 | signature of the out() method reads as: 8 | 9 | .out(chnl=0, inc=1, dur=0, delay=0) 10 | 11 | `chnl` is the output where to send the first audio channel (stream) of 12 | the object. `inc` is the output increment for other audio channels. 13 | `dur` is the living duration, in seconds, of the process and `delay` 14 | is a delay, in seconds, before activating the process. A duration of 15 | 0 means play forever. 16 | 17 | .. code-block:: python 18 | 19 | from pyo import * 20 | 21 | s = Server().boot() 22 | s.amp = 0.1 23 | 24 | # Creates a source (white noise) 25 | n = Noise() 26 | 27 | # Sends the bass frequencies (below 1000 Hz) to the left 28 | lp = ButLP(n).out() 29 | 30 | # Sends the high frequencies (above 1000 Hz) to the right 31 | hp = ButHP(n).out(1) 32 | 33 | s.gui(locals()) 34 | 35 | -------------------------------------------------------------------------------- /docs/_sources/examples/x01-intro/index.rst.txt: -------------------------------------------------------------------------------- 1 | x01-intro 2 | ======================================== 3 | 4 | 5 | 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | 01-audio-server 12 | 02-sine-tone 13 | 03-parallel-proc 14 | 04-serial-proc 15 | 05-output-channels 16 | -------------------------------------------------------------------------------- /docs/_sources/examples/x02-controls/01-fixed-control.rst.txt: -------------------------------------------------------------------------------- 1 | 01-fixed-control.py - Number as argument. 2 | ============================================================================================================================================ 3 | 4 | 5 | Audio objects behavior can be controlled by passing 6 | value to their arguments at initialization time. 7 | 8 | .. code-block:: python 9 | 10 | from pyo import * 11 | 12 | s = Server().boot() 13 | s.amp = 0.1 14 | 15 | # Sets fundamental frequency 16 | freq = 200 17 | 18 | # Approximates a triangle waveform by adding odd harmonics with 19 | # amplitude proportional to the inverse square of the harmonic number. 20 | h1 = Sine(freq=freq, mul=1).out() 21 | h2 = Sine(freq=freq * 3, phase=0.5, mul=1.0 / pow(3, 2)).out() 22 | h3 = Sine(freq=freq * 5, mul=1.0 / pow(5, 2)).out() 23 | h4 = Sine(freq=freq * 7, phase=0.5, mul=1.0 / pow(7, 2)).out() 24 | h5 = Sine(freq=freq * 9, mul=1.0 / pow(9, 2)).out() 25 | h6 = Sine(freq=freq * 11, phase=0.5, mul=1.0 / pow(11, 2)).out() 26 | 27 | # Displays the final waveform 28 | sp = Scope(h1 + h2 + h3 + h4 + h5 + h6) 29 | 30 | s.gui(locals()) 31 | 32 | -------------------------------------------------------------------------------- /docs/_sources/examples/x02-controls/02-dynamic-control.rst.txt: -------------------------------------------------------------------------------- 1 | 02-dynamic-control.py - Graphical control for parameters. 2 | ============================================================================================================================================ 3 | 4 | 5 | With pyo, it's easy to quickly try some parameter combination 6 | with the controller window already configured for each object. 7 | To open the controller window, just call the ctrl() method on 8 | the object you want to control. 9 | 10 | .. code-block:: python 11 | 12 | from pyo import * 13 | 14 | s = Server().boot() 15 | s.amp = 0.1 16 | 17 | # Creates two objects with cool parameters, one per channel. 18 | a = FM().out() 19 | b = FM().out(1) 20 | 21 | # Opens the controller windows. 22 | a.ctrl(title="Frequency modulation left channel") 23 | b.ctrl(title="Frequency modulation right channel") 24 | 25 | # If a list of values is given at a particular argument, the ctrl 26 | # window will show a multislider to set each value separately. 27 | 28 | oscs = Sine([100, 200, 300, 400, 500, 600, 700, 800], mul=0.1).out() 29 | oscs.ctrl(title="Simple additive synthesis") 30 | 31 | s.gui(locals()) 32 | 33 | -------------------------------------------------------------------------------- /docs/_sources/examples/x02-controls/07-multichannel-expansion-2.rst.txt: -------------------------------------------------------------------------------- 1 | 07-multichannel-expansion-2.py - Extended multichannel expansion. 2 | ============================================================================================================================================ 3 | 4 | 5 | When using multichannel expansion with lists of different lengths, 6 | the longer list is used to set the number of streams and smaller 7 | lists will be wrap-around to fill the holes. 8 | 9 | This feature is very useful to create complex sonorities. 10 | 11 | .. code-block:: python 12 | 13 | from pyo import * 14 | 15 | s = Server().boot() 16 | 17 | # 12 streams with different combinations of `freq` and `ratio`. 18 | a = SumOsc( 19 | freq=[100, 150.2, 200.5, 250.7], 20 | ratio=[0.501, 0.753, 1.255], 21 | index=[0.3, 0.4, 0.5, 0.6, 0.7, 0.4, 0.5, 0.3, 0.6, 0.7, 0.3, 0.5], 22 | mul=0.05, 23 | ) 24 | 25 | # Adds a stereo reverberation to the signal 26 | rev = Freeverb(a.mix(2), size=0.80, damp=0.70, bal=0.30).out() 27 | 28 | s.gui(locals()) 29 | 30 | -------------------------------------------------------------------------------- /docs/_sources/examples/x02-controls/09-handling-channels-2.rst.txt: -------------------------------------------------------------------------------- 1 | 09-handling-channels-2.py - The `out` method and the physical outputs. 2 | ============================================================================================================================================ 3 | 4 | 5 | In a multichannel environment, we can carefully choose which stream 6 | goes to which output channel. To achieve this, we use the `chnl` and 7 | `inc` arguments of the out method. 8 | 9 | chnl : Physical output assigned to the first audio stream of the object. 10 | inc : Output channel increment value. 11 | 12 | .. code-block:: python 13 | 14 | from pyo import * 15 | 16 | # Creates a Server with 8 channels 17 | s = Server(nchnls=8).boot() 18 | 19 | # Generates a sine wave 20 | a = Sine(freq=500, mul=0.3) 21 | 22 | # Mixes it up to four streams 23 | b = a.mix(4) 24 | 25 | # Outputs to channels 0, 2, 4 and 6 26 | b.out(chnl=0, inc=2) 27 | 28 | s.gui(locals()) 29 | 30 | -------------------------------------------------------------------------------- /docs/_sources/examples/x02-controls/10-handling-channels-3.rst.txt: -------------------------------------------------------------------------------- 1 | 10-handling-channels-3.py - Random multichannel outputs. 2 | ============================================================================================================================================ 3 | 4 | 5 | If `chnl` is negative, streams begin at 0, increment the output 6 | number by inc and wrap around the global number of channels. 7 | Then, the list of streams is scrambled. 8 | 9 | .. code-block:: python 10 | 11 | from pyo import * 12 | 13 | # Creates a Server with 8 channels 14 | s = Server(nchnls=8).boot() 15 | 16 | amps = [0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4] 17 | 18 | # Generates 8 sine waves with 19 | # increasing amplitudes 20 | a = Sine(freq=500, mul=amps) 21 | 22 | # Shuffles physical output channels 23 | a.out(chnl=-1) 24 | 25 | s.gui(locals()) 26 | 27 | -------------------------------------------------------------------------------- /docs/_sources/examples/x02-controls/11-handling-channels-4.rst.txt: -------------------------------------------------------------------------------- 1 | 11-handling-channels-4.py - Explicit control of the physical outputs. 2 | ============================================================================================================================================ 3 | 4 | 5 | If `chnl` is a list, successive values in the list will be assigned 6 | to successive streams. 7 | 8 | .. code-block:: python 9 | 10 | from pyo import * 11 | 12 | # Creates a Server with 8 channels 13 | s = Server(nchnls=8).boot() 14 | 15 | amps = [0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4] 16 | 17 | # Generates 8 sine waves with 18 | # increasing amplitudes 19 | a = Sine(freq=500, mul=amps) 20 | 21 | # Sets the output channels ordering 22 | a.out(chnl=[3, 4, 2, 5, 1, 6, 0, 7]) 23 | 24 | s.gui(locals()) 25 | 26 | -------------------------------------------------------------------------------- /docs/_sources/examples/x02-controls/index.rst.txt: -------------------------------------------------------------------------------- 1 | x02-controls 2 | ======================================== 3 | 4 | 5 | 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | 01-fixed-control 12 | 02-dynamic-control 13 | 03-output-range 14 | 04-building-lfo 15 | 05-math-ops 16 | 06-multichannel-expansion 17 | 07-multichannel-expansion-2 18 | 08-handling-channels 19 | 09-handling-channels-2 20 | 10-handling-channels-3 21 | 11-handling-channels-4 22 | -------------------------------------------------------------------------------- /docs/_sources/examples/x03-generators/04-noise-generators.rst.txt: -------------------------------------------------------------------------------- 1 | 04-noise-generators.py - Different pseudo-random noise generators. 2 | ============================================================================================================================================ 3 | 4 | 5 | There are three noise generators (beside random generators that 6 | will be covered later) in the library. These are the classic 7 | white noise, pink noise and brown noise. 8 | 9 | Noise: 10 | White noise generator, flat spectrum. 11 | 12 | PinkNoise: 13 | Pink noise generator, 3dB roll off per octave. 14 | 15 | BrownNoise: 16 | Brown noise generator, 6dB roll off per octave. 17 | 18 | Use the "voice" slider of the window "Input interpolator" to 19 | interpolate between the three sources. 20 | 21 | .. code-block:: python 22 | 23 | from pyo import * 24 | 25 | s = Server().boot() 26 | 27 | # White noise 28 | n1 = Noise(0.3) 29 | 30 | # Pink noise 31 | n2 = PinkNoise(0.3) 32 | 33 | # Brown noise 34 | n3 = BrownNoise(0.3) 35 | 36 | # Interpolates between input objects to produce a single output 37 | sel = Selector([n1, n2, n3]).out() 38 | sel.ctrl(title="Input interpolator (0=White, 1=Pink, 2=Brown)") 39 | 40 | # Displays the spectrum contents of the chosen source 41 | sp = Spectrum(sel) 42 | 43 | s.gui(locals()) 44 | 45 | -------------------------------------------------------------------------------- /docs/_sources/examples/x03-generators/index.rst.txt: -------------------------------------------------------------------------------- 1 | x03-generators 2 | ======================================== 3 | 4 | 5 | 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | 01-complex-oscs 12 | 02-band-limited-oscs 13 | 03-fm-generators 14 | 04-noise-generators 15 | 05-strange-attractors 16 | 06-random-generators 17 | -------------------------------------------------------------------------------- /docs/_sources/examples/x04-soundfiles/01-read-from-disk.rst.txt: -------------------------------------------------------------------------------- 1 | 01-read-from-disk.py - Soundfile playback from disk. 2 | ============================================================================================================================================ 3 | 4 | 5 | SfPlayer and friends read samples from a file on disk with control 6 | over playback speed and looping mode. 7 | 8 | Player family: 9 | - **SfPlayer** : Reads many soundfile formats from disk. 10 | - **SfMarkerLooper** : AIFF/WAVE with markers soundfile looper. 11 | - **SfMarkerShuffler** : AIFF/WAVE with markers soundfile shuffler. 12 | 13 | Reading sound file from disk can save a lot of RAM, especially if 14 | the soundfile is big, but it is more CPU expensive than loading 15 | the sound file in memory in a first pass. 16 | 17 | .. code-block:: python 18 | 19 | from pyo import * 20 | 21 | s = Server().boot() 22 | 23 | path = SNDS_PATH + "/transparent.aif" 24 | 25 | # stereo playback with a slight shift between the two channels. 26 | sf = SfPlayer(path, speed=[1, 0.995], loop=True, mul=0.4).out() 27 | 28 | s.gui(locals()) 29 | 30 | -------------------------------------------------------------------------------- /docs/_sources/examples/x04-soundfiles/03-read-from-ram.rst.txt: -------------------------------------------------------------------------------- 1 | 03-read-from-ram.py - Soundfile playback from RAM. 2 | ============================================================================================================================================ 3 | 4 | 5 | Reading a sound file from the RAM gives the advantage of a very 6 | fast access to every loaded samples. This is very useful for a 7 | lot of processes, such as granulation, looping, creating envelopes 8 | and waveforms and many others. 9 | 10 | The simplest way of loading a sound in RAM is to use the SndTable 11 | object. This example loads a sound file and reads it in loop. 12 | We will see some more evolved processes later... 13 | 14 | .. code-block:: python 15 | 16 | from pyo import * 17 | 18 | s = Server().boot() 19 | 20 | path = SNDS_PATH + "/transparent.aif" 21 | 22 | # Loads the sound file in RAM. Beginning and ending points 23 | # can be controlled with "start" and "stop" arguments. 24 | t = SndTable(path) 25 | 26 | # Gets the frequency relative to the table length. 27 | freq = t.getRate() 28 | 29 | # Simple stereo looping playback (right channel is 180 degrees out-of-phase). 30 | osc = Osc(table=t, freq=freq, phase=[0, 0.5], mul=0.4).out() 31 | 32 | s.gui(locals()) 33 | 34 | -------------------------------------------------------------------------------- /docs/_sources/examples/x04-soundfiles/index.rst.txt: -------------------------------------------------------------------------------- 1 | x04-soundfiles 2 | ======================================== 3 | 4 | 5 | 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | 01-read-from-disk 12 | 02-read-from-disk-2 13 | 03-read-from-ram 14 | 04-record-perf 15 | 05-record-streams 16 | 06-record-table 17 | -------------------------------------------------------------------------------- /docs/_sources/examples/x05-envelopes/01-data-signal-conversion.rst.txt: -------------------------------------------------------------------------------- 1 | 01-data-signal-conversion.py - Conversion from number to audio stream. 2 | ============================================================================================================================================ 3 | 4 | 5 | The Stream object is a new type introduced by pyo to represent an 6 | audio signal as a vector of floats. It is sometimes useful to be 7 | able to convert simple numbers (python's floats or integers) to 8 | audio signal or to extract numbers from an audio stream. 9 | 10 | The Sig object converts a number to an audio stream. 11 | 12 | The PyoObject.get() method extracts a float from an audio stream. 13 | 14 | .. code-block:: python 15 | 16 | from pyo import * 17 | 18 | s = Server().boot() 19 | 20 | # A python integer (or float). 21 | anumber = 100 22 | 23 | # Conversion from number to an audio stream (vector of floats). 24 | astream = Sig(anumber) 25 | 26 | # Use a Print (capital "P") object to print an audio stream. 27 | pp = Print(astream, interval=0.1, message="Audio stream value") 28 | 29 | # Use the get() method to extract a float from an audio stream. 30 | print("Float from audio stream : ", astream.get()) 31 | 32 | s.gui(locals()) 33 | 34 | -------------------------------------------------------------------------------- /docs/_sources/examples/x05-envelopes/03-exponential-ramp.rst.txt: -------------------------------------------------------------------------------- 1 | 03-exponential-ramp.py - Exponential portamento with rising and falling times. 2 | ============================================================================================================================================ 3 | 4 | 5 | The Port object is designed to filter an audio signal with 6 | different coefficients for rising and falling signals. A lowpass 7 | filter is a good and efficient way of creating an exponential ramp 8 | from a signal containing abrupt changes. The rising and falling 9 | coefficients are controlled in seconds. 10 | 11 | .. code-block:: python 12 | 13 | from pyo import * 14 | 15 | s = Server().boot() 16 | 17 | # 2 seconds linear ramp starting at 0.0 and ending at 0.3. 18 | amp = SigTo(value=0.3, time=2.0, init=0.0) 19 | 20 | # Pick a new value four times per second. 21 | pick = Choice([200, 250, 300, 350, 400], freq=4) 22 | 23 | # Print the chosen frequency 24 | pp = Print(pick, method=1, message="Frequency") 25 | 26 | # Add an exponential portamento on an audio target and detune a second frequency. 27 | # Sharp attack for rising notes and long release for falling notes. 28 | freq = Port(pick, risetime=0.001, falltime=0.25, mul=[1, 1.005]) 29 | # Play with portamento times. 30 | freq.ctrl() 31 | 32 | # Play a simple wave. 33 | sig = RCOsc(freq, sharp=0.7, mul=amp).out() 34 | 35 | s.gui(locals()) 36 | 37 | -------------------------------------------------------------------------------- /docs/_sources/examples/x05-envelopes/index.rst.txt: -------------------------------------------------------------------------------- 1 | x05-envelopes 2 | ======================================== 3 | 4 | 5 | 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | 01-data-signal-conversion 12 | 02-linear-ramp 13 | 03-exponential-ramp 14 | 04-simple-envelopes 15 | 05-breakpoints-functions 16 | -------------------------------------------------------------------------------- /docs/_sources/examples/x06-filters/02-bandpass-filters.rst.txt: -------------------------------------------------------------------------------- 1 | 02-bandpass-filters.py - Narrowing a bandpass filter bandwidth. 2 | ============================================================================================================================================ 3 | 4 | 5 | This example illustrates the difference between a simple IIR second-order 6 | bandpass filter and a cascade of second-order bandpass filters. A cascade 7 | of four bandpass filters with a high Q can be used as a efficient resonator 8 | on the signal. 9 | 10 | .. code-block:: python 11 | 12 | from pyo import * 13 | 14 | s = Server().boot() 15 | 16 | # White noise generator 17 | n = Noise(0.5) 18 | 19 | # Common cutoff frequency control 20 | freq = Sig(1000) 21 | freq.ctrl([SLMap(50, 5000, "lin", "value", 1000)], title="Cutoff Frequency") 22 | 23 | # Common filter's Q control 24 | q = Sig(5) 25 | q.ctrl([SLMap(0.7, 20, "log", "value", 5)], title="Filter's Q") 26 | 27 | # Second-order bandpass filter 28 | bp1 = Reson(n, freq, q=q) 29 | # Cascade of second-order bandpass filters 30 | bp2 = Resonx(n, freq, q=q, stages=4) 31 | 32 | # Interpolates between input objects to produce a single output 33 | sel = Selector([bp1, bp2]).out() 34 | sel.ctrl(title="Filter selector (0=Reson, 1=Resonx)") 35 | 36 | # Displays the spectrum contents of the chosen source 37 | sp = Spectrum(sel) 38 | 39 | s.gui(locals()) 40 | 41 | -------------------------------------------------------------------------------- /docs/_sources/examples/x06-filters/03-complex-resonator.rst.txt: -------------------------------------------------------------------------------- 1 | 03-complex-resonator.py - Filtering by mean of a complex multiplication. 2 | ============================================================================================================================================ 3 | 4 | 5 | ComplexRes implements a resonator derived from a complex 6 | multiplication, which is very similar to a digital filter. 7 | 8 | It is used here to create a rhythmic chime with varying resonance. 9 | 10 | .. code-block:: python 11 | 12 | from pyo import * 13 | import random 14 | 15 | s = Server().boot() 16 | 17 | # Six random frequencies. 18 | freqs = [random.uniform(1000, 3000) for i in range(6)] 19 | 20 | # Six different plucking speeds. 21 | pluck = Metro([0.9, 0.8, 0.6, 0.4, 0.3, 0.2]).play() 22 | 23 | # LFO applied to the decay of the resonator. 24 | decay = Sine(0.1).range(0.01, 0.15) 25 | 26 | # Six ComplexRes filters. 27 | rezos = ComplexRes(pluck, freqs, decay, mul=5).out() 28 | 29 | # Change chime frequencies every 7.2 seconds 30 | def new(): 31 | freqs = [random.uniform(1000, 3000) for i in range(6)] 32 | rezos.freq = freqs 33 | 34 | 35 | pat = Pattern(new, 7.2).play() 36 | 37 | s.gui(locals()) 38 | 39 | -------------------------------------------------------------------------------- /docs/_sources/examples/x06-filters/index.rst.txt: -------------------------------------------------------------------------------- 1 | x06-filters 2 | ======================================== 3 | 4 | 5 | 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | 01-lowpass-filters 12 | 02-bandpass-filters 13 | 03-complex-resonator 14 | 04-phasing 15 | 05-convolution-filters 16 | 06-vocoder 17 | 07-hilbert-transform 18 | -------------------------------------------------------------------------------- /docs/_sources/examples/x07-effects/index.rst.txt: -------------------------------------------------------------------------------- 1 | x07-effects 2 | ======================================== 3 | 4 | 5 | 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | 01-flanger 12 | 02-schroeder-reverb 13 | 03-fuzz-disto 14 | 04-ping-pong-delay 15 | 05-hand-made-chorus 16 | 06-hand-made-harmonizer 17 | -------------------------------------------------------------------------------- /docs/_sources/examples/x08-dynamics/03-gated-verb.rst.txt: -------------------------------------------------------------------------------- 1 | 03-gated-verb.py - Gated reverb applied to a drum loop. 2 | ============================================================================================================================================ 3 | 4 | 5 | The gated reverb effect, which was most popular in the 1980s, is made using a 6 | combination of strong reverb and a noise gate. The drum sound passes through 7 | a strong reverb, which is rapidly cut off with a gate driven by the dry signal. 8 | 9 | .. code-block:: python 10 | 11 | from pyo import * 12 | 13 | s = Server().boot() 14 | 15 | # Play the drum loop. 16 | sf = SfPlayer("../snds/drumloop.wav", loop=True) 17 | 18 | # Use a gate to generate the gain curve that will be applied to the reverb. 19 | gate = Gate(sf, thresh=-50, risetime=0.005, falltime=0.04, lookahead=4, outputAmp=True) 20 | 21 | # Strong reverb. 22 | rev = Freeverb(sf.mix(2), size=0.95, damp=0.3, bal=1.0) 23 | 24 | # Compress the reverb signal and control its amplitude with the gating signal. 25 | cmp = Compress(rev, thresh=-12, ratio=3, risetime=0.005, falltime=0.05, lookahead=4, knee=0.5, mul=gate,) 26 | 27 | # Balance between the dry and wet (gated-reverb) signals. 28 | output = Interp(sf.mix(2), cmp, interp=0.2).out() 29 | 30 | s.gui(locals()) 31 | 32 | -------------------------------------------------------------------------------- /docs/_sources/examples/x08-dynamics/04-rms-tracing.rst.txt: -------------------------------------------------------------------------------- 1 | 04-rms-tracing.py - Auto-wah effect. 2 | ============================================================================================================================================ 3 | 4 | 5 | The auto-wah effect (also know as "envelope following filter") is like a 6 | wah-wah effect, but instead of being controlled by a pedal, it is the RMS 7 | amplitude of the input sound which control it. The envelope follower (RMS) 8 | is rescaled and used to change the frequency of a bandpass filter applied 9 | to the source. 10 | 11 | .. code-block:: python 12 | 13 | from pyo import * 14 | 15 | s = Server().boot() 16 | 17 | MINFREQ = 250 18 | MAXFREQ = 5000 19 | 20 | # Play the drum loop. 21 | sf = SfPlayer("../snds/drumloop.wav", loop=True) 22 | 23 | # Follow the amplitude envelope of the input sound. 24 | follow = Follower(sf) 25 | 26 | # Scale the amplitude envelope (0 -> 1) to the desired frequency 27 | # range (MINFREQ -> MAXFREQ). 28 | freq = Scale(follow, outmin=MINFREQ, outmax=MAXFREQ) 29 | 30 | # Filter the signal with a band pass. Play with the Q to make the 31 | # effect more or less present. 32 | filter = ButBP(sf.mix(2), freq=freq, q=2).out() 33 | 34 | s.gui(locals()) 35 | 36 | -------------------------------------------------------------------------------- /docs/_sources/examples/x08-dynamics/index.rst.txt: -------------------------------------------------------------------------------- 1 | x08-dynamics 2 | ======================================== 3 | 4 | 5 | 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | 01-dynamic-range 12 | 02-ducking 13 | 03-gated-verb 14 | 04-rms-tracing 15 | -------------------------------------------------------------------------------- /docs/_sources/examples/x09-callbacks/index.rst.txt: -------------------------------------------------------------------------------- 1 | x09-callbacks 2 | ======================================== 3 | 4 | 5 | 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | 01-periodic-calls 12 | 02-score-calls 13 | 03-delayed-calls 14 | -------------------------------------------------------------------------------- /docs/_sources/examples/x10-tables/09-partial-table.rst.txt: -------------------------------------------------------------------------------- 1 | 09-partial-table.py - Store out-of-tune harmonics in a table 2 | ============================================================================================================================================ 3 | . 4 | 5 | .. code-block:: python 6 | 7 | import random 8 | from pyo import * 9 | 10 | s = Server().boot() 11 | 12 | harms = [(0.57, 0.67), (1.92, 1), (3.19, 2.67), 13 | (4.7, 1.67), (5, 1.46), (6.74, 1.33), (7, 1.33), (9.76, 1), (11.07, 1.33)] 14 | 15 | t = PartialTable(list=harms, size=65536) 16 | t.normalize() 17 | t.view() 18 | 19 | f = Fader(fadein=0.005, fadeout=10, dur=10.1) 20 | f.setExp(6) 21 | 22 | a = Osc(t, freq=[1, 1], mul=f*0.4) 23 | b = ButLP(a, freq=0, mul=[1, 1]).out() 24 | 25 | def play(): 26 | freq = midiToHz(36) * random.uniform(0.99, 1.01) 27 | a.freq = freq / 100 28 | b.freq = f * freq * 8 + freq 29 | f.play() 30 | 31 | pat = Pattern(function=play, time=1).play() 32 | 33 | s.gui(locals()) 34 | 35 | -------------------------------------------------------------------------------- /docs/_sources/examples/x10-tables/index.rst.txt: -------------------------------------------------------------------------------- 1 | x10-tables 2 | ======================================== 3 | 4 | 5 | 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | 01-envelopes 12 | 02-scrubbing 13 | 03-looping 14 | 04-granulation 15 | 05-micro-montage 16 | 06-table-stutter 17 | 07-moving-points 18 | 08-table-lookup 19 | -------------------------------------------------------------------------------- /docs/_sources/examples/x14-spectral/index.rst.txt: -------------------------------------------------------------------------------- 1 | x14-spectral 2 | ======================================== 3 | 4 | Sound processing in the spectral domain. 5 | 6 | **FFT** 7 | 8 | A Fast Fourier Transform (FFT) is an efficient algorithm to compute the discrete Fourier transform (DFT) and its inverse (IFFT). 9 | 10 | **Phase Vocoder** 11 | 12 | The phase vocoder is a digital signal processing technique of potentially great musical significance. 13 | It can be used to perform very high fidelity time scaling, pitch transposition, and myriad other modifications of sounds. 14 | 15 | Although the following examples are built by hand with raw FFT objects, for educational purposes, most of these 16 | processes (and more) are implemented, with greater efficiency, with the Phase Vocoder algorithm. You should 17 | really take a look at the different PV object's examples in the documentation. 18 | 19 | 20 | 21 | .. toctree:: 22 | :maxdepth: 1 23 | 24 | 01-fft-filter 25 | 02-fft-cross-synth 26 | 03-fft-morphing 27 | 04-fft-spectral-delay 28 | 05-fft-time-stretch 29 | -------------------------------------------------------------------------------- /docs/_sources/examples/x15-matrix/04-algo-with-matrix.rst.txt: -------------------------------------------------------------------------------- 1 | 04-algo-with-matrix.py - MIDI algorithm with a 2D matrix. 2 | ============================================================================================================================================ 3 | 4 | 5 | This script demonstrates how to use a matrix to do some algorithmic generation of notes. 6 | 7 | .. code-block:: python 8 | 9 | from pyo import * 10 | 11 | s = Server(duplex=0, audio="jack").boot() 12 | 13 | # Matrix of 4 rows of 4 MIDI notes each. 14 | mat = [ 15 | [36, 41, 43, 48], 16 | [48, 51, 53, 57], 17 | [60, 62, 67, 68], 18 | [70, 72, 74, 77] 19 | ] 20 | 21 | notes = NewMatrix(4, 4, mat) 22 | 23 | # X position is chosen randomly (2 audio streams for a stereo output). 24 | x = RandInt(max=4, freq=[4, 8], mul=0.25) 25 | 26 | # Y position is a simple metronomic count from 0 to 3 (again 2 audio streams). 27 | met = Metro(time=[0.5, 1]).play() 28 | y = Counter(input=met, min=0, max=4, mul=0.25) 29 | 30 | # Pick MIDI notes in the matrix. 31 | midi = MatrixPointer(matrix=notes, x=x, y=y) 32 | 33 | # Converts MIDI notes to frequencies. 34 | freq = [MToF(midi[0] - 12), MToF(midi[1])] 35 | 36 | # Simple synthesizer. 37 | synth = LFO(freq=freq, sharp=0.75, type=2, mul=0.25) 38 | chorus = Chorus(synth).out() 39 | 40 | s.gui(locals()) 41 | 42 | -------------------------------------------------------------------------------- /docs/_sources/examples/x15-matrix/index.rst.txt: -------------------------------------------------------------------------------- 1 | x15-matrix 2 | ======================================== 3 | 4 | 5 | 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | 01-wave-terrain-synthesis 12 | 02-matrix-record 13 | 03-record-loop-chunks 14 | 04-algo-with-matrix 15 | -------------------------------------------------------------------------------- /docs/_sources/examples/x16-midi/index.rst.txt: -------------------------------------------------------------------------------- 1 | x16-midi 2 | ======================================== 3 | 4 | 5 | 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | 01-midi-scan 12 | 02-notein-object 13 | 03-midi-envelope 14 | 04-simple-midi-synth 15 | 05-control-change 16 | 06-midi-out 17 | 07-midifile-with-mido 18 | -------------------------------------------------------------------------------- /docs/_sources/examples/x17-osc/01-osc-scan.rst.txt: -------------------------------------------------------------------------------- 1 | 01-osc-scan.py - Scan Open Sound Control inputs on a specific port 2 | ============================================================================================================================================ 3 | 4 | 5 | Scan Open Sound Control inputs on a specific port. This program 6 | can be used to find the address used by a specific device or the 7 | range of values sent on a given address. 8 | 9 | .. code-block:: python 10 | 11 | from pyo import * 12 | 13 | # Set the port number. 14 | port = 9002 15 | 16 | s = Server().boot().start() 17 | 18 | print("Play with your OSC interface...") 19 | 20 | # Function called whenever OscDataReceive receives an input. 21 | def printInputMessage(address, *args): 22 | print("Address =", address) 23 | print("Values =", args) 24 | print("---------------") 25 | 26 | 27 | # OscDataReceive accepts any kind of OSC message. 28 | # The wildcard alone ("*") to the address argument means that 29 | # the object will monitor any address on the port. 30 | scan = OscDataReceive(port=port, address="*", function=printInputMessage) 31 | 32 | s.gui(locals()) 33 | 34 | -------------------------------------------------------------------------------- /docs/_sources/examples/x17-osc/03-send-streams.rst.txt: -------------------------------------------------------------------------------- 1 | 03-send-streams.py - Sending audio streams as Open Sound Control messages 2 | ============================================================================================================================================ 3 | 4 | 5 | This program does not generate any sound. All it does is to produce 6 | audio streams that are then send on an open port as OSC messages in 7 | order to control a granulation process created in the example 8 | *02-receive-streams.py*. 9 | 10 | .. code-block:: python 11 | 12 | from pyo import * 13 | 14 | s = Server().boot() 15 | 16 | # Manual control of the density of grains per second. 17 | dens = Sig(0.5) 18 | dens.ctrl(title="Density of grains per second") 19 | 20 | # Generate a normalized random position in the sound with interpolation. 21 | pos = Randi(min=0.00, max=1.00, freq=0.1) 22 | 23 | # Manual control of the transposition per grain. 24 | pit = Sig(0) 25 | pit.ctrl(title="Transposition per grain") 26 | 27 | # Manual control of the grain's duration. 28 | dur = Sig(0.5) 29 | dur.ctrl(title="Grain duration") 30 | 31 | # Takes audio signals and sends their current value as OSC messages every buffer size. 32 | send = OscSend( 33 | input=[dens, pos, pit, dur], 34 | port=9000, 35 | address=["/density", "/position", "/pitch_rand", "/duration"], 36 | host="127.0.0.1", 37 | ) 38 | 39 | s.gui(locals()) 40 | 41 | -------------------------------------------------------------------------------- /docs/_sources/examples/x17-osc/04-receive-list.rst.txt: -------------------------------------------------------------------------------- 1 | 04-receive-list.py - Receiving OSC messages as list of audio streams 2 | ============================================================================================================================================ 3 | 4 | 5 | OscListReceive receives list of values over a network via the Open Sound 6 | Control protocol. It converts the values as audio streams that can be used 7 | to control audio process. 8 | 9 | .. code-block:: python 10 | 11 | from pyo import * 12 | 13 | s = Server().boot() 14 | 15 | source = SfPlayer("../snds/flute.aif", loop=True, mul=0.7) 16 | 17 | # Receives a list of two values from a TouchOSC's XY pad and converts 18 | # them as audio streams. All streams for a given address can be retrieve 19 | # with the syntax: rec[address]. One can access the individual streams 20 | # for an address with slicing: rec[address][0], rec[address][1], etc. 21 | rec = OscListReceive(port=9002, address="/4/xy", num=2) 22 | 23 | # Sets initial values for the OSC streams. This allow the program to run with 24 | # minimal behavior even if no message have been sent on this address. 25 | rec.setValue("/4/xy", [0.5, 0.5]) 26 | 27 | # Assign the value on the X axis to the drive parameter, and 28 | # the value on the Y axis to the slope (lowpass filter) parameter. 29 | disto = Disto(source, drive=Sqrt(rec["/4/xy"][0]), slope=Sqrt(rec["/4/xy"][1]), mul=0.5).mix(2).out() 30 | 31 | s.gui(locals()) 32 | 33 | -------------------------------------------------------------------------------- /docs/_sources/examples/x17-osc/index.rst.txt: -------------------------------------------------------------------------------- 1 | x17-osc 2 | ======================================== 3 | 4 | 5 | 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | 01-osc-scan 12 | 02-receive-streams 13 | 03-send-streams 14 | 04-receive-list 15 | 05-send-receive-data 16 | -------------------------------------------------------------------------------- /docs/_sources/examples/x19-multirate/index.rst.txt: -------------------------------------------------------------------------------- 1 | x19-multirate 2 | ======================================== 3 | 4 | 5 | 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | 01-multi-rate-processing 12 | 02-multi-rate-synthesis 13 | -------------------------------------------------------------------------------- /docs/_sources/examples/x20-multicore/index.rst.txt: -------------------------------------------------------------------------------- 1 | x20-multicore 2 | ======================================== 3 | 4 | 5 | 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | 01-processes-spawning 12 | 02-sharing-audio 13 | 03-synchronization 14 | 04-data-control 15 | -------------------------------------------------------------------------------- /docs/_sources/examples/x21-utilities/01-list-to-audio-file.rst.txt: -------------------------------------------------------------------------------- 1 | 01-list-to-audio-file.py - Saving list of floats to audio file on disk 2 | ============================================================================================================================================ 3 | 4 | 5 | This program generates 5 seconds of white noise with pure python function 6 | and saves the samples in a file called noise.aif on the Desktop. 7 | 8 | .. code-block:: python 9 | 10 | from pyo import savefile 11 | from random import uniform 12 | import os 13 | 14 | # Create the path for the audio file. 15 | home = os.path.expanduser("~") 16 | path = os.path.join(home, "Desktop", "noise.aif") 17 | 18 | # Audio file properties (sampling rate, duration and number of channels). 19 | sr = 44100 20 | dur = 5 21 | chnls = 2 22 | 23 | # Generate a list of `chnls` sub-lists with `sr * dur` floats in each of them. 24 | samples = [[uniform(-0.5, 0.5) for i in range(sr * dur)] for i in range(chnls)] 25 | 26 | # Save the list of floats in an audio file on disk. 27 | savefile(samples=samples, path=path, sr=sr, channels=chnls, fileformat=1, sampletype=1) 28 | 29 | -------------------------------------------------------------------------------- /docs/_sources/examples/x21-utilities/index.rst.txt: -------------------------------------------------------------------------------- 1 | x21-utilities 2 | ======================================== 3 | 4 | 5 | 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | 01-list-to-audio-file 12 | 02-get-method 13 | 03-set-method 14 | 04-buffer-interface 15 | 05-batch-processing 16 | 06-batch-synthesis 17 | 07-upsamp-processing 18 | 08-multiple-threads 19 | 09-audio-mixer 20 | -------------------------------------------------------------------------------- /docs/_sources/examples/x22-events/06-randoms.rst.txt: -------------------------------------------------------------------------------- 1 | 06-randoms.py - Exploring random generators. 2 | ============================================================================================================================================ 3 | 4 | 5 | This example presents two more generators that randomly choose values. 6 | 7 | **EventChoice** :: 8 | 9 | EventChoice(values, occurrences=inf, stopEventsWhenDone=True) 10 | 11 | EventChoice randomly pick a new value in a list of possible values. 12 | 13 | **EventDrunk** :: 14 | 15 | EventDrunk(values, maxStep=2, occurrences=inf, stopEventsWhenDone=True) 16 | 17 | EventDrunk performs a random walk over a list of values. The 'maxStep' 18 | argument determine the larger step in the list the walk can do between 19 | two successive events. A negative 'maxStep' is the same but repetition 20 | are not allowed. 21 | 22 | .. code-block:: python 23 | 24 | from pyo import * 25 | 26 | s = Server().boot() 27 | 28 | scl = [5.00, 5.02, 5.03, 5.05, 5.07, 5.08, 5.10, 6.00, 6.02, 6.03, 6.05, 6.07] 29 | 30 | # Random walk for the melody. 31 | e1 = Events( 32 | degree=EventDrunk(scl, maxStep=-2), beat=1 / 4.0, db=-6, attack=0.001, decay=0.05, sustain=0.5, release=0.005, 33 | ).play() 34 | 35 | # Choose randomly for the bass. 36 | e2 = Events( 37 | degree=EventChoice(scl), beat=1, db=-6, transpo=-12, attack=0.001, decay=0.05, sustain=0.5, release=0.005, 38 | ).play() 39 | 40 | s.gui(locals()) 41 | 42 | -------------------------------------------------------------------------------- /docs/_sources/examples/x22-events/index.rst.txt: -------------------------------------------------------------------------------- 1 | x22-events 2 | ======================================== 3 | 4 | 5 | 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | 01-simple-sequences 12 | 02-parameters 13 | 03-instruments 14 | 04-custom-params 15 | 05-complex-sequences 16 | 06-randoms 17 | 07-managing-scales 18 | 08-function-calls 19 | 09-embedding-generators 20 | 10-arithmetic-ops 21 | 11-filters 22 | 12-sharing-values 23 | 13-using-audio-objects 24 | 14-post-processing 25 | -------------------------------------------------------------------------------- /docs/_sources/examples/x23-expression/index.rst.txt: -------------------------------------------------------------------------------- 1 | x23-expression 2 | ======================================== 3 | 4 | 5 | 6 | 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | 01-simple-expression 12 | 02-audio-in 13 | 03-multiple-inputs 14 | 04-let-function 15 | 05-define-function 16 | 06-var-function 17 | 07-condition 18 | 08-load-function 19 | 09-multiple-outputs 20 | -------------------------------------------------------------------------------- /docs/_sources/index.rst.txt: -------------------------------------------------------------------------------- 1 | .. Pyo documentation master file, created by 2 | sphinx-quickstart on Thu May 16 15:35:44 2013. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to the pyo 1.0.6 documentation 7 | =================================================== 8 | 9 | .. image:: _static/E-PyoIcon.png 10 | :scale: 50 % 11 | :align: center 12 | 13 | Pyo is a Python module written in C to help digital signal processing script 14 | creation. It provides a complete set of classes to build audio softwares, 15 | compose algorithmic musics or simply explore audio processing with a simple, 16 | mature and powerful programming language. 17 | 18 | Parts of the documentation 19 | -------------------------- 20 | 21 | .. toctree:: 22 | :maxdepth: 1 23 | 24 | about 25 | download 26 | compiling 27 | structure 28 | gettingstarted 29 | winaudioinspect 30 | perftips 31 | 32 | .. toctree:: 33 | :maxdepth: 2 34 | 35 | api/index 36 | 37 | examples/index 38 | 39 | tutorials/index 40 | 41 | Indices and tables 42 | ------------------ 43 | 44 | * :ref:`genindex` 45 | * :ref:`search` 46 | 47 | -------------------------------------------------------------------------------- /docs/_sources/structure.rst.txt: -------------------------------------------------------------------------------- 1 | Structure of the library 2 | ========================== 3 | 4 | This diagram shows the internal structure of the library. 5 | 6 | .. image:: _static/structure.png 7 | :scale: 33 8 | :align: center 9 | -------------------------------------------------------------------------------- /docs/_sources/tutorials/index.rst.txt: -------------------------------------------------------------------------------- 1 | Advanced tutorials 2 | =============================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | pyoobject1 8 | pyoobject2 9 | pyotableobject1 10 | 11 | -------------------------------------------------------------------------------- /docs/_static/E-PyoIcon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/docs/_static/E-PyoIcon.ico -------------------------------------------------------------------------------- /docs/_static/E-PyoIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/docs/_static/E-PyoIcon.png -------------------------------------------------------------------------------- /docs/_static/autoclasstoc.css: -------------------------------------------------------------------------------- 1 | .autoclasstoc table.docutils td>p { 2 | margin-bottom: 0 !important; 3 | } 4 | 5 | .autoclasstoc details:last-of-type { 6 | margin-bottom: 18px; 7 | } 8 | 9 | .autoclasstoc .wy-table-responsive { 10 | margin-bottom: 12px; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /docs/_static/bgfooter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/docs/_static/bgfooter.png -------------------------------------------------------------------------------- /docs/_static/bgtop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/docs/_static/bgtop.png -------------------------------------------------------------------------------- /docs/_static/documentation_options.js: -------------------------------------------------------------------------------- 1 | const DOCUMENTATION_OPTIONS = { 2 | VERSION: '1.0.6', 3 | LANGUAGE: 'en', 4 | COLLAPSE_INDEX: false, 5 | BUILDER: 'html', 6 | FILE_SUFFIX: '.html', 7 | LINK_SUFFIX: '.html', 8 | HAS_SOURCE: true, 9 | SOURCELINK_SUFFIX: '.txt', 10 | NAVIGATION_WITH_KEYS: false, 11 | SHOW_SEARCH_SUMMARY: true, 12 | ENABLE_SEARCH_SHORTCUTS: true, 13 | }; -------------------------------------------------------------------------------- /docs/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/docs/_static/file.png -------------------------------------------------------------------------------- /docs/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/docs/_static/minus.png -------------------------------------------------------------------------------- /docs/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/docs/_static/plus.png -------------------------------------------------------------------------------- /docs/_static/sphinx-codeautolink.css: -------------------------------------------------------------------------------- 1 | .sphinx-codeautolink-a{ 2 | color: inherit; 3 | text-decoration: none; 4 | } 5 | .sphinx-codeautolink-a:link{ 6 | color: inherit; 7 | } 8 | .sphinx-codeautolink-a:visited{ 9 | color: inherit; 10 | } 11 | .sphinx-codeautolink-a:hover{ 12 | color: rgb(0, 139, 139); 13 | } 14 | -------------------------------------------------------------------------------- /docs/_static/structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/docs/_static/structure.png -------------------------------------------------------------------------------- /docs/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/docs/objects.inv -------------------------------------------------------------------------------- /documentation/source/_static/E-PyoIcon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/documentation/source/_static/E-PyoIcon.ico -------------------------------------------------------------------------------- /documentation/source/_static/E-PyoIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/documentation/source/_static/E-PyoIcon.png -------------------------------------------------------------------------------- /documentation/source/_static/structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/documentation/source/_static/structure.png -------------------------------------------------------------------------------- /documentation/source/about.rst: -------------------------------------------------------------------------------- 1 | About pyo 2 | ================= 3 | 4 | Pyo is a Python module written in C to help digital signal processing script 5 | creation. It provides a complete set of classes to build audio softwares, 6 | compose algorithmic musics or simply explore audio processing with a simple, 7 | mature and powerful programming language. 8 | 9 | Pyo contains 10 | classes for a wide variety of audio signal processing. With pyo, the user will 11 | be able to include signal processing chains directly in Python scripts or 12 | projects, and to manipulate them in real time through the interpreter. Tools 13 | in the pyo module offer primitives, like mathematical operations on audio 14 | signals, basic signal processing (filters, delays, synthesis generators, etc.), 15 | but also complex algorithms to create sound granulation and other creative 16 | audio manipulations. pyo supports the OSC protocol (Open Sound Control) to ease 17 | communications between softwares, and the MIDI protocol for generating sound 18 | events and controlling process parameters. pyo allows the creation of 19 | sophisticated signal processing chains with all the benefits of a mature and 20 | widely used general programming language. 21 | 22 | Pyo is developed by Olivier Bélanger < belangeo@gmail.com > 23 | 24 | For questions and comments, please subscribe to the 25 | `discussions `_ list on github. 26 | 27 | To report a bug or to request a feature, use the 28 | `issues tracker `_ on github. 29 | -------------------------------------------------------------------------------- /documentation/source/api/classes/_core.rst: -------------------------------------------------------------------------------- 1 | Base Classes 2 | ====================================== 3 | 4 | .. currentmodule:: pyo 5 | 6 | Here are defined the base classes implementing common behaviors for 7 | the different kinds of objects in the library. 8 | 9 | Objects in this category 10 | ------------------------------ 11 | 12 | - :py:class:`PyoObjectBase` : Base class for all pyo objects. 13 | - :py:class:`PyoObject` : Base class for all pyo objects that manipulate vectors of samples. 14 | - :py:class:`PyoTableObject` : Base class for all pyo table objects. 15 | - :py:class:`PyoMatrixObject` : Base class for all pyo matrix objects. 16 | - :py:class:`PyoPVObject` : Base class for objects working with phase vocoder’s magnitude and frequency streams. 17 | 18 | *PyoObjectBase* 19 | -------------------------------------- 20 | 21 | .. autoclass:: PyoObjectBase 22 | :members: 23 | 24 | .. autoclasstoc:: 25 | 26 | *PyoObject* 27 | -------------------------------------- 28 | 29 | .. autoclass:: PyoObject 30 | :members: 31 | 32 | .. autoclasstoc:: 33 | 34 | *PyoTableObject* 35 | -------------------------------------- 36 | 37 | .. autoclass:: PyoTableObject 38 | :members: 39 | 40 | .. autoclasstoc:: 41 | 42 | *PyoMatrixObject* 43 | -------------------------------------- 44 | 45 | .. autoclass:: PyoMatrixObject 46 | :members: 47 | 48 | .. autoclasstoc:: 49 | 50 | *PyoPVObject* 51 | -------------------------------------- 52 | 53 | .. autoclass:: PyoPVObject 54 | :members: 55 | 56 | .. autoclasstoc:: 57 | 58 | -------------------------------------------------------------------------------- /documentation/source/api/classes/index.rst: -------------------------------------------------------------------------------- 1 | Classes by category 2 | =============================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | server 8 | listener 9 | _core 10 | analysis 11 | arithmetic 12 | controls 13 | dynamics 14 | effects 15 | events 16 | expression 17 | filters 18 | fourier 19 | pvoc 20 | generators 21 | internals 22 | matrixprocess 23 | midi 24 | mmlmusic 25 | opensndctrl 26 | pan 27 | pattern 28 | players 29 | randoms 30 | tableprocess 31 | triggers 32 | utils 33 | tables 34 | matrices 35 | map 36 | wxgui 37 | 38 | -------------------------------------------------------------------------------- /documentation/source/api/classes/listener.rst: -------------------------------------------------------------------------------- 1 | Controller listeners 2 | =================================== 3 | 4 | .. currentmodule:: pyo 5 | 6 | These objects can be used to create MIDI and/or OSC listeners without the 7 | need to boot ands start an audio server before receiving messages. 8 | 9 | Objects in this category 10 | ------------------------------ 11 | 12 | - :py:class:`MidiListener` : Self-contained midi listener thread. 13 | - :py:class:`MidiDispatcher` : Self-contained midi dispatcher thread. 14 | - :py:class:`OscListener` : Self-contained OSC listener thread. 15 | 16 | *MidiListener* 17 | ----------------------------------- 18 | 19 | .. autoclass:: MidiListener 20 | :members: 21 | 22 | .. autoclasstoc:: 23 | 24 | *MidiDispatcher* 25 | ----------------------------------- 26 | 27 | .. autoclass:: MidiDispatcher 28 | :members: 29 | 30 | .. autoclasstoc:: 31 | 32 | *OscListener* 33 | ----------------------------------- 34 | 35 | .. autoclass:: OscListener 36 | :members: 37 | 38 | .. autoclasstoc:: 39 | -------------------------------------------------------------------------------- /documentation/source/api/classes/matrices.rst: -------------------------------------------------------------------------------- 1 | Matrices 2 | =================================== 3 | 4 | .. currentmodule:: pyo 5 | 6 | Objects in this category 7 | ------------------------------ 8 | 9 | - :py:class:`NewMatrix` : Create a new matrix ready for recording. 10 | 11 | Matrices are two-dimensions containers to keep samples (sounds, envelopes, algorithmic patterns, images, etc.) 12 | in memory and access them quickly. 13 | 14 | *NewMatrix* 15 | ----------------------------------- 16 | 17 | .. autoclass:: NewMatrix 18 | :members: 19 | 20 | .. autoclasstoc:: 21 | 22 | -------------------------------------------------------------------------------- /documentation/source/api/classes/matrixprocess.rst: -------------------------------------------------------------------------------- 1 | Matrix Processing 2 | =================================== 3 | 4 | .. currentmodule:: pyo 5 | 6 | PyoObjects to perform operations on PyoMatrixObjects. 7 | 8 | PyoMatrixObjects are 2 dimensions table containers. They can be used 9 | to store audio samples or algorithmic sequences. Writing and reading 10 | are done by giving row and column positions. 11 | 12 | Objects in this category 13 | ------------------------------ 14 | 15 | - :py:class:`MatrixMorph` : Morphs between multiple PyoMatrixObjects. 16 | - :py:class:`MatrixPointer` : Matrix reader with control on the 2D pointer position. 17 | - :py:class:`MatrixRec` : MatrixRec records samples into a previously created NewMatrix. 18 | - :py:class:`MatrixRecLoop` : MatrixRecLoop records samples in loop into a previously created NewMatrix. 19 | 20 | *MatrixMorph* 21 | ----------------------------------- 22 | 23 | .. autoclass:: MatrixMorph 24 | :members: 25 | 26 | .. autoclasstoc:: 27 | 28 | *MatrixPointer* 29 | ----------------------------------- 30 | 31 | .. autoclass:: MatrixPointer 32 | :members: 33 | 34 | .. autoclasstoc:: 35 | 36 | *MatrixRec* 37 | ----------------------------------- 38 | 39 | .. autoclass:: MatrixRec 40 | :members: 41 | 42 | .. autoclasstoc:: 43 | 44 | *MatrixRecLoop* 45 | ----------------------------------- 46 | 47 | .. autoclass:: MatrixRecLoop 48 | :members: 49 | 50 | .. autoclasstoc:: 51 | 52 | -------------------------------------------------------------------------------- /documentation/source/api/classes/pattern.rst: -------------------------------------------------------------------------------- 1 | Event Sequencing 2 | =================================== 3 | 4 | .. currentmodule:: pyo 5 | 6 | Set of objects that call Python functions from triggers or number counts. 7 | Useful for event sequencing. 8 | 9 | Objects in this category 10 | ------------------------------ 11 | 12 | - :py:class:`CallAfter` : Calls a Python function after a given time. 13 | - :py:class:`Pattern` : Periodically calls a Python function. 14 | - :py:class:`Score` : Calls functions by incrementation of a preformatted name. 15 | 16 | *CallAfter* 17 | ----------------------------------- 18 | 19 | .. autoclass:: CallAfter 20 | :members: 21 | 22 | .. autoclasstoc:: 23 | 24 | *Pattern* 25 | ----------------------------------- 26 | 27 | .. autoclass:: Pattern 28 | :members: 29 | 30 | .. autoclasstoc:: 31 | 32 | *Score* 33 | ----------------------------------- 34 | 35 | .. autoclass:: Score 36 | :members: 37 | 38 | .. autoclasstoc:: 39 | 40 | -------------------------------------------------------------------------------- /documentation/source/api/classes/players.rst: -------------------------------------------------------------------------------- 1 | Soundfile Players 2 | =================================== 3 | 4 | .. currentmodule:: pyo 5 | 6 | Play soundfiles from the disk. 7 | 8 | SfMarkerXXX objects use markers features (store in the header) from 9 | an AIFF file to create more specific reading patterns. 10 | 11 | Objects in this category 12 | ------------------------------ 13 | 14 | - :py:class:`SfPlayer` : Soundfile player. 15 | - :py:class:`SfMarkerLooper` : AIFF with markers soundfile looper. 16 | - :py:class:`SfMarkerShuffler` : AIFF with markers soundfile shuffler. 17 | 18 | *SfPlayer* 19 | ----------------------------------- 20 | 21 | .. autoclass:: SfPlayer 22 | :members: 23 | 24 | .. autoclasstoc:: 25 | 26 | *SfMarkerLooper* 27 | ----------------------------------- 28 | 29 | .. autoclass:: SfMarkerLooper 30 | :members: 31 | 32 | .. autoclasstoc:: 33 | 34 | *SfMarkerShuffler* 35 | ----------------------------------- 36 | 37 | .. autoclass:: SfMarkerShuffler 38 | :members: 39 | 40 | .. autoclasstoc:: 41 | 42 | -------------------------------------------------------------------------------- /documentation/source/api/classes/server.rst: -------------------------------------------------------------------------------- 1 | Audio Server 2 | =================================== 3 | 4 | .. currentmodule:: pyo 5 | 6 | *Server* 7 | ----------------------------------- 8 | 9 | .. autoclass:: Server 10 | :members: 11 | 12 | .. autoclasstoc:: 13 | 14 | -------------------------------------------------------------------------------- /documentation/source/api/constants.rst: -------------------------------------------------------------------------------- 1 | Constants 2 | =============================== 3 | 4 | - **PYO_VERSION** : string. Current version of pyo, as a string in the format "major.minor.change". 5 | - **USE_DOUBLE** : boolean. True if using double precision (64-bit), False for single precision (32-bit). 6 | - **WITH_EXTERNALS** : boolean. True if pyo was compiled with external classes. See :ref:`compilation-flags-label`. 7 | - **SNDS_PATH** : string. Path to the pyo sound folder (located in the site-packages folder of the current Python installation. 8 | 9 | -------------------------------------------------------------------------------- /documentation/source/api/functions/index.rst: -------------------------------------------------------------------------------- 1 | Functions 2 | =================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | audio 8 | midi 9 | sndfile 10 | sampling 11 | conv 12 | server 13 | util 14 | 15 | -------------------------------------------------------------------------------- /documentation/source/api/functions/sampling.rst: -------------------------------------------------------------------------------- 1 | Resampling 2 | ======================= 3 | 4 | Functions to modify the sampling rate of an audio file. 5 | 6 | .. currentmodule:: pyo 7 | 8 | Functions in this category 9 | ------------------------------ 10 | 11 | - :py:func:`upsamp` : Increases the sampling rate of an audio file. 12 | - :py:func:`downsamp` : Decreases the sampling rate of an audio file. 13 | 14 | *upsamp* 15 | --------------------------------- 16 | 17 | .. autofunction:: upsamp(path, outfile, up=4, order=128) 18 | 19 | *downsamp* 20 | --------------------------------- 21 | 22 | .. autofunction:: downsamp(path, outfile, down=4, order=128) 23 | 24 | -------------------------------------------------------------------------------- /documentation/source/api/functions/server.rst: -------------------------------------------------------------------------------- 1 | Server Queries 2 | ====================================== 3 | 4 | Functions to query the audio server state. 5 | 6 | .. currentmodule:: pyo 7 | 8 | Functions in this category 9 | ------------------------------ 10 | 11 | - :py:func:`serverCreated` : Returns True if a Server object is already created, otherwise, returns False. 12 | - :py:func:`serverBooted` : Returns True if an already created Server is booted, otherwise, returns False. 13 | 14 | *serverCreated* 15 | --------------------------------- 16 | 17 | .. autofunction:: serverCreated 18 | 19 | *serverBooted* 20 | --------------------------------- 21 | 22 | .. autofunction:: serverBooted 23 | 24 | -------------------------------------------------------------------------------- /documentation/source/api/functions/sndfile.rst: -------------------------------------------------------------------------------- 1 | Soundfile 2 | ============================= 3 | 4 | Functions to inspect or write an audio file on disk. 5 | 6 | .. currentmodule:: pyo 7 | 8 | Functions in this category 9 | ------------------------------ 10 | 11 | - :py:func:`sndinfo` : Retrieve informations about a soundfile. 12 | - :py:func:`savefile` : Creates an audio file from a list of floats. 13 | - :py:func:`savefileFromTable` : Creates an audio file from the content of a table. 14 | 15 | *sndinfo* 16 | --------------------------------- 17 | 18 | .. autofunction:: sndinfo(path, print=False) 19 | 20 | *savefile* 21 | --------------------------------- 22 | 23 | .. autofunction:: savefile(samples, path, sr=44100, channels=1, fileformat=0, sampletype=0, quality=0.4) 24 | 25 | *savefileFromTable* 26 | --------------------------------- 27 | 28 | .. autofunction:: savefileFromTable(table, path, fileformat=0, sampletype=0, quality=0.4) 29 | 30 | -------------------------------------------------------------------------------- /documentation/source/api/index.rst: -------------------------------------------------------------------------------- 1 | API documentation 2 | =============================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | constants 8 | functions/index 9 | alphabetical 10 | classes/index 11 | -------------------------------------------------------------------------------- /documentation/source/index.rst: -------------------------------------------------------------------------------- 1 | .. Pyo documentation master file, created by 2 | sphinx-quickstart on Thu May 16 15:35:44 2013. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to the pyo 1.0.6 documentation 7 | =================================================== 8 | 9 | .. image:: _static/E-PyoIcon.png 10 | :scale: 50 % 11 | :align: center 12 | 13 | Pyo is a Python module written in C to help digital signal processing script 14 | creation. It provides a complete set of classes to build audio softwares, 15 | compose algorithmic musics or simply explore audio processing with a simple, 16 | mature and powerful programming language. 17 | 18 | Parts of the documentation 19 | -------------------------- 20 | 21 | .. toctree:: 22 | :maxdepth: 1 23 | 24 | about 25 | download 26 | compiling 27 | structure 28 | gettingstarted 29 | winaudioinspect 30 | perftips 31 | 32 | .. toctree:: 33 | :maxdepth: 2 34 | 35 | api/index 36 | 37 | examples/index 38 | 39 | tutorials/index 40 | 41 | Indices and tables 42 | ------------------ 43 | 44 | * :ref:`genindex` 45 | * :ref:`search` 46 | 47 | -------------------------------------------------------------------------------- /documentation/source/structure.rst: -------------------------------------------------------------------------------- 1 | Structure of the library 2 | ========================== 3 | 4 | This diagram shows the internal structure of the library. 5 | 6 | .. image:: _static/structure.png 7 | :scale: 33 8 | :align: center 9 | -------------------------------------------------------------------------------- /documentation/source/tutorials/index.rst: -------------------------------------------------------------------------------- 1 | Advanced tutorials 2 | =============================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | pyoobject1 8 | pyoobject2 9 | pyotableobject1 10 | 11 | -------------------------------------------------------------------------------- /embedded/bela/README.md: -------------------------------------------------------------------------------- 1 | Introduction on how to use pyo on the BeagleBone Black with bela 2 | ================================================================ 3 | 4 | If you want to try pyo on the Bela platform, please follow the 5 | instructions of the pyo-bela project: 6 | 7 | [https://github.com/belangeo/pyo-bela](https://github.com/belangeo/pyo-bela) 8 | 9 | (c) 2018 - belangeo 10 | -------------------------------------------------------------------------------- /embedded/juceplugin/test.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | # Get the input sound and apply a stereo delay on it. 4 | feed = SigTo(0, 0.05, 0) 5 | freq = SigTo(0.1, 0.05, 0.1) 6 | freq_sc = Scale(freq, 0, 1, 100, 10000, 4) 7 | st_input = Input([0, 1]) 8 | st_filter = ButBP(st_input, freq_sc) 9 | st_delay = Delay(st_filter, delay=[random.uniform(0.1, 0.9) for i in range(2)], feedback=feed).out() 10 | -------------------------------------------------------------------------------- /embedded/openframeworks/PyoClass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "m_pyo.h" 4 | 5 | typedef int callPtr(int); 6 | 7 | class Pyo { 8 | public: 9 | ~Pyo(); 10 | void setup(int nChannels, int bufferSize, int sampleRate); 11 | void process(float *buffer); 12 | void fillin(float *buffer); 13 | void clear(); 14 | int loadfile(const char *file, int add); 15 | int exec(const char *msg); 16 | int value(const char *name, float value); 17 | int value(const char *name, float *value, int len); 18 | int set(const char *name, float value); 19 | int set(const char *name, float *value, int len); 20 | 21 | private: 22 | int nChannels; 23 | int bufferSize; 24 | int sampleRate; 25 | PyThreadState *interpreter; 26 | float *pyoInBuffer; 27 | float *pyoOutBuffer; 28 | callPtr *pyoCallback; 29 | int pyoId; 30 | char pyoMsg[262144]; 31 | }; 32 | -------------------------------------------------------------------------------- /embedded/puredata/examples/cvlverb.py: -------------------------------------------------------------------------------- 1 | bal = SigTo(0.25, 0.005, 0.25) 2 | ins = Input([0, 1]) 3 | dist = CvlVerb(ins, size=512, bal=bal, mul=0.3).out() 4 | -------------------------------------------------------------------------------- /embedded/puredata/examples/midi_synth.py: -------------------------------------------------------------------------------- 1 | notein = Notein(scale=1) 2 | modwheel = Midictl(1, maxscale=0.2) 3 | 4 | amp = MidiAdsr(notein["velocity"], 0.001, 0.01, 0.7, 0.05) 5 | 6 | lfo = Sine(5, mul=modwheel, add=1) 7 | synth1 = RCOsc(freq=notein["pitch"] * lfo, sharp=0.75, mul=amp) 8 | synth2 = RCOsc(freq=notein["pitch"] * lfo * 1.01, sharp=0.74, mul=amp) 9 | stereo = Mix([synth1.mix(1), synth2.mix(1)], voices=2) 10 | rev = STRev(stereo, inpos=[0, 1], revtime=2, bal=0.25, mul=0.2).out() 11 | -------------------------------------------------------------------------------- /embedded/puredata/examples/random_waves.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | feed = SigTo(0.05, 0.05, 0.05) 4 | amp = Fader(fadein=0.005, fadeout=0.12, dur=0.125) 5 | syn = SineLoop(freq=[500, 510], feedback=feed, mul=amp * amp) 6 | rev = WGVerb(syn, feedback=0.85, cutoff=4500, bal=0.1).out() 7 | 8 | 9 | def choose(a, b): 10 | x = random.randint(a, b) 11 | deg = [0, 2, 3, 5, 7, 8, 11][x % 7] 12 | hz = midiToHz(deg + (x / 7 * 12 + 36)) 13 | syn.freq = [hz, hz * 1.005] 14 | amp.play() 15 | -------------------------------------------------------------------------------- /embedded/puredata/examples/resonators.py: -------------------------------------------------------------------------------- 1 | reson = SigTo(2, 0.005, 2) 2 | freqs = SigTo([50, 100, 150, 200, 250, 300, 350, 400], time=0.2) 3 | 4 | ins = Input([0, 1]) 5 | wgs = Waveguide(ins, freq=freqs, dur=reson, mul=0.1) 6 | wgss = wgs.mix(2) 7 | wgss.out() 8 | -------------------------------------------------------------------------------- /embedded/puredata/examples/resonators_add_delays.py: -------------------------------------------------------------------------------- 1 | deltime = SigTo(0.25, 0.005, 0.25) 2 | delfeed = SigTo(0.25, 0.005, 0.25) 3 | dd = Delay(wgs, delay=deltime, feedback=delfeed).out(0) 4 | -------------------------------------------------------------------------------- /embedded/puredata/pyo~-meta.pd: -------------------------------------------------------------------------------- 1 | #N canvas 15 49 200 200 10; 2 | #N canvas 25 49 420 300 META 1; 3 | #X text 13 41 NAME pyo~; 4 | #X text 10 25 AUTHOR belangeo@gmail.com; 5 | #X text 10 10 VERSION 0.1; 6 | #X restore 10 10 pd META; 7 | -------------------------------------------------------------------------------- /externals/externalmodule-template.h: -------------------------------------------------------------------------------- 1 | /************************************************** 2 | Declare each external object type as "extern" to be sure 3 | that the pyomodule will be aware of their existence. 4 | **************************************************/ 5 | extern PyTypeObject GainType; 6 | 7 | /********************************************************** 8 | This macro is called at runtime to include external objects 9 | in "_pyo" module. Add a line calling "module_add_object" 10 | with your object's name and type for each external object. 11 | **********************************************************/ 12 | #define EXTERNAL_OBJECTS \ 13 | module_add_object(m, "Gain_base", &GainType); \ 14 | 15 | -------------------------------------------------------------------------------- /manylinux-pre-build-script.sh: -------------------------------------------------------------------------------- 1 | echo ====== Build and install liblo. ====== 2 | wget https://sourceforge.net/projects/liblo/files/liblo/0.31/liblo-0.31.tar.gz 3 | tar -xzf liblo-0.31.tar.gz 4 | cd liblo-0.31 5 | ./configure 1>/dev/null 6 | make 1>/dev/null 7 | make install 1>/dev/null 8 | ldconfig 9 | cd .. 10 | 11 | echo ====== Build and install libsndfile. ====== 12 | wget https://github.com/libsndfile/libsndfile/releases/download/1.0.31/libsndfile-1.0.31.tar.bz2 13 | tar -xjf libsndfile-1.0.31.tar.bz2 14 | cd libsndfile-1.0.31 15 | ./autogen.sh 16 | ./configure 17 | make 1>/dev/null 18 | make install 1>/dev/null 19 | ldconfig 20 | cd .. 21 | 22 | echo ====== Build and install alsa-lib. ====== 23 | wget https://www.alsa-project.org/files/pub/lib/alsa-lib-1.2.8.tar.bz2 24 | tar -xjf alsa-lib-1.2.8.tar.bz2 25 | cd alsa-lib-1.2.8 26 | ./configure --with-configdir=/usr/share/alsa 27 | make 1>/dev/null 28 | make install 1>/dev/null 29 | ldconfig 30 | cd .. 31 | 32 | echo ====== Build and install jack2. ====== 33 | wget -O jack2-1.9.21.tar.gz https://github.com/jackaudio/jack2/archive/refs/tags/v1.9.21.tar.gz 34 | tar -xzf jack2-1.9.21.tar.gz 35 | cd jack2-1.9.21 36 | python waf configure LDFLAGS="-lstdc++" 1>/dev/null 37 | python waf build 1>/dev/null 38 | python waf install 1>/dev/null 39 | ldconfig 40 | cd .. -------------------------------------------------------------------------------- /pyo/editor/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/editor/__init__.py -------------------------------------------------------------------------------- /pyo/editor/snippets/Audio/SoundPlayer: -------------------------------------------------------------------------------- 1 | snippet = {'shortcut': u'Shift-Alt-1', 2 | 'value': u'sffade = Fader(fadein=`0.05`, fadeout=`1`, dur=`0`, mul=`0.5`).play()\nsfplay = SfPlayer(`path`, speed=`1`, loop=`True`, mul=sffade).out()'} -------------------------------------------------------------------------------- /pyo/editor/snippets/Audio/TableOsc: -------------------------------------------------------------------------------- 1 | snippet = {'shortcut': u'Shift-Alt-2', 'value': u'oscfade = Fader(fadein=`0.05`, fadeout=`1`, dur=`0`, mul=`0.2`).play()\ntable = HarmTable([`1,0,0,.3,0,0,.2,0,0,.1,0,0,.05`])\noscil = Osc(table, freq=`[150,151]`, mul=oscfade).out()\n'} -------------------------------------------------------------------------------- /pyo/editor/snippets/Audio/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/editor/snippets/Audio/__init__.py -------------------------------------------------------------------------------- /pyo/editor/snippets/Control/ChorusJit: -------------------------------------------------------------------------------- 1 | snippet = {'shortcut': u'Shift-Alt-3', 'value': u'num_voices = `10`\nfjit = Randi(min=`0.99`, max=`1.01`, freq=[(x+5)*0.07 for x in range(num_voices)])\najit = Randi(min=`0.25`, max=`0.75`, freq=[(x+5)*0.17 for x in range(num_voices)])\n'} -------------------------------------------------------------------------------- /pyo/editor/snippets/Control/Vibrato: -------------------------------------------------------------------------------- 1 | snippet = {'shortcut': u'Shift-Alt-4', 'value': u'vfade = Fader(fadein=`1.5`, fadeout=`0.5`, dur=`0`).play()\nfrnd = Randi(min=`4`, max=`6`, freq=`0.25`)\narnd = Randi(min=`0.01`, max=`0.02`, freq=`0.35`)\navib = Sine(freq=frnd, mul=vfade*arnd, add=1)\n'} -------------------------------------------------------------------------------- /pyo/editor/snippets/Control/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/editor/snippets/Control/__init__.py -------------------------------------------------------------------------------- /pyo/editor/snippets/Interface/NewFrame: -------------------------------------------------------------------------------- 1 | snippet = {'shortcut': u'Shift-Alt-5', 'value': u'class MyFrame(wx.Frame):\n def __init__(self, parent, id=-1, title="Frame Title", pos=(25,25), size=(500,400)):\n wx.Frame.__init__(self, parent, id, title, pos, size)\n self.panel = wx.Panel(self)\n self.panel.SetBackgroundColour("#DDDDDD")\n self.box = wx.BoxSizer(wx.VERTICAL)\n # Create objects here...\n self.panel.SetSizer(self.box)\n self.Show()\n'} -------------------------------------------------------------------------------- /pyo/editor/snippets/Interface/PaintPanel: -------------------------------------------------------------------------------- 1 | snippet = {'shortcut': u'Shift-Alt-6', 'value': u'class MyPanel(wx.Panel):\n def __init__(self, parent, id=-1, pos=(25,25), size=(500,400)):\n wx.Panel.__init__(self, parent, id, pos, size)\n self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) \n self.Bind(wx.EVT_PAINT, self.OnPaint)\n\n def OnPaint(self, evt):\n w,h = self.GetSize()\n dc = wx.AutoBufferedPaintDC(self)\n dc.SetBrush(wx.Brush("#FFFFFF"))\n dc.SetPen(wx.Pen("#FFFFFF", width=1))\n dc.Clear()\n dc.DrawRectangle(0,0,w,h)\n for i in range(500):\n x = (i * 5) % w\n y = (i * 3) % h\n col = wx.Colour((i*19)%256, (i*25)%256, (i*39)%256)\n dc.SetBrush(wx.Brush(col))\n col = wx.Colour((i*13)%256, (i*15)%256, (i*19)%256)\n dc.SetPen(wx.Pen(col, width=1))\n dc.DrawCircle(x, y, radius=(i+2)%9)\n'} -------------------------------------------------------------------------------- /pyo/editor/snippets/Interface/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/editor/snippets/Interface/__init__.py -------------------------------------------------------------------------------- /pyo/editor/snippets/Utilities/ChooseAudioDev: -------------------------------------------------------------------------------- 1 | snippet = {'shortcut': u'Shift-Alt-7', 'value': u'pa_list_devices()\ndevIn = int(input("Enter your input device number : "))\ndevOut = int(input("Enter your output device number : "))\ns = Server()\ns.setInputDevice(devIn)\ns.setOutputDevice(devOut)\ns.boot()\n'} 2 | -------------------------------------------------------------------------------- /pyo/editor/snippets/Utilities/Incrementor: -------------------------------------------------------------------------------- 1 | snippet = {'shortcut': u'Shift-Alt-8', 'value': u'count = 0\ndef incrementor():\n global count\n count += 1\n print(count)\n\npat = Pattern(function=incrementor, time=1).play()\n'} 2 | -------------------------------------------------------------------------------- /pyo/editor/snippets/Utilities/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/editor/snippets/Utilities/__init__.py -------------------------------------------------------------------------------- /pyo/editor/snippets/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/editor/snippets/__init__.py -------------------------------------------------------------------------------- /pyo/editor/styles/Custom: -------------------------------------------------------------------------------- 1 | style = {'background': {'colour': '#000000'}, 2 | 'bracebad': {'colour': '#DD0000'}, 3 | 'bracelight': {'colour': '#AABBDD'}, 4 | 'caret': {'colour': '#DDDDDD'}, 5 | 'class': {'bold': 1, 'colour': '#4AF3FF', 'italic': 0, 'underline': 0}, 6 | 'comment': {'bold': 0, 'colour': '#9FFF9F', 'italic': 1, 'underline': 0}, 7 | 'commentblock': {'bold': 0, 'colour': u'#8BA979', 'italic': 1, 'underline': 0}, 8 | 'default': {'bold': 0, 'colour': '#FFFFFF', 'italic': 0, 'underline': 0}, 9 | 'foldmarginback': {'colour': u'#1D1D1D'}, 10 | 'function': {'bold': 1, 'colour': '#00E0B6', 'italic': 0, 'underline': 0}, 11 | 'keyword': {'bold': 1, 'colour': '#4A94FF', 'italic': 0, 'underline': 0}, 12 | 'lineedge': {'colour': '#222222'}, 13 | 'linenumber': {'bold': 1, 'colour': '#FFFFFF', 'italic': 1, 'underline': 0}, 14 | 'marginback': {'colour': '#000000'}, 15 | 'markerbg': {'colour': u'#FFFFFF'}, 16 | 'markerfg': {'colour': u'#000000'}, 17 | 'number': {'bold': 1, 'colour': '#90CB43', 'italic': 0, 'underline': 0}, 18 | 'operator': {'bold': 1, 'colour': '#FFFFFF', 'italic': 0, 'underline': 0}, 19 | 'pyokeyword': {'bold': 1, 'colour': '#4A94FF', 'italic': 0, 'underline': 0}, 20 | 'selback': {'colour': '#333333'}, 21 | 'string': {'bold': 0, 'colour': u'#FF46D7', 'italic': 0, 'underline': 0}, 22 | 'triple': {'bold': 0, 'colour': u'#FF1070', 'italic': 0, 'underline': 0}, 23 | 'preproc': {'bold': 0, 'colour': '#975cb3', 'italic': 0, 'underline': 0}} 24 | -------------------------------------------------------------------------------- /pyo/editor/styles/Default: -------------------------------------------------------------------------------- 1 | style = {'background': {'colour': '#FFFFFF'}, 2 | 'bracebad': {'colour': '#DD0000'}, 3 | 'bracelight': {'colour': '#AABBDD'}, 4 | 'caret': {'colour': '#000000'}, 5 | 'class': {'bold': 1, 'colour': '#000097', 'italic': 0, 'underline': 0}, 6 | 'comment': {'bold': 0, 'colour': '#0066FF', 'italic': 1, 'underline': 0}, 7 | 'commentblock': {'bold': 0, 'colour': u'#468EFF', 'italic': 1, 'underline': 0}, 8 | 'default': {'bold': 0, 'colour': '#000000', 'italic': 0, 'underline': 0}, 9 | 'foldmarginback': {'colour': '#D0D0D0'}, 10 | 'function': {'bold': 1, 'colour': '#0000A2', 'italic': 0, 'underline': 0}, 11 | 'keyword': {'bold': 1, 'colour': '#0000FF', 'italic': 0, 'underline': 0}, 12 | 'lineedge': {'colour': '#DDDDDD'}, 13 | 'linenumber': {'bold': 0, 'colour': '#000000', 'italic': 0, 'underline': 0}, 14 | 'marginback': {'colour': '#B0B0B0'}, 15 | 'markerbg': {'colour': '#000000'}, 16 | 'markerfg': {'colour': '#CCCCCC'}, 17 | 'number': {'bold': 1, 'colour': '#0000CD', 'italic': 0, 'underline': 0}, 18 | 'operator': {'bold': 1, 'colour': '#000000', 'italic': 0, 'underline': 0}, 19 | 'pyokeyword': {'bold': 1, 'colour': '#5555FF', 'italic': 0, 'underline': 0}, 20 | 'selback': {'colour': '#C0DFFF'}, 21 | 'string': {'bold': 0, 'colour': '#036A07', 'italic': 0, 'underline': 0}, 22 | 'triple': {'bold': 0, 'colour': '#03BA07', 'italic': 0, 'underline': 0}, 23 | 'preproc': {'bold': 0, 'colour': '#874ca3', 'italic': 0, 'underline': 0}} 24 | -------------------------------------------------------------------------------- /pyo/editor/styles/Espresso: -------------------------------------------------------------------------------- 1 | style = {'background': {'colour': u'#2A211C'}, 2 | 'bracebad': {'colour': '#DD0000'}, 3 | 'bracelight': {'colour': u'#463F3B'}, 4 | 'caret': {'colour': '#999999'}, 5 | 'class': {'bold': 1, 'colour': '#E5757B', 'italic': 0, 'underline': 0}, 6 | 'comment': {'bold': 0, 'colour': '#00AAFF', 'italic': 1, 'underline': 0}, 7 | 'commentblock': {'bold': 0, 'colour': '#0080DD', 'italic': 1, 'underline': 0}, 8 | 'default': {'bold': 0, 'colour': u'#DECBB8', 'italic': 0, 'underline': 0}, 9 | 'foldmarginback': {'colour': u'#211915'}, 10 | 'function': {'bold': 1, 'colour': '#FF9358', 'italic': 0, 'underline': 0}, 11 | 'keyword': {'bold': 1, 'colour': '#43A8ED', 'italic': 0, 'underline': 0}, 12 | 'lineedge': {'colour': '#3B322D'}, 13 | 'linenumber': {'bold': 1, 'colour': u'#DECBB8', 'italic': 1, 'underline': 0}, 14 | 'marginback': {'colour': '#2A211C'}, 15 | 'markerbg': {'colour': u'#BDAE9C'}, 16 | 'markerfg': {'colour': u'#211915'}, 17 | 'number': {'bold': 1, 'colour': '#44AA43', 'italic': 0, 'underline': 0}, 18 | 'operator': {'bold': 1, 'colour': '#BDAE9C', 'italic': 0, 'underline': 0}, 19 | 'pyokeyword': {'bold': 1, 'colour': '#43A8ED', 'italic': 0, 'underline': 0}, 20 | 'selback': {'colour': '#5D544F'}, 21 | 'string': {'bold': 0, 'colour': '#2FE420', 'italic': 0, 'underline': 0}, 22 | 'triple': {'bold': 0, 'colour': '#049B0A', 'italic': 0, 'underline': 0}, 23 | 'preproc': {'bold': 0, 'colour': '#975cb3', 'italic': 0, 'underline': 0}} 24 | -------------------------------------------------------------------------------- /pyo/editor/styles/Monokai-Soda: -------------------------------------------------------------------------------- 1 | style = {'background': {'colour': u'#222222'}, 2 | 'bracebad': {'colour': '#DD0000'}, 3 | 'bracelight': {'colour': '#AABBDD'}, 4 | 'caret': {'colour': u'#FFFFFF'}, 5 | 'class': {'bold': 1, 'colour': u'#A6E22E', 'italic': 0, 'underline': 0}, 6 | 'comment': {'bold': 0, 'colour': u'#75715E', 'italic': 1, 'underline': 0}, 7 | 'commentblock': {'bold': 0, 'colour': u'#75715E', 'italic': 1, 'underline': 0}, 8 | 'default': {'bold': 0, 'colour': u'#F8F8F2', 'italic': 0, 'underline': 0}, 9 | 'foldmarginback': {'colour': u'#222222'}, 10 | 'function': {'bold': 1, 'colour': u'#66D9EF', 'italic': 0, 'underline': 0}, 11 | 'keyword': {'bold': 1, 'colour': u'#F92671', 'italic': 0, 'underline': 0}, 12 | 'lineedge': {'colour': '#222222'}, 13 | 'linenumber': {'bold': 1, 'colour': u'#F8F8F2', 'italic': 1, 'underline': 0}, 14 | 'marginback': {'colour': u'#222222'}, 15 | 'markerbg': {'colour': u'#F8F8F2'}, 16 | 'markerfg': {'colour': u'#222222'}, 17 | 'number': {'bold': 1, 'colour': u'#AE81FF', 'italic': 0, 'underline': 0}, 18 | 'operator': {'bold': 1, 'colour': u'#F92671', 'italic': 0, 'underline': 0}, 19 | 'pyokeyword': {'bold': 1, 'colour': u'#A6E22E', 'italic': 0, 'underline': 0}, 20 | 'selback': {'colour': u'#444444'}, 21 | 'string': {'bold': 0, 'colour': u'#E6DB74', 'italic': 0, 'underline': 0}, 22 | 'triple': {'bold': 0, 'colour': u'#E6DB74', 'italic': 0, 'underline': 0}, 23 | 'preproc': {'bold': 0, 'colour': '#0000FF', 'italic': 0, 'underline': 0}} 24 | -------------------------------------------------------------------------------- /pyo/editor/styles/Smooth: -------------------------------------------------------------------------------- 1 | style = {'background': {'colour': '#222222'}, 2 | 'bracebad': {'colour': '#DD0000'}, 3 | 'bracelight': {'colour': '#AABBDD'}, 4 | 'caret': {'colour': '#EEEEEE'}, 5 | 'class': {'bold': 1, 'colour': '#00FFA2', 'italic': 0, 'underline': 0}, 6 | 'comment': {'bold': 0, 'colour': '#DD0000', 'italic': 1, 'underline': 0}, 7 | 'commentblock': {'bold': 0, 'colour': '#AF0000', 'italic': 1, 'underline': 0}, 8 | 'default': {'bold': 0, 'colour': '#FFFFFF', 'italic': 0, 'underline': 0}, 9 | 'foldmarginback': {'colour': u'#1C1C1C'}, 10 | 'function': {'bold': 1, 'colour': '#00FFD5', 'italic': 0, 'underline': 0}, 11 | 'keyword': {'bold': 1, 'colour': '#9999FF', 'italic': 0, 'underline': 0}, 12 | 'lineedge': {'colour': '#333333'}, 13 | 'linenumber': {'bold': 1, 'colour': '#EEEEEE', 'italic': 1, 'underline': 0}, 14 | 'marginback': {'colour': u'#121212'}, 15 | 'markerbg': {'colour': u'#DDDDDD'}, 16 | 'markerfg': {'colour': u'#1C1C1C'}, 17 | 'number': {'bold': 1, 'colour': '#FFFFFF', 'italic': 0, 'underline': 0}, 18 | 'operator': {'bold': 1, 'colour': '#FFFFFF', 'italic': 0, 'underline': 0}, 19 | 'pyokeyword': {'bold': 1, 'colour': u'#64BEFF', 'italic': 0, 'underline': 0}, 20 | 'selback': {'colour': '#555555'}, 21 | 'string': {'bold': 0, 'colour': '#00EE00', 'italic': 0, 'underline': 0}, 22 | 'triple': {'bold': 0, 'colour': '#00AA00', 'italic': 0, 'underline': 0}, 23 | 'preproc': {'bold': 0, 'colour': '#0000FF', 'italic': 0, 'underline': 0}} 24 | -------------------------------------------------------------------------------- /pyo/editor/styles/Soft: -------------------------------------------------------------------------------- 1 | style = {'background': {'colour': '#EFEFEF'}, 2 | 'bracebad': {'colour': '#DD0000'}, 3 | 'bracelight': {'colour': '#AABBDD'}, 4 | 'caret': {'colour': '#222222'}, 5 | 'class': {'bold': 1, 'colour': u'#3F3F3F', 'italic': 0, 'underline': 1}, 6 | 'comment': {'bold': 0, 'colour': '#444444', 'italic': 1, 'underline': 0}, 7 | 'commentblock': {'bold': 0, 'colour': '#7F7F7F', 'italic': 1, 'underline': 0}, 8 | 'default': {'bold': 0, 'colour': '#000000', 'italic': 0, 'underline': 0}, 9 | 'foldmarginback': {'colour': u'#D0D0D0'}, 10 | 'function': {'bold': 1, 'colour': u'#3F3F3F', 'italic': 0, 'underline': 0}, 11 | 'keyword': {'bold': 1, 'colour': u'#000000', 'italic': 0, 'underline': 0}, 12 | 'lineedge': {'colour': '#CDCDCD'}, 13 | 'linenumber': {'bold': 0, 'colour': '#111111', 'italic': 0, 'underline': 0}, 14 | 'marginback': {'colour': '#AFAFAF'}, 15 | 'markerbg': {'colour': '#404040'}, 16 | 'markerfg': {'colour': u'#D0D0D0'}, 17 | 'number': {'bold': 1, 'colour': '#222222', 'italic': 0, 'underline': 0}, 18 | 'operator': {'bold': 1, 'colour': '#000000', 'italic': 0, 'underline': 0}, 19 | 'pyokeyword': {'bold': 1, 'colour': u'#000000', 'italic': 0, 'underline': 0}, 20 | 'selback': {'colour': '#CBCBCB'}, 21 | 'string': {'bold': 0, 'colour': u'#272727', 'italic': 1, 'underline': 0}, 22 | 'triple': {'bold': 0, 'colour': '#333333', 'italic': 1, 'underline': 0}, 23 | 'preproc': {'bold': 0, 'colour': '#222222', 'italic': 0, 'underline': 0}} 24 | -------------------------------------------------------------------------------- /pyo/editor/styles/Solarized (dark): -------------------------------------------------------------------------------- 1 | style = {'background': {'colour': u'#042B36'}, 2 | 'bracebad': {'colour': '#DD0000'}, 3 | 'bracelight': {'colour': '#AABBDD'}, 4 | 'caret': {'colour': u'#819090'}, 5 | 'class': {'bold': 1, 'colour': u'#268BD2', 'italic': 0, 'underline': 0}, 6 | 'comment': {'bold': 1, 'colour': u'#93A1A1', 'italic': 1, 'underline': 0}, 7 | 'commentblock': {'bold': 1, 'colour': u'#93A1A1', 'italic': 1, 'underline': 0}, 8 | 'default': {'bold': 0, 'colour': u'#F8F8F2', 'italic': 0, 'underline': 0}, 9 | 'foldmarginback': {'colour': u'#073641'}, 10 | 'function': {'bold': 1, 'colour': u'#268BD2', 'italic': 0, 'underline': 0}, 11 | 'keyword': {'bold': 1, 'colour': u'#859900', 'italic': 0, 'underline': 0}, 12 | 'lineedge': {'colour': u'#CDCDCD'}, 13 | 'linenumber': {'bold': 0, 'colour': u'#819090', 'italic': 0, 'underline': 0}, 14 | 'marginback': {'colour': u'#073641'}, 15 | 'markerbg': {'colour': u'#F8F8F2'}, 16 | 'markerfg': {'colour': u'#222222'}, 17 | 'number': {'bold': 1, 'colour': u'#D33682', 'italic': 0, 'underline': 0}, 18 | 'operator': {'bold': 1, 'colour': u'#586E75', 'italic': 0, 'underline': 0}, 19 | 'pyokeyword': {'bold': 1, 'colour': u'#268BD2', 'italic': 0, 'underline': 0}, 20 | 'selback': {'colour': u'#073641'}, 21 | 'string': {'bold': 0, 'colour': u'#2AA198', 'italic': 0, 'underline': 0}, 22 | 'triple': {'bold': 0, 'colour': u'#269186', 'italic': 0, 'underline': 0}, 23 | 'preproc': {'bold': 0, 'colour': '#975cb3', 'italic': 0, 'underline': 0}} 24 | -------------------------------------------------------------------------------- /pyo/editor/styles/Solarized (light): -------------------------------------------------------------------------------- 1 | style = {'background': {'colour': u'#FDF6E3'}, 2 | 'bracebad': {'colour': '#DD0000'}, 3 | 'bracelight': {'colour': '#AABBDD'}, 4 | 'caret': {'colour': u'#000000'}, 5 | 'class': {'bold': 1, 'colour': u'#268BD2', 'italic': 0, 'underline': 0}, 6 | 'comment': {'bold': 1, 'colour': u'#93A1A1', 'italic': 1, 'underline': 0}, 7 | 'commentblock': {'bold': 1, 'colour': u'#93A1A1', 'italic': 1, 'underline': 0}, 8 | 'default': {'bold': 0, 'colour': u'#586E75', 'italic': 0, 'underline': 0}, 9 | 'foldmarginback': {'colour': u'#EEE8D5'}, 10 | 'function': {'bold': 1, 'colour': u'#268BD2', 'italic': 0, 'underline': 0}, 11 | 'keyword': {'bold': 1, 'colour': u'#859900', 'italic': 0, 'underline': 0}, 12 | 'lineedge': {'colour': u'#CDCDCD'}, 13 | 'linenumber': {'bold': 0, 'colour': u'#002B36', 'italic': 0, 'underline': 0}, 14 | 'marginback': {'colour': u'#EEE8D5'}, 15 | 'markerbg': {'colour': u'#002B36'}, 16 | 'markerfg': {'colour': u'#CCCCCC'}, 17 | 'number': {'bold': 1, 'colour': u'#D33682', 'italic': 0, 'underline': 0}, 18 | 'operator': {'bold': 1, 'colour': u'#586E75', 'italic': 0, 'underline': 0}, 19 | 'pyokeyword': {'bold': 1, 'colour': u'#268BD2', 'italic': 0, 'underline': 0}, 20 | 'selback': {'colour': u'#EEE8D5'}, 21 | 'string': {'bold': 0, 'colour': u'#2AA198', 'italic': 0, 'underline': 0}, 22 | 'triple': {'bold': 0, 'colour': u'#269186', 'italic': 0, 'underline': 0}, 23 | 'preproc': {'bold': 0, 'colour': '#975cb3', 'italic': 0, 'underline': 0}} 24 | -------------------------------------------------------------------------------- /pyo/editor/styles/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/editor/styles/__init__.py -------------------------------------------------------------------------------- /pyo/examples/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/__init__.py -------------------------------------------------------------------------------- /pyo/examples/algorithmic/01_music_box.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | """ 4 | Music box. 5 voices randomly choosing frequencies over a common scale. 5 | 6 | """ 7 | 8 | from pyo import * 9 | 10 | s = Server(duplex=0).boot() 11 | 12 | # --> set list of frequencies 13 | low_freqs = [midiToHz(m + 7) for m in [36, 43.01, 48, 55.01, 60]] 14 | mid_freqs = [midiToHz(m + 7) for m in [60, 62, 63.93, 65, 67.01, 69, 71, 72]] 15 | high_freqs = [midiToHz(m + 7) for m in [72, 74, 75.93, 77, 79.01]] 16 | freqs = [low_freqs, low_freqs, mid_freqs, mid_freqs, high_freqs] 17 | # <-- 18 | 19 | # --> 20 | chx = Choice(choice=freqs, freq=[1, 2, 3, 3, 4]) 21 | port = Port(chx, risetime=0.001, falltime=0.001) 22 | sines = SineLoop(port, feedback=[0.06, 0.057, 0.033, 0.035, 0.016], mul=[0.15, 0.15, 0.1, 0.1, 0.06]) 23 | pan = SPan(sines, pan=[0, 1, 0.2, 0.8, 0.5]).out() 24 | # <-- 25 | 26 | s.gui(locals()) 27 | -------------------------------------------------------------------------------- /pyo/examples/algorithmic/02_scale_snap.py: -------------------------------------------------------------------------------- 1 | """ 2 | Algorithmic melody patterns snapped on a specific scale... 3 | 4 | """ 5 | 6 | from pyo import * 7 | 8 | s = Server(duplex=0).boot() 9 | 10 | scls = [ 11 | [0, 4, 7, 11, 13, 17, 21, 25, 29, 33], 12 | [0, 7, 12, 14, 17, 21, 24, 29, 31, 34], 13 | [0, 7, 10, 12, 15, 19, 20], 14 | ] 15 | 16 | env = CosTable([(0, 0), (50, 1), (500, 0.25), (8191, 0)]) 17 | wav = SquareTable(5) 18 | 19 | met = Metro(time=0.125, poly=8).play() 20 | note = TrigXnoiseMidi(met, dist="loopseg", x1=1, x2=0.2, mrange=(48, 97)) 21 | snp = Snap(note, choice=scls[0], scale=1) 22 | 23 | curscl = 0 24 | 25 | 26 | def changeScl(): 27 | # change the scale for snp.choice argument 28 | global curscl 29 | curscl = (curscl + 1) % len(scls) 30 | snp.choice = scls[curscl] 31 | print(snp.choice) 32 | 33 | 34 | metscl = Metro(time=8).play() 35 | tr = TrigFunc(metscl, function=changeScl) 36 | 37 | c = TrigEnv(met, table=env, mul=0.07) 38 | d = Osc(table=wav, freq=snp, mul=c).out() 39 | d1 = Osc(table=wav, freq=snp * 0.999, mul=c).out() 40 | d2 = Osc(table=wav, freq=snp * 1.002, mul=c).out() 41 | d3 = Osc(table=wav, freq=snp * 0.997, mul=c).out() 42 | 43 | s.gui(locals()) 44 | -------------------------------------------------------------------------------- /pyo/examples/algorithmic/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/algorithmic/__init__.py -------------------------------------------------------------------------------- /pyo/examples/sampling/01_sound_cloud.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | """ 4 | Exponential cloud of sounds... 5 | 6 | """ 7 | 8 | from pyo import * 9 | 10 | s = Server(duplex=0).boot() 11 | 12 | snds = ["../snds/snd_%d.aif" % i for i in range(1, 7)] 13 | num = len(snds) 14 | olaps = 4 15 | 16 | tabs = [] 17 | trtabs = [] 18 | trrnds = [] 19 | 20 | lfo = Expseg([(0, 0), (20, 100)], loop=True, exp=5).play() 21 | cl = Cloud(density=lfo, poly=num * olaps).play() 22 | 23 | for i in range(num): 24 | tabs.append(SndTable(snds[i])) 25 | 26 | for j in range(olaps): 27 | offset = j * num 28 | for i in range(num): 29 | index = i + offset 30 | trrnds.append(TrigChoice(cl[index], choice=[0.5, 0.75, 1, 1.25, 1.5, 2])) 31 | trtabs.append(TrigEnv(cl[index], table=tabs[i], dur=1.0 / tabs[i].getRate() * trrnds[index], interp=4,)) 32 | 33 | mix = Mix(trtabs, voices=2) 34 | out = Freeverb(mix, size=0.9, damp=0.95, bal=0.1, mul=0.3).out() 35 | 36 | s.gui(locals()) 37 | -------------------------------------------------------------------------------- /pyo/examples/sampling/02_live_looper.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | """ 4 | To record sound from input mic in the buffer (4 seconds), call: 5 | rec.play() 6 | 7 | The buffer is looped with some funny parameters... 8 | 9 | """ 10 | from pyo import * 11 | 12 | s = Server(duplex=1).boot() 13 | 14 | tab = NewTable(4) 15 | rec = TableRec(Input(), tab) 16 | 17 | pit = Choice(choice=[0.5, 0.5, 0.75, 0.75, 1, 1, 1.25, 1.5], freq=[3, 4]) 18 | start = Phasor(freq=0.025, mul=tab.getDur() - 0.5) 19 | dur = Choice(choice=[0.0625, 0.125, 0.125, 0.125, 0.25, 0.25, 0.5], freq=4) 20 | a = Looper( 21 | table=tab, # table to loop in 22 | pitch=pit, # transposition 23 | start=start, # loop start position 24 | dur=dur, # loop duration 25 | xfade=20, # crossfade duration in % 26 | mode=1, # looping mode 27 | xfadeshape=0, # crossfade shape 28 | startfromloop=False, # first start position, False means from beginning of the table 29 | interp=4, # interpolation method 30 | ).out() 31 | 32 | s.gui(locals()) 33 | -------------------------------------------------------------------------------- /pyo/examples/sampling/03_rec_and_loop.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | """ 4 | This script records any number of buffers and loop them. 5 | 6 | Call r.play() (as many times as you want) to record a buffer from the input mic. 7 | 8 | """ 9 | from pyo import * 10 | 11 | s = Server(duplex=1).boot() 12 | 13 | buffer_length = 1 # seconds 14 | 15 | objs = [] 16 | 17 | 18 | def cp(): 19 | # make a copy of the table. 20 | t2 = t.copy() 21 | # start looping the copied table. 22 | f = Fader(fadein=0.1, mul=0.5).play() 23 | pl = Osc(t2, freq=1.0 / buffer_length, interp=4, mul=f).out() 24 | # save a references to these audio objects to keep them alive. 25 | objs.extend([t2, f, pl]) 26 | 27 | 28 | mic = Input([0, 1]) 29 | 30 | # the table for the recording. 31 | t = NewTable(length=buffer_length, chnls=2) 32 | r = TableRec(mic, table=t, fadetime=0.1) 33 | # once the recording is done, cp() is called. 34 | tr = TrigFunc(r["trig"], function=cp) 35 | 36 | s.gui(locals()) 37 | -------------------------------------------------------------------------------- /pyo/examples/sampling/04_live_convolution.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | 4 | """ 5 | Live convolution example. A white noise is filtered by four impulses 6 | taken from the input mic. Call r1.play(), r2.play(), r3.play(), r4.play() 7 | while making some noise in the mic to fill the impulse response tables. 8 | The slider handles the morphing between the four impulses. 9 | 10 | Call t1.view(), t2.view(), t3.view(), t4.view() to view impulse response tables. 11 | 12 | Circular convolution is very expensive, so keep TLEN (in samples) small. 13 | 14 | """ 15 | from pyo import * 16 | 17 | s = Server(duplex=1).boot() 18 | 19 | sf = Noise(0.5) 20 | 21 | TLEN = 1024 22 | 23 | inmic = Input() 24 | 25 | t1 = NewTable(length=sampsToSec(TLEN), chnls=1) 26 | r1 = TableRec(inmic, table=t1, fadetime=0.001) 27 | 28 | t2 = NewTable(length=sampsToSec(TLEN), chnls=1) 29 | r2 = TableRec(inmic, table=t2, fadetime=0.001) 30 | 31 | t3 = NewTable(length=sampsToSec(TLEN), chnls=1) 32 | r3 = TableRec(inmic, table=t3, fadetime=0.001) 33 | 34 | t4 = NewTable(length=sampsToSec(TLEN), chnls=1) 35 | r4 = TableRec(inmic, table=t4, fadetime=0.001) 36 | 37 | pha = Sig(0) 38 | pha.ctrl(title="Impulse responses morphing") 39 | 40 | t = NewTable(length=sampsToSec(TLEN), chnls=1) 41 | m = TableMorph(pha, t, [t1, t2, t3, t4]) 42 | a = Convolve(sf, table=t, size=t.getSize(), mul=0.1).mix(2).out() 43 | 44 | s.gui(locals()) 45 | -------------------------------------------------------------------------------- /pyo/examples/sampling/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/sampling/__init__.py -------------------------------------------------------------------------------- /pyo/examples/sequencing/01_starttime_duration.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | """ 4 | Show how to use `dur` and `delay` parameters of play() and out() 5 | methods to sequence events over time. 6 | 7 | """ 8 | from pyo import * 9 | import random 10 | 11 | s = Server(duplex=0).boot() 12 | 13 | num = 70 14 | freqs = [random.uniform(100, 1000) for i in range(num)] 15 | start1 = [i * 0.5 for i in range(num)] 16 | fade1 = Fader([1] * num, 1, 5, mul=0.03).play(dur=5, delay=start1) 17 | a = SineLoop(freqs, feedback=0.05, mul=fade1).out(dur=5, delay=start1) 18 | 19 | start2 = 30 20 | dur2 = 40 21 | snds = [ 22 | "../snds/alum1.wav", 23 | "../snds/alum2.wav", 24 | "../snds/alum3.wav", 25 | "../snds/alum4.wav", 26 | ] 27 | tabs = SndTable(snds) 28 | fade2 = Fader(0.05, 10, dur2, mul=0.7).play(dur=dur2, delay=start2) 29 | b = Beat(time=0.125, w1=[90, 30, 30, 20], w2=[30, 90, 50, 40], w3=[0, 30, 30, 40], poly=1).play(dur=dur2, delay=start2) 30 | out = TrigEnv(b, tabs, b["dur"], mul=b["amp"] * fade2).out(dur=dur2, delay=start2) 31 | 32 | start3 = 45 33 | dur3 = 30 34 | fade3 = Fader(15, 15, dur3, mul=0.02).play(dur=dur3, delay=start3) 35 | fm = FM(carrier=[149, 100, 151, 50] * 3, ratio=[0.2499, 0.501, 0.75003], index=10, mul=fade3).out( 36 | dur=dur3, delay=start3 37 | ) 38 | 39 | s.gui(locals()) 40 | -------------------------------------------------------------------------------- /pyo/examples/sequencing/03_function_call.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | 4 | """ 5 | Python function regularly called with a Pattern object. 6 | 7 | """ 8 | from pyo import * 9 | import random 10 | 11 | s = Server(duplex=0).boot() 12 | 13 | amp = Fader(fadein=1, mul=0.25).play() 14 | src1 = BrownNoise(mul=amp) 15 | src2 = FM(carrier=[50, 100], ratio=[1.01, 0.495], index=[10, 13], mul=amp * 0.3) 16 | 17 | frs = SigTo(value=[250, 700, 1800, 3000], time=0.25, init=[250, 700, 1800, 3000]) 18 | out = Biquadx(src1 + src2, freq=frs, q=20, type=2, stages=2, mul=4).out() 19 | 20 | 21 | def change(): 22 | f1 = random.uniform(200, 500) 23 | f2 = random.uniform(500, 1000) 24 | f3 = random.uniform(1000, 2000) 25 | f4 = random.uniform(2000, 4000) 26 | lst = [f1, f2, f3, f4] 27 | frs.value = lst 28 | print("%.2f, %.2f, %.2f, %.2f" % tuple(lst)) 29 | 30 | 31 | lfo = Sine(freq=0.1, mul=0.5, add=0.75) 32 | pat = Pattern(function=change, time=lfo).play() 33 | 34 | s.gui(locals()) 35 | -------------------------------------------------------------------------------- /pyo/examples/sequencing/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/sequencing/__init__.py -------------------------------------------------------------------------------- /pyo/examples/snds/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/snds/__init__.py -------------------------------------------------------------------------------- /pyo/examples/snds/alum1.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/snds/alum1.wav -------------------------------------------------------------------------------- /pyo/examples/snds/alum2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/snds/alum2.wav -------------------------------------------------------------------------------- /pyo/examples/snds/alum3.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/snds/alum3.wav -------------------------------------------------------------------------------- /pyo/examples/snds/alum4.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/snds/alum4.wav -------------------------------------------------------------------------------- /pyo/examples/snds/baseballmajeur_m.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/snds/baseballmajeur_m.aif -------------------------------------------------------------------------------- /pyo/examples/snds/drumloop.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/snds/drumloop.wav -------------------------------------------------------------------------------- /pyo/examples/snds/flute.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/snds/flute.aif -------------------------------------------------------------------------------- /pyo/examples/snds/mapleleafrag.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/snds/mapleleafrag.mid -------------------------------------------------------------------------------- /pyo/examples/snds/ounkmaster.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/snds/ounkmaster.aif -------------------------------------------------------------------------------- /pyo/examples/snds/snd_1.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/snds/snd_1.aif -------------------------------------------------------------------------------- /pyo/examples/snds/snd_2.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/snds/snd_2.aif -------------------------------------------------------------------------------- /pyo/examples/snds/snd_3.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/snds/snd_3.aif -------------------------------------------------------------------------------- /pyo/examples/snds/snd_4.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/snds/snd_4.aif -------------------------------------------------------------------------------- /pyo/examples/snds/snd_5.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/snds/snd_5.aif -------------------------------------------------------------------------------- /pyo/examples/snds/snd_6.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/snds/snd_6.aif -------------------------------------------------------------------------------- /pyo/examples/synthesis/01_pulsar_synthesis.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | """ 4 | Hand-written pulsar synthesis. 5 | 6 | """ 7 | from pyo import * 8 | import random 9 | 10 | s = Server(duplex=0).boot() 11 | 12 | # simple pulsar waveform 13 | t = HarmTable([1, 0, 0.3, 0, 0.2, 0, 0, 0.1], size=32768) 14 | 15 | # Chorus of reader indexes around frequencies 50, 100, 150 and 200 Hz 16 | a = Phasor(freq=[((i % 4) + 1) * 50 * random.uniform(0.99, 1.01) for i in range(16)]) 17 | 18 | # Duty cycle control 19 | frac = Sig(0.5) 20 | frac.ctrl(title="Pulsar duty cycle") 21 | 22 | # Pulsar synthesis 23 | scl = a * (a <= frac) * (1.0 / frac) 24 | c = Pointer(table=HannTable(), index=scl, mul=0.05) 25 | d = Pointer(table=t, index=scl, mul=c).out() 26 | 27 | s.gui(locals()) 28 | -------------------------------------------------------------------------------- /pyo/examples/synthesis/02_FM3.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | """ 4 | 3 oscillators FM synthesis class. 5 | 6 | """ 7 | from pyo import * 8 | import math 9 | 10 | s = Server(duplex=0).boot() 11 | 12 | t = HarmTable([1, 0.1]) 13 | 14 | 15 | class FM3: 16 | def __init__(self, fcar, ratio1, ratio2, index1, index2, out=0): 17 | self.fmod = fcar * ratio1 18 | self.fmodmod = self.fmod * ratio2 19 | self.amod = self.fmod * index1 20 | self.amodmod = self.fmodmod * index2 21 | self.modmod = Sine(self.fmodmod, mul=self.amodmod) 22 | self.mod = Sine(self.fmod + self.modmod, mul=self.amod) 23 | self.car = Osc(t, fcar + self.mod, mul=0.2) 24 | self.eq = EQ(self.car, freq=fcar, q=0.707, boost=-12) 25 | self.out = DCBlock(self.eq).out(out) 26 | 27 | 28 | a = FM3(125.00, 0.33001, 2.9993, 8, 4, 0) 29 | b = FM3(125.08, 0.33003, 2.9992, 8, 4, 1) 30 | c = FM3(249.89, 0.33004, 2.9995, 8, 4, 0) 31 | d = FM3(249.91, 0.33006, 2.9991, 8, 4, 1) 32 | 33 | s.gui(locals()) 34 | -------------------------------------------------------------------------------- /pyo/examples/synthesis/03_cos_waveshaping.py: -------------------------------------------------------------------------------- 1 | """ 2 | Cos waveshaping synthesis. 3 | 4 | """ 5 | from pyo import * 6 | import math 7 | 8 | s = Server(sr=44100, nchnls=2, duplex=0).boot() 9 | 10 | ### Controls ### 11 | drv = Sig(0) 12 | drv.ctrl(title="Drive") 13 | phi = Sig(0, mul=math.pi / 2) 14 | phi.ctrl(title="Odd harmonics <----> Even harmonics") 15 | frs = Sig([40.04, 39.41, 41.09, 38.7]) 16 | frs.ctrl([SLMap(10.0, 1000.0, "log", "value", frs.value)], title="Input osc frequencies") 17 | 18 | # Amplitude and phase scaling 19 | amp = drv * 2 * math.pi + 0.5 20 | phiscl = Scale(phi, inmin=0, inmax=math.pi / 2, outmin=1, outmax=0.5) 21 | 22 | # Amplitude envelope 23 | f = Linseg([(0, 0), (0.5, 0), (1, 1)], mul=amp).play() 24 | 25 | # Signal with lot of harmonics 26 | t = HarmTable([1, 0, 0, 0, 0, 0.33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.2, 0, 0, 0, 0, 0, 0, 0, 0.143,]) 27 | a = OscBank(t, freq=frs, spread=0.0001, slope=1, num=24, fjit=True, mul=f) 28 | 29 | # Cos waveshaping 30 | b = Cos(math.pi * a + phi) 31 | b1 = DCBlock(b * phiscl) 32 | c = Sig(b1 / amp, mul=0.2).out() 33 | 34 | s.gui(locals()) 35 | -------------------------------------------------------------------------------- /pyo/examples/synthesis/04_degrade_synthesis.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | 4 | """ 5 | Synthesis sound with lot of harmonics passed through a Degrade object. 6 | 7 | """ 8 | from pyo import * 9 | 10 | s = Server(duplex=0).boot() 11 | 12 | # Fadein 13 | f = Fader(fadein=4, mul=0.3).play() 14 | 15 | # Waveform table 16 | wt = HarmTable([1, 0, 0.2, 0, 0.10, 0, 0, 0.1, 0, 0, 0, 0.15]).normalize() 17 | 18 | # 6 waveform readers with amplitude variations 19 | lf = Sine([0.15, 0.2], 0, 0.35, 0.5) 20 | a = Osc(table=wt, freq=[25, 50.1, 101, 149.7, 201.3, 251.8], mul=lf) 21 | 22 | # table lookup with waveforms as input indexes 23 | t = ChebyTable([1, 0, 0.3, 0, 0.2, 0, 0.143, 0, 0.111]) 24 | b = Lookup(t, a, 1.0 - lf) 25 | 26 | # signal with lot of harmonics passed through a Degrade object 27 | c = Degrade(b, bitdepth=5.967, srscale=0.0233, mul=f).out() 28 | c.ctrl() 29 | 30 | s.gui(locals()) 31 | -------------------------------------------------------------------------------- /pyo/examples/synthesis/04_granule.py: -------------------------------------------------------------------------------- 1 | """ 2 | Hand-written granulation module. 3 | 4 | """ 5 | from pyo import * 6 | 7 | s = Server(duplex=0).boot() 8 | 9 | t1 = SndTable("../snds/baseballmajeur_m.aif") 10 | t2 = WinTable(7) 11 | t3 = LinTable() 12 | 13 | snd_dur = t1.getDur() 14 | num_of_grains = 50 15 | grain_dur = 0.25 16 | jitter_amp = 0.2 17 | 18 | met = Metro(time=grain_dur / num_of_grains, poly=num_of_grains).play() 19 | mvt = Randi(freq=0.25) 20 | pos = TrigRand(met, min=mvt, max=mvt + 0.05) 21 | jit = TrigRand(met, min=1 - jitter_amp, max=1 + jitter_amp) 22 | env = TrigEnv(met, t2, dur=grain_dur, mul=0.05) 23 | ind = TrigEnv(met, t3, dur=grain_dur, mul=jit * (grain_dur / snd_dur), add=pos) 24 | snd = Pointer(t1, ind, env).out() 25 | 26 | s.gui(locals()) 27 | -------------------------------------------------------------------------------- /pyo/examples/synthesis/05_ring_mod_class.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | """ 4 | Ring modulators used as exciter of a waveguide bank. 5 | 6 | """ 7 | from pyo import * 8 | import random 9 | 10 | s = Server().boot() 11 | 12 | tab_m = HarmTable([1, 0, 0, 0, 0, 0.3, 0, 0, 0, 0, 0, 0.2, 0, 0, 0, 0, 0, 0.1, 0, 0, 0, 0, 0.05]).normalize() 13 | tab_p = HarmTable([1, 0, 0.33, 0, 0.2, 0, 0.143, 0, 0.111]) 14 | 15 | 16 | class Ring: 17 | def __init__(self, fport=250, fmod=100, amp=0.3): 18 | self.mod = Osc(tab_m, freq=fmod, mul=amp) 19 | self.port = Osc(tab_p, freq=fport, mul=self.mod) 20 | 21 | def out(self): 22 | self.port.out() 23 | return self 24 | 25 | def sig(self): 26 | return self.port 27 | 28 | 29 | lf = Sine(0.03, mul=0.5, add=1) 30 | rg = Ring( 31 | fport=[random.choice([62.5, 125, 187.5, 250]) * random.uniform(0.99, 1.01) for i in range(8)], 32 | fmod=lf * [random.choice([25, 50, 75, 100]) * random.uniform(0.99, 1.01) for i in range(8)], 33 | amp=0.1, 34 | ) 35 | 36 | res = Waveguide(rg.sig(), freq=[30.1, 60.05, 119.7, 181, 242.5, 303.33], dur=30, mul=0.1).out() 37 | 38 | s.gui(locals()) 39 | -------------------------------------------------------------------------------- /pyo/examples/synthesis/06_lfo_controls.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | """ 4 | Audio control with LFOs. 5 | 6 | """ 7 | from pyo import * 8 | 9 | s = Server(duplex=0).boot() 10 | 11 | # LFO (sine wave) +/- 5 (mul) around 10 (add), range = 5 -> 15. 12 | # Control the frequency of the square wave LFO. 13 | freqctl = Sine(freq=0.1, mul=5, add=10) 14 | 15 | # LFO (square wave) +/- 0.05 (mul) around 0.07 (add), range = 0.02 -> 0.12. 16 | # Control the feedback of the SineLoop oscillator. 17 | feedctl = LFO(freq=freqctl, sharp=0.8, type=2, mul=0.05, add=0.07) 18 | 19 | synth = SineLoop(freq=[201.32, 199.76, 200, 201.55], feedback=feedctl, mul=0.1).out() 20 | 21 | s.gui(locals()) 22 | -------------------------------------------------------------------------------- /pyo/examples/synthesis/08_bucket_brigade_device.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | """ 4 | bucket-brigade device (BBD) synthesis. This implementation consists of 5 | two delay lines cross-feeded with an internal ring-modulator and a lowpass 6 | filter inside each delay line. The delay lines are feeded with a sine wave. 7 | 8 | """ 9 | from pyo import * 10 | 11 | s = Server(duplex=0).boot() 12 | 13 | t = HarmTable(size=32768) 14 | src = Osc(t, 100) 15 | src.ctrl(title="Input oscillator controls") 16 | in_src = src * 0.025 17 | 18 | feed = 0.8 19 | cross_feed = 0.99 20 | 21 | del_1 = Delay(in_src, delay=Sine(0.005, 0, 0.05, 0.25)) 22 | sine_1 = Osc(t, Sine(0.007, 0, 50, 250)) 23 | ring_1 = del_1 * sine_1 24 | filt_1 = Biquad(ring_1, 3000) 25 | 26 | del_2 = Delay(in_src, delay=Sine(0.003, 0, 0.08, 0.3)) 27 | sine_2 = Osc(t, Sine(0.008, 0, 40, 200)) 28 | ring_2 = del_2 * sine_2 29 | filt_2 = Biquad(ring_2, 3000) 30 | 31 | cross_1 = filt_2 * cross_feed 32 | cross_2 = filt_1 * cross_feed 33 | 34 | del_1.setInput(filt_1 * feed + cross_1 + in_src) 35 | del_2.setInput(filt_2 * feed + cross_2 + in_src) 36 | 37 | mix = Mix([filt_1, filt_2], voices=2) 38 | output = Compress(mix, thresh=-30, ratio=4, knee=0.5).out() 39 | 40 | s.gui(locals()) 41 | -------------------------------------------------------------------------------- /pyo/examples/synthesis/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/synthesis/__init__.py -------------------------------------------------------------------------------- /pyo/examples/wxgui/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/wxgui/__init__.py -------------------------------------------------------------------------------- /pyo/examples/x01-intro/01-audio-server.py: -------------------------------------------------------------------------------- 1 | """ 2 | 01-audio-server.py - Booting the audio server. 3 | 4 | A Server object needs to be created before any other audio object. 5 | It is the one that handles the communication with the audio and midi 6 | drivers and also the one that keeps track of the processing chain. 7 | 8 | """ 9 | from pyo import * 10 | 11 | # Creates a Server object with default arguments. 12 | # See the manual about how to change the sampling rate, the buffer 13 | # size, the number of channels or one of the other global settings. 14 | s = Server() 15 | 16 | # Boots the server. This step initializes audio and midi streams. 17 | # Audio and midi configurations (if any) must be done before that call. 18 | s.boot() 19 | 20 | # Starts the server. This step activates the server processing loop. 21 | s.start() 22 | 23 | # Here comes the processing chain... 24 | 25 | # The Server object provides a Graphical User Interface with the 26 | # gui() method. One of its purpose is to keep the program alive 27 | # while computing samples over time. If the locals dictionary is 28 | # given as argument, the user can continue to send commands to the 29 | # python interpreter from the GUI. 30 | s.gui(locals()) 31 | -------------------------------------------------------------------------------- /pyo/examples/x01-intro/02-sine-tone.py: -------------------------------------------------------------------------------- 1 | """ 2 | 02-sine-tone.py - The "hello world" of audio programming! 3 | 4 | This script simply plays a 1000 Hz sine tone. 5 | 6 | """ 7 | from pyo import * 8 | 9 | # Creates and boots the server. 10 | # The user should send the "start" command from the GUI. 11 | s = Server().boot() 12 | # Drops the gain by 20 dB. 13 | s.amp = 0.1 14 | 15 | # Creates a sine wave player. 16 | # The out() method starts the processing 17 | # and sends the signal to the output. 18 | a = Sine().out() 19 | 20 | # Opens the server graphical interface. 21 | s.gui(locals()) 22 | -------------------------------------------------------------------------------- /pyo/examples/x01-intro/03-parallel-proc.py: -------------------------------------------------------------------------------- 1 | """ 2 | 03-parallel-proc.py - Multiple processes on a single source. 3 | 4 | This example shows how to play different audio objects side-by-side. 5 | Every processing object (ie the ones that modify an audio source) have 6 | a first argument called "input". This argument takes the audio object 7 | to process. 8 | 9 | Note the input variable given to each processing object and the call 10 | to the out() method of each object that should send its samples to the 11 | output. 12 | 13 | """ 14 | from pyo import * 15 | 16 | s = Server().boot() 17 | s.amp = 0.1 18 | 19 | # Creates a sine wave as the source to process. 20 | a = Sine() 21 | 22 | # Passes the sine wave through an harmonizer. 23 | hr = Harmonizer(a).out() 24 | 25 | # Also through a chorus. 26 | ch = Chorus(a).out() 27 | 28 | # And through a frequency shifter. 29 | sh = FreqShift(a).out() 30 | 31 | s.gui(locals()) 32 | -------------------------------------------------------------------------------- /pyo/examples/x01-intro/04-serial-proc.py: -------------------------------------------------------------------------------- 1 | """ 2 | 04-serial-proc.py - Chaining processes on a single source. 3 | 4 | This example shows how to chain processes on a single source. 5 | Every processing object (ie the ones that modify an audio source) have 6 | a first argument called "input". This argument takes the audio object 7 | to process. 8 | 9 | Note the input variable given to each Harmonizer. 10 | 11 | """ 12 | from pyo import * 13 | 14 | s = Server().boot() 15 | s.amp = 0.1 16 | 17 | # Creates a sine wave as the source to process. 18 | a = Sine().out() 19 | 20 | # Passes the sine wave through an harmonizer. 21 | h1 = Harmonizer(a).out() 22 | 23 | # Then the harmonized sound through another harmonizer. 24 | h2 = Harmonizer(h1).out() 25 | 26 | # And again... 27 | h3 = Harmonizer(h2).out() 28 | 29 | # And again... 30 | h4 = Harmonizer(h3).out() 31 | 32 | s.gui(locals()) 33 | -------------------------------------------------------------------------------- /pyo/examples/x01-intro/05-output-channels.py: -------------------------------------------------------------------------------- 1 | """ 2 | 05-output-channels.py - Sending signals to different physical outputs. 3 | 4 | The simplest way to choose the output channel where to send the sound 5 | is to give it as the first argument of the out() method. In fact, the 6 | signature of the out() method reads as: 7 | 8 | .out(chnl=0, inc=1, dur=0, delay=0) 9 | 10 | `chnl` is the output where to send the first audio channel (stream) of 11 | the object. `inc` is the output increment for other audio channels. 12 | `dur` is the living duration, in seconds, of the process and `delay` 13 | is a delay, in seconds, before activating the process. A duration of 14 | 0 means play forever. 15 | 16 | """ 17 | from pyo import * 18 | 19 | s = Server().boot() 20 | s.amp = 0.1 21 | 22 | # Creates a source (white noise) 23 | n = Noise() 24 | 25 | # Sends the bass frequencies (below 1000 Hz) to the left 26 | lp = ButLP(n).out() 27 | 28 | # Sends the high frequencies (above 1000 Hz) to the right 29 | hp = ButHP(n).out(1) 30 | 31 | s.gui(locals()) 32 | -------------------------------------------------------------------------------- /pyo/examples/x01-intro/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/x01-intro/__init__.py -------------------------------------------------------------------------------- /pyo/examples/x02-controls/01-fixed-control.py: -------------------------------------------------------------------------------- 1 | """ 2 | 01-fixed-control.py - Number as argument. 3 | 4 | Audio objects behavior can be controlled by passing 5 | value to their arguments at initialization time. 6 | 7 | """ 8 | from pyo import * 9 | 10 | s = Server().boot() 11 | s.amp = 0.1 12 | 13 | # Sets fundamental frequency 14 | freq = 200 15 | 16 | # Approximates a triangle waveform by adding odd harmonics with 17 | # amplitude proportional to the inverse square of the harmonic number. 18 | h1 = Sine(freq=freq, mul=1).out() 19 | h2 = Sine(freq=freq * 3, phase=0.5, mul=1.0 / pow(3, 2)).out() 20 | h3 = Sine(freq=freq * 5, mul=1.0 / pow(5, 2)).out() 21 | h4 = Sine(freq=freq * 7, phase=0.5, mul=1.0 / pow(7, 2)).out() 22 | h5 = Sine(freq=freq * 9, mul=1.0 / pow(9, 2)).out() 23 | h6 = Sine(freq=freq * 11, phase=0.5, mul=1.0 / pow(11, 2)).out() 24 | 25 | # Displays the final waveform 26 | sp = Scope(h1 + h2 + h3 + h4 + h5 + h6) 27 | 28 | s.gui(locals()) 29 | -------------------------------------------------------------------------------- /pyo/examples/x02-controls/02-dynamic-control.py: -------------------------------------------------------------------------------- 1 | """ 2 | 02-dynamic-control.py - Graphical control for parameters. 3 | 4 | With pyo, it's easy to quickly try some parameter combination 5 | with the controller window already configured for each object. 6 | To open the controller window, just call the ctrl() method on 7 | the object you want to control. 8 | 9 | """ 10 | from pyo import * 11 | 12 | s = Server().boot() 13 | s.amp = 0.1 14 | 15 | # Creates two objects with cool parameters, one per channel. 16 | a = FM().out() 17 | b = FM().out(1) 18 | 19 | # Opens the controller windows. 20 | a.ctrl(title="Frequency modulation left channel") 21 | b.ctrl(title="Frequency modulation right channel") 22 | 23 | # If a list of values is given at a particular argument, the ctrl 24 | # window will show a multislider to set each value separately. 25 | 26 | oscs = Sine([100, 200, 300, 400, 500, 600, 700, 800], mul=0.1).out() 27 | oscs.ctrl(title="Simple additive synthesis") 28 | 29 | s.gui(locals()) 30 | -------------------------------------------------------------------------------- /pyo/examples/x02-controls/03-output-range.py: -------------------------------------------------------------------------------- 1 | """ 2 | 03-output-range.py - The `mul` and `add` attributes. 3 | 4 | Almost all audio objects have a `mul` and `add` attributes. 5 | These are defined inside the PyoObject, which is the base 6 | class for all objects generating audio signal. The manual 7 | page of the PyoObject explains all behaviors common to 8 | audio objects. 9 | 10 | An audio signal outputs samples as floating-point numbers in 11 | the range -1 to 1. The `mul` and `add` attributes can be used 12 | to change the output range. Common uses are for modulating the 13 | amplitude of a sound or for building control signals like low 14 | frequency oscillators. 15 | 16 | A shortcut to automatically manipulate both `mul` and `add` 17 | attributes is to call the range(min, max) method of the 18 | PyoObject. This method sets `mul` and `add` attributes 19 | according to the desired `min` and `max` output values. It 20 | assumes that the generated signal is in the range -1 to 1. 21 | 22 | """ 23 | from pyo import * 24 | 25 | s = Server().boot().start() 26 | 27 | # The `mul` attribute multiplies each sample by its value. 28 | a = Sine(freq=100, mul=0.1) 29 | 30 | # The `add` attribute adds an offset to each sample. 31 | # The multiplication is applied before the addition. 32 | b = Sine(freq=100, mul=0.5, add=0.5) 33 | 34 | # Using the range(min, max) method allows to automatically 35 | # compute both `mul` and `add` attributes. 36 | c = Sine(freq=100).range(-0.25, 0.5) 37 | 38 | # Displays the waveforms 39 | sc = Scope([a, b, c]) 40 | 41 | s.gui(locals()) 42 | -------------------------------------------------------------------------------- /pyo/examples/x02-controls/04-building-lfo.py: -------------------------------------------------------------------------------- 1 | """ 2 | 04-building-lfo.py - Audio control of parameters. 3 | 4 | One of the most important thing with computer music is the 5 | trajectories taken by parameters over time. This is what 6 | gives life to the synthesized sound. 7 | 8 | One way to create moving values is by connecting a low 9 | frequency oscillator to an object's attribute. This script 10 | shows that process. 11 | 12 | Other possibilities that will be covered later use random 13 | class objects or feature extraction from an audio signal. 14 | 15 | """ 16 | from pyo import * 17 | 18 | s = Server().boot() 19 | 20 | # Creates a noise source 21 | n = Noise() 22 | 23 | # Creates an LFO oscillating +/- 500 around 1000 (filter's frequency) 24 | lfo1 = Sine(freq=0.1, mul=500, add=1000) 25 | # Creates an LFO oscillating between 2 and 8 (filter's Q) 26 | lfo2 = Sine(freq=0.4).range(2, 8) 27 | # Creates a dynamic bandpass filter applied to the noise source 28 | bp1 = ButBP(n, freq=lfo1, q=lfo2).out() 29 | 30 | # The LFO object provides more waveforms than just a sine wave 31 | 32 | # Creates a ramp oscillating +/- 1000 around 12000 (filter's frequency) 33 | lfo3 = LFO(freq=0.25, type=1, mul=1000, add=1200) 34 | # Creates a square oscillating between 4 and 12 (filter's Q) 35 | lfo4 = LFO(freq=4, type=2).range(4, 12) 36 | # Creates a second dynamic bandpass filter applied to the noise source 37 | bp2 = ButBP(n, freq=lfo3, q=lfo4).out(1) 38 | 39 | s.gui(locals()) 40 | -------------------------------------------------------------------------------- /pyo/examples/x02-controls/05-math-ops.py: -------------------------------------------------------------------------------- 1 | """ 2 | 05-math-ops.py - Audio objects and arithmetic expressions. 3 | 4 | This script shows how a PyoObject reacts when used inside an 5 | arithmetic expression. 6 | 7 | Multiplication, addition, division and subtraction can be applied 8 | between pyo objects or between pyo objects and numbers. Doing so 9 | returns a Dummy object that outputs the result of the operation. 10 | 11 | A Dummy object is only a place holder to keep track of arithmetic 12 | operations on audio objects. 13 | 14 | PyoObject can also be used in expression with the exponent (**), 15 | modulo (%) and unary negative (-) operators. 16 | 17 | """ 18 | from pyo import * 19 | 20 | s = Server().boot() 21 | s.amp = 0.1 22 | 23 | # Full scale sine wave 24 | a = Sine() 25 | 26 | # Creates a Dummy object `b` with `mul` attribute 27 | # set to 0.5 and leaves `a` unchanged. 28 | b = a * 0.5 29 | b.out() 30 | 31 | # Instance of Dummy class 32 | print(b) 33 | 34 | # Computes a ring modulation between two PyoObjects 35 | # and scales the amplitude of the resulting signal. 36 | c = Sine(300) 37 | d = a * c * 0.3 38 | d.out() 39 | 40 | # PyoObject can be used with Exponent operator. 41 | e = c ** 10 * 0.4 42 | e.out(1) 43 | 44 | # Displays the ringmod and the rectified signals. 45 | sp = Spectrum([d, e]) 46 | sc = Scope([d, e]) 47 | 48 | s.gui(locals()) 49 | -------------------------------------------------------------------------------- /pyo/examples/x02-controls/07-multichannel-expansion-2.py: -------------------------------------------------------------------------------- 1 | """ 2 | 07-multichannel-expansion-2.py - Extended multichannel expansion. 3 | 4 | When using multichannel expansion with lists of different lengths, 5 | the longer list is used to set the number of streams and smaller 6 | lists will be wrap-around to fill the holes. 7 | 8 | This feature is very useful to create complex sonorities. 9 | 10 | """ 11 | from pyo import * 12 | 13 | s = Server().boot() 14 | 15 | # 12 streams with different combinations of `freq` and `ratio`. 16 | a = SumOsc( 17 | freq=[100, 150.2, 200.5, 250.7], 18 | ratio=[0.501, 0.753, 1.255], 19 | index=[0.3, 0.4, 0.5, 0.6, 0.7, 0.4, 0.5, 0.3, 0.6, 0.7, 0.3, 0.5], 20 | mul=0.05, 21 | ) 22 | 23 | # Adds a stereo reverberation to the signal 24 | rev = Freeverb(a.mix(2), size=0.80, damp=0.70, bal=0.30).out() 25 | 26 | s.gui(locals()) 27 | -------------------------------------------------------------------------------- /pyo/examples/x02-controls/09-handling-channels-2.py: -------------------------------------------------------------------------------- 1 | """ 2 | 09-handling-channels-2.py - The `out` method and the physical outputs. 3 | 4 | In a multichannel environment, we can carefully choose which stream 5 | goes to which output channel. To achieve this, we use the `chnl` and 6 | `inc` arguments of the out method. 7 | 8 | chnl : Physical output assigned to the first audio stream of the object. 9 | inc : Output channel increment value. 10 | 11 | """ 12 | from pyo import * 13 | 14 | # Creates a Server with 8 channels 15 | s = Server(nchnls=8).boot() 16 | 17 | # Generates a sine wave 18 | a = Sine(freq=500, mul=0.3) 19 | 20 | # Mixes it up to four streams 21 | b = a.mix(4) 22 | 23 | # Outputs to channels 0, 2, 4 and 6 24 | b.out(chnl=0, inc=2) 25 | 26 | s.gui(locals()) 27 | -------------------------------------------------------------------------------- /pyo/examples/x02-controls/10-handling-channels-3.py: -------------------------------------------------------------------------------- 1 | """ 2 | 10-handling-channels-3.py - Random multichannel outputs. 3 | 4 | If `chnl` is negative, streams begin at 0, increment the output 5 | number by inc and wrap around the global number of channels. 6 | Then, the list of streams is scrambled. 7 | 8 | """ 9 | from pyo import * 10 | 11 | # Creates a Server with 8 channels 12 | s = Server(nchnls=8).boot() 13 | 14 | amps = [0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4] 15 | 16 | # Generates 8 sine waves with 17 | # increasing amplitudes 18 | a = Sine(freq=500, mul=amps) 19 | 20 | # Shuffles physical output channels 21 | a.out(chnl=-1) 22 | 23 | s.gui(locals()) 24 | -------------------------------------------------------------------------------- /pyo/examples/x02-controls/11-handling-channels-4.py: -------------------------------------------------------------------------------- 1 | """ 2 | 11-handling-channels-4.py - Explicit control of the physical outputs. 3 | 4 | If `chnl` is a list, successive values in the list will be assigned 5 | to successive streams. 6 | 7 | """ 8 | from pyo import * 9 | 10 | # Creates a Server with 8 channels 11 | s = Server(nchnls=8).boot() 12 | 13 | amps = [0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4] 14 | 15 | # Generates 8 sine waves with 16 | # increasing amplitudes 17 | a = Sine(freq=500, mul=amps) 18 | 19 | # Sets the output channels ordering 20 | a.out(chnl=[3, 4, 2, 5, 1, 6, 0, 7]) 21 | 22 | s.gui(locals()) 23 | -------------------------------------------------------------------------------- /pyo/examples/x02-controls/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/x02-controls/__init__.py -------------------------------------------------------------------------------- /pyo/examples/x03-generators/02-band-limited-oscs.py: -------------------------------------------------------------------------------- 1 | """ 2 | 02-band-limited-oscs.py - Oscillators whose spectrum is kept under the Nyquist frequency. 3 | 4 | This tutorial presents an object (misnamed LFO but it's too late 5 | to change its name!) that implements various band-limited waveforms. 6 | A band-limited signal is a signal that none of its partials exceeds 7 | the Nyquist frequency (sr/2). 8 | 9 | The LFO object, despite its name, can be use as a standard oscillator, 10 | with very high fundamental frequencies. At lower frequencies (below 20 Hz) 11 | this object will give a true LFO with various shapes. 12 | 13 | The "type" slider in the controller window lets choose between these 14 | particular waveforms: 15 | 16 | 0. Saw up (default) 17 | 1. Saw down 18 | 2. Square 19 | 3. Triangle 20 | 4. Pulse 21 | 5. Bipolar pulse 22 | 6. Sample and hold 23 | 7. Modulated Sine 24 | 25 | """ 26 | from pyo import * 27 | 28 | s = Server().boot() 29 | 30 | # Sets fundamental frequency. 31 | freq = 187.5 32 | 33 | # LFO applied to the `sharp` attribute 34 | lfo = Sine(0.2, mul=0.5, add=0.5) 35 | 36 | # Various band-limited waveforms 37 | osc = LFO(freq=freq, sharp=lfo, mul=0.4).out() 38 | osc.ctrl() 39 | 40 | # Displays the waveform 41 | sc = Scope(osc) 42 | 43 | # Displays the spectrum contents 44 | sp = Spectrum(osc) 45 | 46 | s.gui(locals()) 47 | -------------------------------------------------------------------------------- /pyo/examples/x03-generators/03-fm-generators.py: -------------------------------------------------------------------------------- 1 | """ 2 | 03-fm-generators.py - Frequency modulation synthesis. 3 | 4 | There two objects in the library that implement frequency 5 | modulation algorithms. These objects are very simple, although 6 | powerful. It is also relatively simple to build a custom FM 7 | algorithm, this will be covered in the tutorials on custom 8 | synthesis algorithms. 9 | 10 | Use the "voice" slider of the window "Input interpolator" to 11 | interpolate between the two sources. Use the controller windows 12 | to change the parameters of the FM algorithms. 13 | 14 | Note what happened in the controller window when we give a 15 | list of floats to an object's argument. 16 | 17 | """ 18 | from pyo import * 19 | 20 | s = Server().boot() 21 | 22 | # FM implements the basic Chowning algorithm 23 | fm1 = FM(carrier=250, ratio=[1.5, 1.49], index=10, mul=0.3) 24 | fm1.ctrl() 25 | 26 | # CrossFM implements a frequency modulation synthesis where the 27 | # output of both oscillators modulates the frequency of the other one. 28 | fm2 = CrossFM(carrier=250, ratio=[1.5, 1.49], ind1=10, ind2=2, mul=0.3) 29 | fm2.ctrl() 30 | 31 | # Interpolates between input objects to produce a single output 32 | sel = Selector([fm1, fm2]).out() 33 | sel.ctrl(title="Input interpolator (0=FM, 1=CrossFM)") 34 | 35 | # Displays the spectrum contents of the chosen source 36 | sp = Spectrum(sel) 37 | 38 | s.gui(locals()) 39 | -------------------------------------------------------------------------------- /pyo/examples/x03-generators/04-noise-generators.py: -------------------------------------------------------------------------------- 1 | """ 2 | 04-noise-generators.py - Different pseudo-random noise generators. 3 | 4 | There are three noise generators (beside random generators that 5 | will be covered later) in the library. These are the classic 6 | white noise, pink noise and brown noise. 7 | 8 | Noise: 9 | White noise generator, flat spectrum. 10 | 11 | PinkNoise: 12 | Pink noise generator, 3dB roll off per octave. 13 | 14 | BrownNoise: 15 | Brown noise generator, 6dB roll off per octave. 16 | 17 | Use the "voice" slider of the window "Input interpolator" to 18 | interpolate between the three sources. 19 | 20 | """ 21 | from pyo import * 22 | 23 | s = Server().boot() 24 | 25 | # White noise 26 | n1 = Noise(0.3) 27 | 28 | # Pink noise 29 | n2 = PinkNoise(0.3) 30 | 31 | # Brown noise 32 | n3 = BrownNoise(0.3) 33 | 34 | # Interpolates between input objects to produce a single output 35 | sel = Selector([n1, n2, n3]).out() 36 | sel.ctrl(title="Input interpolator (0=White, 1=Pink, 2=Brown)") 37 | 38 | # Displays the spectrum contents of the chosen source 39 | sp = Spectrum(sel) 40 | 41 | s.gui(locals()) 42 | -------------------------------------------------------------------------------- /pyo/examples/x03-generators/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/x03-generators/__init__.py -------------------------------------------------------------------------------- /pyo/examples/x04-soundfiles/01-read-from-disk.py: -------------------------------------------------------------------------------- 1 | """ 2 | 01-read-from-disk.py - Soundfile playback from disk. 3 | 4 | SfPlayer and friends read samples from a file on disk with control 5 | over playback speed and looping mode. 6 | 7 | Player family: 8 | - **SfPlayer** : Reads many soundfile formats from disk. 9 | - **SfMarkerLooper** : AIFF/WAVE with markers soundfile looper. 10 | - **SfMarkerShuffler** : AIFF/WAVE with markers soundfile shuffler. 11 | 12 | Reading sound file from disk can save a lot of RAM, especially if 13 | the soundfile is big, but it is more CPU expensive than loading 14 | the sound file in memory in a first pass. 15 | 16 | """ 17 | from pyo import * 18 | 19 | s = Server().boot() 20 | 21 | path = SNDS_PATH + "/transparent.aif" 22 | 23 | # stereo playback with a slight shift between the two channels. 24 | sf = SfPlayer(path, speed=[1, 0.995], loop=True, mul=0.4).out() 25 | 26 | s.gui(locals()) 27 | -------------------------------------------------------------------------------- /pyo/examples/x04-soundfiles/02-read-from-disk-2.py: -------------------------------------------------------------------------------- 1 | """ 2 | 02-read-from-disk-2.py - Catching the `end-of-file` signal from the SfPlayer object. 3 | 4 | This example demonstrates how to use the `end-of-file` signal 5 | of the SfPlayer object to trigger another playback (possibly 6 | with another sound, another speed, etc.). 7 | 8 | When a SfPlayer reaches the end of the file, it sends a trigger 9 | (more on trigger later) that the user can retrieve with the 10 | syntax : 11 | 12 | variable_name["trig"] 13 | 14 | """ 15 | from pyo import * 16 | import random 17 | 18 | s = Server().boot() 19 | 20 | # Sound bank 21 | folder = "../snds/" 22 | sounds = ["alum1.wav", "alum2.wav", "alum3.wav", "alum4.wav"] 23 | 24 | # Creates the left and right players 25 | sfL = SfPlayer(folder + sounds[0], speed=1, mul=0.5).out() 26 | sfR = SfPlayer(folder + sounds[0], speed=1, mul=0.5).out(1) 27 | 28 | # Function to choose a new sound and a new speed for the left player 29 | def newL(): 30 | sfL.path = folder + sounds[random.randint(0, 3)] 31 | sfL.speed = random.uniform(0.75, 1.5) 32 | sfL.out() 33 | 34 | 35 | # The "end-of-file" signal triggers the function "newL" 36 | tfL = TrigFunc(sfL["trig"], newL) 37 | 38 | # Function to choose a new sound and a new speed for the right player 39 | def newR(): 40 | sfR.path = folder + sounds[random.randint(0, 3)] 41 | sfR.speed = random.uniform(0.75, 1.5) 42 | sfR.out(1) 43 | 44 | 45 | # The "end-of-file" signal triggers the function "newR" 46 | tfR = TrigFunc(sfR["trig"], newR) 47 | 48 | s.gui(locals()) 49 | -------------------------------------------------------------------------------- /pyo/examples/x04-soundfiles/03-read-from-ram.py: -------------------------------------------------------------------------------- 1 | """ 2 | 03-read-from-ram.py - Soundfile playback from RAM. 3 | 4 | Reading a sound file from the RAM gives the advantage of a very 5 | fast access to every loaded samples. This is very useful for a 6 | lot of processes, such as granulation, looping, creating envelopes 7 | and waveforms and many others. 8 | 9 | The simplest way of loading a sound in RAM is to use the SndTable 10 | object. This example loads a sound file and reads it in loop. 11 | We will see some more evolved processes later... 12 | 13 | """ 14 | from pyo import * 15 | 16 | s = Server().boot() 17 | 18 | path = SNDS_PATH + "/transparent.aif" 19 | 20 | # Loads the sound file in RAM. Beginning and ending points 21 | # can be controlled with "start" and "stop" arguments. 22 | t = SndTable(path) 23 | 24 | # Gets the frequency relative to the table length. 25 | freq = t.getRate() 26 | 27 | # Simple stereo looping playback (right channel is 180 degrees out-of-phase). 28 | osc = Osc(table=t, freq=freq, phase=[0, 0.5], mul=0.4).out() 29 | 30 | s.gui(locals()) 31 | -------------------------------------------------------------------------------- /pyo/examples/x04-soundfiles/06-record-table.py: -------------------------------------------------------------------------------- 1 | """ 2 | 06-record-table.py - Recording live sound in RAM. 3 | 4 | By recording a stream of sound in RAM, one can quickly re-use the 5 | samples in the current process. A combination NewTable - TableRec 6 | is all what one need to record any stream in a table. 7 | 8 | The NewTable object has a `feedback` argument, allowing overdub. 9 | 10 | The TableRec object starts a new recording (records until the table 11 | is full) every time its method `play()` is called. 12 | 13 | """ 14 | from pyo import * 15 | import os 16 | 17 | # Audio inputs must be available. 18 | s = Server(duplex=1).boot() 19 | 20 | # Path of the recorded sound file. 21 | path = os.path.join(os.path.expanduser("~"), "Desktop", "synth.wav") 22 | 23 | # Creates a two seconds stereo empty table. The "feedback" argument 24 | # is the amount of old data to mix with a new recording (overdub). 25 | t = NewTable(length=2, chnls=2, feedback=0.5) 26 | 27 | # Retrieves the stereo input 28 | inp = Input([0, 1]) 29 | 30 | # Table recorder. Call rec.play() to start a recording, it stops 31 | # when the table is full. Call it multiple times to overdub. 32 | rec = TableRec(inp, table=t, fadetime=0.05).play() 33 | 34 | # Reads the content of the table in loop. 35 | osc = Osc(table=t, freq=t.getRate(), mul=0.5).out() 36 | 37 | 38 | def saveToDisk(): 39 | savefileFromTable(table=t, path=path, fileformat=0, sampletype=3) 40 | 41 | 42 | # After two seconds, the table content is saved to a file on disk. 43 | sv = CallAfter(saveToDisk, time=2).play() 44 | 45 | s.gui(locals()) 46 | -------------------------------------------------------------------------------- /pyo/examples/x04-soundfiles/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/x04-soundfiles/__init__.py -------------------------------------------------------------------------------- /pyo/examples/x05-envelopes/01-data-signal-conversion.py: -------------------------------------------------------------------------------- 1 | """ 2 | 01-data-signal-conversion.py - Conversion from number to audio stream. 3 | 4 | The Stream object is a new type introduced by pyo to represent an 5 | audio signal as a vector of floats. It is sometimes useful to be 6 | able to convert simple numbers (python's floats or integers) to 7 | audio signal or to extract numbers from an audio stream. 8 | 9 | The Sig object converts a number to an audio stream. 10 | 11 | The PyoObject.get() method extracts a float from an audio stream. 12 | 13 | """ 14 | from pyo import * 15 | 16 | s = Server().boot() 17 | 18 | # A python integer (or float). 19 | anumber = 100 20 | 21 | # Conversion from number to an audio stream (vector of floats). 22 | astream = Sig(anumber) 23 | 24 | # Use a Print (capital "P") object to print an audio stream. 25 | pp = Print(astream, interval=0.1, message="Audio stream value") 26 | 27 | # Use the get() method to extract a float from an audio stream. 28 | print("Float from audio stream : ", astream.get()) 29 | 30 | s.gui(locals()) 31 | -------------------------------------------------------------------------------- /pyo/examples/x05-envelopes/02-linear-ramp.py: -------------------------------------------------------------------------------- 1 | """ 2 | 02-linear-ramp.py - Portamento, glissando, ramping. 3 | 4 | The SigTo object allows to create audio glissando between the 5 | current value and the target value, within a user-defined time. 6 | The target value can be a float or another PyoObject. A new ramp 7 | is created every time the target value changes. 8 | 9 | Also: 10 | 11 | The VarPort object acts similarly but works only with float and 12 | can call a user-defined callback when the ramp reaches the target 13 | value. 14 | 15 | The PyoObject.set() method is another way create a ramp for any 16 | given parameter that accept audio signal but is not already 17 | controlled with a PyoObject. 18 | 19 | """ 20 | from pyo import * 21 | 22 | s = Server().boot() 23 | 24 | # 2 seconds linear ramp starting at 0.0 and ending at 0.3. 25 | amp = SigTo(value=0.3, time=2.0, init=0.0) 26 | 27 | # Pick a new value four times per second. 28 | pick = Choice([200, 250, 300, 350, 400], freq=4) 29 | 30 | # Print the chosen frequency 31 | pp = Print(pick, method=1, message="Frequency") 32 | 33 | # Add a little portamento on an audio target and detune a second frequency. 34 | freq = SigTo(pick, time=0.01, mul=[1, 1.005]) 35 | # Play with portamento time. 36 | freq.ctrl([SLMap(0, 0.25, "lin", "time", 0.01, dataOnly=True)]) 37 | 38 | # Play a simple wave. 39 | sig = RCOsc(freq, sharp=0.7, mul=amp).out() 40 | 41 | s.gui(locals()) 42 | -------------------------------------------------------------------------------- /pyo/examples/x05-envelopes/03-exponential-ramp.py: -------------------------------------------------------------------------------- 1 | """ 2 | 03-exponential-ramp.py - Exponential portamento with rising and falling times. 3 | 4 | The Port object is designed to filter an audio signal with 5 | different coefficients for rising and falling signals. A lowpass 6 | filter is a good and efficient way of creating an exponential ramp 7 | from a signal containing abrupt changes. The rising and falling 8 | coefficients are controlled in seconds. 9 | 10 | """ 11 | from pyo import * 12 | 13 | s = Server().boot() 14 | 15 | # 2 seconds linear ramp starting at 0.0 and ending at 0.3. 16 | amp = SigTo(value=0.3, time=2.0, init=0.0) 17 | 18 | # Pick a new value four times per second. 19 | pick = Choice([200, 250, 300, 350, 400], freq=4) 20 | 21 | # Print the chosen frequency 22 | pp = Print(pick, method=1, message="Frequency") 23 | 24 | # Add an exponential portamento on an audio target and detune a second frequency. 25 | # Sharp attack for rising notes and long release for falling notes. 26 | freq = Port(pick, risetime=0.001, falltime=0.25, mul=[1, 1.005]) 27 | # Play with portamento times. 28 | freq.ctrl() 29 | 30 | # Play a simple wave. 31 | sig = RCOsc(freq, sharp=0.7, mul=amp).out() 32 | 33 | s.gui(locals()) 34 | -------------------------------------------------------------------------------- /pyo/examples/x05-envelopes/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/x05-envelopes/__init__.py -------------------------------------------------------------------------------- /pyo/examples/x06-filters/01-lowpass-filters.py: -------------------------------------------------------------------------------- 1 | """ 2 | 01-lowpass-filters.py - The effect of the order of a filter. 3 | 4 | For this first example about filtering, we compare the frequency 5 | spectrum of three common lowpass filters. 6 | 7 | - Tone : IIR first-order lowpass 8 | - ButLP : IIR second-order lowpass (Butterworth) 9 | - MoogLP : IIR fourth-order lowpass (+ resonance as an extra parameter) 10 | 11 | Complementary highpass filters for the Tone and ButLP objects are Atone 12 | and ButHP. Another common highpass filter is the DCBlock object, which 13 | can be used to remove DC component from an audio signal. 14 | 15 | The next example will present bandpass filters. 16 | 17 | """ 18 | from pyo import * 19 | 20 | s = Server().boot() 21 | 22 | # White noise generator 23 | n = Noise(0.5) 24 | 25 | # Common cutoff frequency control 26 | freq = Sig(1000) 27 | freq.ctrl([SLMap(50, 5000, "lin", "value", 1000)], title="Cutoff Frequency") 28 | 29 | # Three different lowpass filters 30 | tone = Tone(n, freq) 31 | butlp = ButLP(n, freq) 32 | mooglp = MoogLP(n, freq) 33 | 34 | # Interpolates between input objects to produce a single output 35 | sel = Selector([tone, butlp, mooglp]).out() 36 | sel.ctrl(title="Filter selector (0=Tone, 1=ButLP, 2=MoogLP)") 37 | 38 | # Displays the spectrum contents of the chosen source 39 | sp = Spectrum(sel) 40 | 41 | s.gui(locals()) 42 | -------------------------------------------------------------------------------- /pyo/examples/x06-filters/02-bandpass-filters.py: -------------------------------------------------------------------------------- 1 | """ 2 | 02-bandpass-filters.py - Narrowing a bandpass filter bandwidth. 3 | 4 | This example illustrates the difference between a simple IIR second-order 5 | bandpass filter and a cascade of second-order bandpass filters. A cascade 6 | of four bandpass filters with a high Q can be used as a efficient resonator 7 | on the signal. 8 | 9 | """ 10 | from pyo import * 11 | 12 | s = Server().boot() 13 | 14 | # White noise generator 15 | n = Noise(0.5) 16 | 17 | # Common cutoff frequency control 18 | freq = Sig(1000) 19 | freq.ctrl([SLMap(50, 5000, "lin", "value", 1000)], title="Cutoff Frequency") 20 | 21 | # Common filter's Q control 22 | q = Sig(5) 23 | q.ctrl([SLMap(0.7, 20, "log", "value", 5)], title="Filter's Q") 24 | 25 | # Second-order bandpass filter 26 | bp1 = Reson(n, freq, q=q) 27 | # Cascade of second-order bandpass filters 28 | bp2 = Resonx(n, freq, q=q, stages=4) 29 | 30 | # Interpolates between input objects to produce a single output 31 | sel = Selector([bp1, bp2]).out() 32 | sel.ctrl(title="Filter selector (0=Reson, 1=Resonx)") 33 | 34 | # Displays the spectrum contents of the chosen source 35 | sp = Spectrum(sel) 36 | 37 | s.gui(locals()) 38 | -------------------------------------------------------------------------------- /pyo/examples/x06-filters/03-complex-resonator.py: -------------------------------------------------------------------------------- 1 | """ 2 | 03-complex-resonator.py - Filtering by mean of a complex multiplication. 3 | 4 | ComplexRes implements a resonator derived from a complex 5 | multiplication, which is very similar to a digital filter. 6 | 7 | It is used here to create a rhythmic chime with varying resonance. 8 | 9 | """ 10 | from pyo import * 11 | import random 12 | 13 | s = Server().boot() 14 | 15 | # Six random frequencies. 16 | freqs = [random.uniform(1000, 3000) for i in range(6)] 17 | 18 | # Six different plucking speeds. 19 | pluck = Metro([0.9, 0.8, 0.6, 0.4, 0.3, 0.2]).play() 20 | 21 | # LFO applied to the decay of the resonator. 22 | decay = Sine(0.1).range(0.01, 0.15) 23 | 24 | # Six ComplexRes filters. 25 | rezos = ComplexRes(pluck, freqs, decay, mul=5).out() 26 | 27 | # Change chime frequencies every 7.2 seconds 28 | def new(): 29 | freqs = [random.uniform(1000, 3000) for i in range(6)] 30 | rezos.freq = freqs 31 | 32 | 33 | pat = Pattern(new, 7.2).play() 34 | 35 | s.gui(locals()) 36 | -------------------------------------------------------------------------------- /pyo/examples/x06-filters/04-phasing.py: -------------------------------------------------------------------------------- 1 | """ 2 | 04-phasing.py - The phasing effect. 3 | 4 | The Phaser object implements a variable number of second-order 5 | allpass filters, allowing to quickly build complex phasing effects. 6 | 7 | A phaser is an electronic sound processor used to filter a signal 8 | by creating a series of peaks and troughs in the frequency spectrum. 9 | The position of the peaks and troughs of the waveform being affected 10 | is typically modulated so that they vary over time, creating a sweeping 11 | effect. For this purpose, phasers usually include a low-frequency 12 | oscillator. - https://en.wikipedia.org/wiki/Phaser_(effect) 13 | 14 | A phase shifter unit can be built from scratch with the Allpass2 object, 15 | which implement a second-order allpass filter that create, when added to 16 | the original source, one notch in the spectrum. 17 | 18 | """ 19 | from pyo import * 20 | 21 | s = Server().boot() 22 | 23 | # Simple fadein. 24 | fade = Fader(fadein=0.5, mul=0.2).play() 25 | 26 | # Noisy source. 27 | a = PinkNoise(fade) 28 | 29 | # These LFOs modulate the `freq`, `spread` and `q` arguments of 30 | # the Phaser object. We give a list of two frequencies in order 31 | # to create two-streams LFOs, therefore a stereo phasing effect. 32 | lf1 = Sine(freq=[0.1, 0.15], mul=100, add=250) 33 | lf2 = Sine(freq=[0.18, 0.13], mul=0.4, add=1.5) 34 | lf3 = Sine(freq=[0.07, 0.09], mul=5, add=6) 35 | 36 | # Apply the phasing effect with 20 notches. 37 | b = Phaser(a, freq=lf1, spread=lf2, q=lf3, num=20, mul=0.5).out() 38 | 39 | s.gui(locals()) 40 | -------------------------------------------------------------------------------- /pyo/examples/x06-filters/06-vocoder.py: -------------------------------------------------------------------------------- 1 | """ 2 | 06-vocoder.py - Analysis/resynthesis vocoder effect. 3 | 4 | A vocoder is an analysis/resynthesis process that 5 | uses the spectral envelope of a first sound to shape 6 | the spectrum of a second sound. Usually (for the best 7 | results) the first sound should present a dynamic 8 | spectrum (for both frequencies and amplitudes) and the 9 | second sound should contain a rich and stable spectrum. 10 | 11 | In this example, LFOs are applied to every dynamic argument 12 | of the Vocoder object to show the range of sound effects 13 | the user can get with a vocoder. 14 | 15 | """ 16 | from pyo import * 17 | from random import random 18 | 19 | s = Server().boot() 20 | 21 | # First sound - dynamic spectrum. 22 | spktrm = SfPlayer("../snds/baseballmajeur_m.aif", speed=[1, 1.001], loop=True) 23 | 24 | # Second sound - rich and stable spectrum. 25 | excite = Noise(0.2) 26 | 27 | # LFOs to modulate every parameters of the Vocoder object. 28 | lf1 = Sine(freq=0.1, phase=random()).range(60, 100) 29 | lf2 = Sine(freq=0.11, phase=random()).range(1.05, 1.5) 30 | lf3 = Sine(freq=0.07, phase=random()).range(1, 20) 31 | lf4 = Sine(freq=0.06, phase=random()).range(0.01, 0.99) 32 | 33 | voc = Vocoder(spktrm, excite, freq=lf1, spread=lf2, q=lf3, slope=lf4, stages=32).out() 34 | 35 | s.gui(locals()) 36 | -------------------------------------------------------------------------------- /pyo/examples/x06-filters/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/x06-filters/__init__.py -------------------------------------------------------------------------------- /pyo/examples/x07-effects/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/x07-effects/__init__.py -------------------------------------------------------------------------------- /pyo/examples/x08-dynamics/03-gated-verb.py: -------------------------------------------------------------------------------- 1 | """ 2 | 03-gated-verb.py - Gated reverb applied to a drum loop. 3 | 4 | The gated reverb effect, which was most popular in the 1980s, is made using a 5 | combination of strong reverb and a noise gate. The drum sound passes through 6 | a strong reverb, which is rapidly cut off with a gate driven by the dry signal. 7 | 8 | """ 9 | from pyo import * 10 | 11 | s = Server().boot() 12 | 13 | # Play the drum loop. 14 | sf = SfPlayer("../snds/drumloop.wav", loop=True) 15 | 16 | # Use a gate to generate the gain curve that will be applied to the reverb. 17 | gate = Gate(sf, thresh=-50, risetime=0.005, falltime=0.04, lookahead=4, outputAmp=True) 18 | 19 | # Strong reverb. 20 | rev = Freeverb(sf.mix(2), size=0.95, damp=0.3, bal=1.0) 21 | 22 | # Compress the reverb signal and control its amplitude with the gating signal. 23 | cmp = Compress(rev, thresh=-12, ratio=3, risetime=0.005, falltime=0.05, lookahead=4, knee=0.5, mul=gate,) 24 | 25 | # Balance between the dry and wet (gated-reverb) signals. 26 | output = Interp(sf.mix(2), cmp, interp=0.2).out() 27 | 28 | s.gui(locals()) 29 | -------------------------------------------------------------------------------- /pyo/examples/x08-dynamics/04-rms-tracing.py: -------------------------------------------------------------------------------- 1 | """ 2 | 04-rms-tracing.py - Auto-wah effect. 3 | 4 | The auto-wah effect (also know as "envelope following filter") is like a 5 | wah-wah effect, but instead of being controlled by a pedal, it is the RMS 6 | amplitude of the input sound which control it. The envelope follower (RMS) 7 | is rescaled and used to change the frequency of a bandpass filter applied 8 | to the source. 9 | 10 | """ 11 | from pyo import * 12 | 13 | s = Server().boot() 14 | 15 | MINFREQ = 250 16 | MAXFREQ = 5000 17 | 18 | # Play the drum loop. 19 | sf = SfPlayer("../snds/drumloop.wav", loop=True) 20 | 21 | # Follow the amplitude envelope of the input sound. 22 | follow = Follower(sf) 23 | 24 | # Scale the amplitude envelope (0 -> 1) to the desired frequency 25 | # range (MINFREQ -> MAXFREQ). 26 | freq = Scale(follow, outmin=MINFREQ, outmax=MAXFREQ) 27 | 28 | # Filter the signal with a band pass. Play with the Q to make the 29 | # effect more or less present. 30 | filter = ButBP(sf.mix(2), freq=freq, q=2).out() 31 | 32 | s.gui(locals()) 33 | -------------------------------------------------------------------------------- /pyo/examples/x08-dynamics/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/x08-dynamics/__init__.py -------------------------------------------------------------------------------- /pyo/examples/x09-callbacks/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/x09-callbacks/__init__.py -------------------------------------------------------------------------------- /pyo/examples/x10-tables/07-moving-points.py: -------------------------------------------------------------------------------- 1 | """ 2 | 07-moving-points.py - Periodically rewrite a break-point function table. 3 | 4 | This example shows how we can dynamically modify a function table to create a 5 | curve that varies over time. 6 | 7 | Note: Rewriting a large table can produce glitches in the audio output. Usually, 8 | for this kind of processes, we want to keep the table size relatively small. 9 | 10 | """ 11 | from pyo import * 12 | 13 | s = Server().boot() 14 | 15 | # Initialize an empty table. 16 | table = LinTable([(0, 0), (255, 0)], size=256) 17 | table.view() 18 | 19 | # Two LFOs whose values will change the center points in the table. 20 | lfo1 = Sine(0.1, phase=0.75, mul=0.5, add=0.5) 21 | lfo2 = Sine(0.15, phase=0.75, mul=0.5, add=0.5) 22 | 23 | 24 | def create_line(): 25 | "Function to create a new line." 26 | lst = [(0, 0)] # First point of the table at value 0. 27 | lst.append((8, lfo1.get())) # Second point, from first LFO. 28 | lst.append((128, lfo2.get())) # Third point, from second LFO. 29 | lst.append((255, 0)) # Last point of the table at value 0. 30 | 31 | # Replace the table content with the new list of points. 32 | table.replace(lst) 33 | 34 | 35 | # Call the function "create_line" every 50 ms. 36 | pat = Pattern(function=create_line, time=0.05).play() 37 | 38 | # Little test case... 39 | amp = Osc(table, freq=4, mul=0.4) 40 | synth = RCOsc(freq=[99.5, 100], sharp=0.3, mul=amp).out() 41 | 42 | s.gui(locals()) 43 | -------------------------------------------------------------------------------- /pyo/examples/x10-tables/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/x10-tables/__init__.py -------------------------------------------------------------------------------- /pyo/examples/x14-spectral/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Sound processing in the spectral domain. 3 | 4 | **FFT** 5 | 6 | A Fast Fourier Transform (FFT) is an efficient algorithm to compute the discrete Fourier transform (DFT) and its inverse (IFFT). 7 | 8 | **Phase Vocoder** 9 | 10 | The phase vocoder is a digital signal processing technique of potentially great musical significance. 11 | It can be used to perform very high fidelity time scaling, pitch transposition, and myriad other modifications of sounds. 12 | 13 | Although the following examples are built by hand with raw FFT objects, for educational purposes, most of these 14 | processes (and more) are implemented, with greater efficiency, with the Phase Vocoder algorithm. You should 15 | really take a look at the different PV object's examples in the documentation. 16 | 17 | """ -------------------------------------------------------------------------------- /pyo/examples/x15-matrix/02-matrix-record.py: -------------------------------------------------------------------------------- 1 | """ 2 | 02-matrix-record.py - Wave Terrain Synthesis of a live FM synthesis. 3 | 4 | In this example, an FM synthesis is generated and recorded, row after 5 | row, in the matrix used as the terrain for the synthesis. It is then 6 | scanned with sine waves assigned to x and y positions in the 2D table. 7 | 8 | """ 9 | from pyo import * 10 | 11 | s = Server(duplex=0).boot() 12 | 13 | # Size of a square matrix. 14 | SIZE = 256 15 | # Creates the terrain. 16 | field = NewMatrix(SIZE, SIZE) 17 | 18 | # Produces a source sound to record in the terrain. 19 | fmind = Sine(freq=1.2, mul=2, add=2.5) 20 | fmrat = Sine(freq=1.33, mul=0.25, add=0.5) 21 | fm = FM(carrier=10, ratio=fmrat, index=fmind) 22 | 23 | # Record the source into the matrix, row after row, until the matrix is full. 24 | rec = MatrixRec(input=fm, matrix=field).play() 25 | 26 | # LFOs applied to the amplitude of the x and y pointers reading the matrix. 27 | lfx = Sine(freq=0.07, mul=0.24, add=0.25) 28 | lfy = Sine(freq=0.05, mul=0.2, add=0.25) 29 | # The x and y reading pointers. 30 | x = Sine(freq=[505, 499.9], mul=lfx, add=0.5) 31 | y = Sine(freq=[40.5, 37.6], mul=lfy, add=0.5) 32 | 33 | # 2D table lookup with linear interpolation in the matrix. 34 | c = MatrixPointer(matrix=field, x=x, y=y, mul=0.25) 35 | 36 | # Lowpass filtering of the output signal. 37 | filt = Tone(input=c, freq=3000).out() 38 | 39 | # Signals when the recording is done. 40 | def func(): 41 | print("End of recording") 42 | 43 | tr = TrigFunc(rec["trig"], func) 44 | 45 | s.gui(locals()) 46 | -------------------------------------------------------------------------------- /pyo/examples/x15-matrix/04-algo-with-matrix.py: -------------------------------------------------------------------------------- 1 | """ 2 | 04-algo-with-matrix.py - MIDI algorithm with a 2D matrix. 3 | 4 | This script demonstrates how to use a matrix to do some algorithmic generation of notes. 5 | 6 | """ 7 | from pyo import * 8 | 9 | s = Server(duplex=0, audio="jack").boot() 10 | 11 | # Matrix of 4 rows of 4 MIDI notes each. 12 | mat = [ 13 | [36, 41, 43, 48], 14 | [48, 51, 53, 57], 15 | [60, 62, 67, 68], 16 | [70, 72, 74, 77] 17 | ] 18 | 19 | notes = NewMatrix(4, 4, mat) 20 | 21 | # X position is chosen randomly (2 audio streams for a stereo output). 22 | x = RandInt(max=4, freq=[4, 8], mul=0.25) 23 | 24 | # Y position is a simple metronomic count from 0 to 3 (again 2 audio streams). 25 | met = Metro(time=[0.5, 1]).play() 26 | y = Counter(input=met, min=0, max=4, mul=0.25) 27 | 28 | # Pick MIDI notes in the matrix. 29 | midi = MatrixPointer(matrix=notes, x=x, y=y) 30 | 31 | # Converts MIDI notes to frequencies. 32 | freq = [MToF(midi[0] - 12), MToF(midi[1])] 33 | 34 | # Simple synthesizer. 35 | synth = LFO(freq=freq, sharp=0.75, type=2, mul=0.25) 36 | chorus = Chorus(synth).out() 37 | 38 | s.gui(locals()) 39 | -------------------------------------------------------------------------------- /pyo/examples/x15-matrix/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/x15-matrix/__init__.py -------------------------------------------------------------------------------- /pyo/examples/x16-midi/07-midifile-with-mido.py: -------------------------------------------------------------------------------- 1 | """ 2 | 07-midifile-with-mido.py - Reading a MIDI file with mido and sending the events to pyo. 3 | 4 | This example shows how simple it is to play a MIDI file with mido and send the events 5 | to an audio synth build with pyo. 6 | 7 | """ 8 | from pyo import * 9 | 10 | # Try to import MidiFile from the mido module. You can install mido with pip: 11 | # pip install mido 12 | 13 | try: 14 | from mido import MidiFile 15 | except: 16 | print("The `mido` module must be installed to run this example!") 17 | exit() 18 | 19 | s = Server().boot().start() 20 | 21 | # A little audio synth to play the MIDI events. 22 | mid = Notein() 23 | amp = MidiAdsr(mid["velocity"]) 24 | pit = MToF(mid["pitch"]) 25 | osc = Osc(SquareTable(), freq=pit, mul=amp).mix(1) 26 | rev = STRev(osc, revtime=1, cutoff=4000, bal=0.2).out() 27 | 28 | # Opening the MIDI file... 29 | mid = MidiFile("../snds/mapleleafrag.mid") 30 | 31 | # ... and reading its content. 32 | for message in mid.play(): 33 | # For each message, we convert it to integer data with the bytes() 34 | # method and send the values to pyo's Server with the addMidiEvent() 35 | # method. This method programmatically adds a MIDI message to the 36 | # server's internal MIDI event buffer. 37 | s.addMidiEvent(*message.bytes()) 38 | -------------------------------------------------------------------------------- /pyo/examples/x16-midi/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/x16-midi/__init__.py -------------------------------------------------------------------------------- /pyo/examples/x17-osc/01-osc-scan.py: -------------------------------------------------------------------------------- 1 | """ 2 | 01-osc-scan.py - Scan Open Sound Control inputs on a specific port 3 | 4 | Scan Open Sound Control inputs on a specific port. This program 5 | can be used to find the address used by a specific device or the 6 | range of values sent on a given address. 7 | 8 | """ 9 | from pyo import * 10 | 11 | # Set the port number. 12 | port = 9002 13 | 14 | s = Server().boot().start() 15 | 16 | print("Play with your OSC interface...") 17 | 18 | # Function called whenever OscDataReceive receives an input. 19 | def printInputMessage(address, *args): 20 | print("Address =", address) 21 | print("Values =", args) 22 | print("---------------") 23 | 24 | 25 | # OscDataReceive accepts any kind of OSC message. 26 | # The wildcard alone ("*") to the address argument means that 27 | # the object will monitor any address on the port. 28 | scan = OscDataReceive(port=port, address="*", function=printInputMessage) 29 | 30 | s.gui(locals()) 31 | -------------------------------------------------------------------------------- /pyo/examples/x17-osc/03-send-streams.py: -------------------------------------------------------------------------------- 1 | """ 2 | 03-send-streams.py - Sending audio streams as Open Sound Control messages 3 | 4 | This program does not generate any sound. All it does is to produce 5 | audio streams that are then send on an open port as OSC messages in 6 | order to control a granulation process created in the example 7 | *02-receive-streams.py*. 8 | 9 | """ 10 | from pyo import * 11 | 12 | s = Server().boot() 13 | 14 | # Manual control of the density of grains per second. 15 | dens = Sig(0.5) 16 | dens.ctrl(title="Density of grains per second") 17 | 18 | # Generate a normalized random position in the sound with interpolation. 19 | pos = Randi(min=0.00, max=1.00, freq=0.1) 20 | 21 | # Manual control of the transposition per grain. 22 | pit = Sig(0) 23 | pit.ctrl(title="Transposition per grain") 24 | 25 | # Manual control of the grain's duration. 26 | dur = Sig(0.5) 27 | dur.ctrl(title="Grain duration") 28 | 29 | # Takes audio signals and sends their current value as OSC messages every buffer size. 30 | send = OscSend( 31 | input=[dens, pos, pit, dur], 32 | port=9000, 33 | address=["/density", "/position", "/pitch_rand", "/duration"], 34 | host="127.0.0.1", 35 | ) 36 | 37 | s.gui(locals()) 38 | -------------------------------------------------------------------------------- /pyo/examples/x17-osc/04-receive-list.py: -------------------------------------------------------------------------------- 1 | """ 2 | 04-receive-list.py - Receiving OSC messages as list of audio streams 3 | 4 | OscListReceive receives list of values over a network via the Open Sound 5 | Control protocol. It converts the values as audio streams that can be used 6 | to control audio process. 7 | 8 | """ 9 | from pyo import * 10 | 11 | s = Server().boot() 12 | 13 | source = SfPlayer("../snds/flute.aif", loop=True, mul=0.7) 14 | 15 | # Receives a list of two values from a TouchOSC's XY pad and converts 16 | # them as audio streams. All streams for a given address can be retrieve 17 | # with the syntax: rec[address]. One can access the individual streams 18 | # for an address with slicing: rec[address][0], rec[address][1], etc. 19 | rec = OscListReceive(port=9002, address="/4/xy", num=2) 20 | 21 | # Sets initial values for the OSC streams. This allow the program to run with 22 | # minimal behavior even if no message have been sent on this address. 23 | rec.setValue("/4/xy", [0.5, 0.5]) 24 | 25 | # Assign the value on the X axis to the drive parameter, and 26 | # the value on the Y axis to the slope (lowpass filter) parameter. 27 | disto = Disto(source, drive=Sqrt(rec["/4/xy"][0]), slope=Sqrt(rec["/4/xy"][1]), mul=0.5).mix(2).out() 28 | 29 | s.gui(locals()) 30 | -------------------------------------------------------------------------------- /pyo/examples/x17-osc/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/x17-osc/__init__.py -------------------------------------------------------------------------------- /pyo/examples/x19-multirate/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/x19-multirate/__init__.py -------------------------------------------------------------------------------- /pyo/examples/x20-multicore/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/x20-multicore/__init__.py -------------------------------------------------------------------------------- /pyo/examples/x21-utilities/01-list-to-audio-file.py: -------------------------------------------------------------------------------- 1 | """ 2 | 01-list-to-audio-file.py - Saving list of floats to audio file on disk 3 | 4 | This program generates 5 seconds of white noise with pure python function 5 | and saves the samples in a file called noise.aif on the Desktop. 6 | 7 | """ 8 | 9 | from pyo import savefile 10 | from random import uniform 11 | import os 12 | 13 | # Create the path for the audio file. 14 | home = os.path.expanduser("~") 15 | path = os.path.join(home, "Desktop", "noise.aif") 16 | 17 | # Audio file properties (sampling rate, duration and number of channels). 18 | sr = 44100 19 | dur = 5 20 | chnls = 2 21 | 22 | # Generate a list of `chnls` sub-lists with `sr * dur` floats in each of them. 23 | samples = [[uniform(-0.5, 0.5) for i in range(sr * dur)] for i in range(chnls)] 24 | 25 | # Save the list of floats in an audio file on disk. 26 | savefile(samples=samples, path=path, sr=sr, channels=chnls, fileformat=1, sampletype=1) 27 | -------------------------------------------------------------------------------- /pyo/examples/x21-utilities/04-buffer-interface.py: -------------------------------------------------------------------------------- 1 | """ 2 | 04-buffer-interface.py - Sharing a table with a numpy array using the buffer protocol 3 | 4 | This example shows two things: 5 | 6 | 1. How to share memory from a PyoTableObject to a numpy array with the 7 | `getBuffer()` method of the PyoTableObject. Numpy functions can then 8 | be used to modify the table's content without copying every samples. 9 | 10 | 2. How to register a `callback` function, with the `setCallback()` method 11 | of the Server object, that the server will call at the beginning of 12 | every processing loop (each `buffersize` samples). 13 | 14 | .. note:: 15 | 16 | The numpy module **must** be installed for this example to work. 17 | 18 | """ 19 | from pyo import * 20 | import numpy as np 21 | 22 | s = Server().boot() 23 | 24 | # Get the length of an audio block. 25 | bs = s.getBufferSize() 26 | 27 | # Create a table of length `buffer size` and read it in loop. 28 | t = DataTable(size=bs) 29 | osc = TableRead(t, freq=t.getRate(), loop=True, mul=0.1).out() 30 | 31 | # Share the table's memory with a numpy array. 32 | arr = np.asarray(t.getBuffer()) 33 | 34 | 35 | def process(): 36 | "Fill the array (so the table) with white noise." 37 | arr[:] = np.random.normal(0.0, 0.5, size=bs) 38 | 39 | 40 | # Register the `process` function to be called at the beginning 41 | # of every processing loop. 42 | s.setCallback(process) 43 | 44 | s.gui(locals()) 45 | -------------------------------------------------------------------------------- /pyo/examples/x21-utilities/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/x21-utilities/__init__.py -------------------------------------------------------------------------------- /pyo/examples/x22-events/06-randoms.py: -------------------------------------------------------------------------------- 1 | """ 2 | 06-randoms.py - Exploring random generators. 3 | 4 | This example presents two more generators that randomly choose values. 5 | 6 | **EventChoice** :: 7 | 8 | EventChoice(values, occurrences=inf, stopEventsWhenDone=True) 9 | 10 | EventChoice randomly pick a new value in a list of possible values. 11 | 12 | **EventDrunk** :: 13 | 14 | EventDrunk(values, maxStep=2, occurrences=inf, stopEventsWhenDone=True) 15 | 16 | EventDrunk performs a random walk over a list of values. The 'maxStep' 17 | argument determine the larger step in the list the walk can do between 18 | two successive events. A negative 'maxStep' is the same but repetition 19 | are not allowed. 20 | 21 | """ 22 | 23 | from pyo import * 24 | 25 | s = Server().boot() 26 | 27 | scl = [5.00, 5.02, 5.03, 5.05, 5.07, 5.08, 5.10, 6.00, 6.02, 6.03, 6.05, 6.07] 28 | 29 | # Random walk for the melody. 30 | e1 = Events( 31 | degree=EventDrunk(scl, maxStep=-2), beat=1 / 4.0, db=-6, attack=0.001, decay=0.05, sustain=0.5, release=0.005, 32 | ).play() 33 | 34 | # Choose randomly for the bass. 35 | e2 = Events( 36 | degree=EventChoice(scl), beat=1, db=-6, transpo=-12, attack=0.001, decay=0.05, sustain=0.5, release=0.005, 37 | ).play() 38 | 39 | s.gui(locals()) 40 | -------------------------------------------------------------------------------- /pyo/examples/x22-events/08-function-calls.py: -------------------------------------------------------------------------------- 1 | """ 2 | 08-function-calls.py - Using custom algorithms with python function calls. 3 | 4 | **EventCall** :: 5 | 6 | EventCall(function, *args, occurrences=inf, stopEventsWhenDone=True) 7 | 8 | EventCall calls a function, with any number of arguments (\*args) and uses 9 | its return value for the given parameter. The example below use a function 10 | from the random module, *randrange*, with arguments and a user-defined 11 | function, without argument, to create a rising, then falling, amplitude curve. 12 | 13 | """ 14 | 15 | import random 16 | from pyo import * 17 | 18 | s = Server().boot() 19 | 20 | db = -30 21 | dir = 1 22 | 23 | 24 | def riseFallAmp(): 25 | "Rises and falls amplitude between -30 and -3 dB, 1 db at the time." 26 | global db, dir 27 | db += dir 28 | if db >= -3: 29 | dir = -1 30 | elif db < -30: 31 | dir = 1 32 | return db 33 | 34 | 35 | # Midi notes are chosen randomly with a function from the random module, 36 | # while the amplitude change according to the riseFallAmp function's output. 37 | e = Events( 38 | midinote=EventCall(random.randrange, 48, 72, 3), 39 | beat=1 / 4.0, 40 | db=EventCall(riseFallAmp), 41 | attack=0.001, 42 | decay=0.05, 43 | sustain=0.5, 44 | release=0.005, 45 | ).play() 46 | 47 | 48 | s.gui(locals()) 49 | -------------------------------------------------------------------------------- /pyo/examples/x22-events/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/x22-events/__init__.py -------------------------------------------------------------------------------- /pyo/examples/x23-expression/05-define-function.py: -------------------------------------------------------------------------------- 1 | """ 2 | 05-define-function.py - Creating our own functions 3 | 4 | The define keyword starts the definition of a custom function. The syntax is: 5 | 6 | .. code-block:: scheme 7 | 8 | (define funcname (body)) 9 | 10 | `funcname` is the name used to call the function in the expression and body 11 | is the sequence of expressions to execute. Arguments of the function are 12 | extracted directly from the body. They must be named $1, $2, $3, …, $9. 13 | 14 | The following example defines two functions, a simple oscillator and a 15 | frequency modulation function using the former one. 16 | 17 | """ 18 | from pyo import * 19 | 20 | s = Server().boot() 21 | 22 | expression = """ 23 | // usage: (osc freq) 24 | (define osc ( 25 | sin (* twopi (~ $1)) 26 | ) 27 | ) 28 | 29 | // usage: (fm carrier ratio lfo_freq) 30 | (define fm ( 31 | (let #car $1) // carrier 32 | (let #rat $2) // ratio 33 | (let #ind (+ (* (osc $3) 5) 5)) // lfo on the index 34 | (osc (+ #car (* (osc (* #car #rat)) (* #car (* #rat #ind))))) 35 | ) 36 | ) 37 | 38 | // Two FM generators. 39 | * (+ (fm 172 0.251 .1) 40 | (fm 86 0.499 .15)) 41 | 0.5 42 | 43 | """ 44 | 45 | expr = Expr(Sig(0), expression, mul=0.5) 46 | expr.editor() 47 | 48 | sc = Scope(expr) 49 | 50 | pan = Pan(expr).out() 51 | 52 | s.gui(locals()) 53 | -------------------------------------------------------------------------------- /pyo/examples/x23-expression/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/examples/x23-expression/__init__.py -------------------------------------------------------------------------------- /pyo/examples/x23-expression/utils.expr: -------------------------------------------------------------------------------- 1 | // Takes a signal in the range [0, 1] and scales it to [min, max] range. 2 | // usage: scale(signal min max) 3 | (define scale ( 4 | (+ (* $1 (- $3 $2)) $2) 5 | ) 6 | ) 7 | // Takes a signal in the range [-1, 1] and scales it to [min, max] range. 8 | // usage: scalef(signal min max) 9 | (define scalef ( 10 | (let #middle (* (+ $2 $3) 0.5)) 11 | (let #range (* (- $3 $2) 0.5)) 12 | (+ (* $1 #range) #middle) 13 | ) 14 | ) -------------------------------------------------------------------------------- /pyo/lib/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/lib/__init__.py -------------------------------------------------------------------------------- /pyo/lib/snds/IRMediumHallStereo.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/lib/snds/IRMediumHallStereo.wav -------------------------------------------------------------------------------- /pyo/lib/snds/NoteinRead_example_test_000: -------------------------------------------------------------------------------- 1 | 0.000000 48 0.15 2 | 0.500000 55 0.25 3 | 1.000000 58 0.35 4 | 1.500000 60 0.5 5 | 2.000000 62 0.65 6 | 2.500000 64 0.5 7 | 3.000000 60 0.35 8 | 3.500000 58 0.25 9 | 4.000000 67 0.15 10 | 11 | -------------------------------------------------------------------------------- /pyo/lib/snds/NoteinRead_example_test_001: -------------------------------------------------------------------------------- 1 | 0.250000 48 0.15 2 | 0.750000 55 0.25 3 | 1.250000 58 0.35 4 | 1.750000 60 0.5 5 | 2.250000 62 0.65 6 | 2.750000 64 0.5 7 | 3.250000 60 0.35 8 | 3.750000 58 0.25 9 | 4.250000 67 0.15 10 | 11 | -------------------------------------------------------------------------------- /pyo/lib/snds/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/lib/snds/__init__.py -------------------------------------------------------------------------------- /pyo/lib/snds/accord.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/lib/snds/accord.aif -------------------------------------------------------------------------------- /pyo/lib/snds/transparent.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/pyo/lib/snds/transparent.aif -------------------------------------------------------------------------------- /pyo64/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Copyright 2009-2015 Olivier Belanger 3 | 4 | This file is part of pyo, a python module to help digital signal 5 | processing script creation. 6 | 7 | pyo is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU Lesser General Public License as 9 | published by the Free Software Foundation, either version 3 of the 10 | License, or (at your option) any later version. 11 | 12 | pyo is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General Public 18 | License along with pyo. If not, see . 19 | """ 20 | import builtins 21 | 22 | builtins.pyo_use_double = True 23 | 24 | from pyo import * 25 | -------------------------------------------------------------------------------- /release-notes/pyo_release_0.8.2.txt: -------------------------------------------------------------------------------- 1 | [English version follows] 2 | 3 | Bonjour à tous, 4 | 5 | La version 0.8.2 de pyo est maintenant disponible en téléchargement : 6 | 7 | http://ajaxsoundstudio.com/software/pyo/ 8 | 9 | La documentation: 10 | 11 | http://ajaxsoundstudio.com/pyodoc/ 12 | 13 | Sources and suivi des bugs: 14 | 15 | https://github.com/belangeo/pyo 16 | 17 | 18 | Changements: 19 | 20 | - Problème de latence élevée avec portaudio réglé. 21 | 22 | - Les objets TrigFunc et Pattern acceptent maintenant un tuple comme argument "arg". 23 | 24 | - E-Pyo: La fenêtre de documentation affiche correctement la documentation des objets. 25 | 26 | - Amélioration de la gestion des évènements midi en entrée. 27 | 28 | - L'interpolation des contrôleurs midi continus est maintenant à off par défaut. 29 | 30 | 31 | Olivier 32 | 33 | --- 34 | 35 | Hello all, 36 | 37 | pyo 0.8.2 is now available to download on pyo's web site : 38 | 39 | http://ajaxsoundstudio.com/software/pyo/ 40 | 41 | pyo's documentation: 42 | 43 | http://ajaxsoundstudio.com/pyodoc/ 44 | 45 | Latest sources and bug tracker: 46 | 47 | https://github.com/belangeo/pyo 48 | 49 | 50 | What's new: 51 | 52 | - Fixed latency issue when using portaudio as audio backend. 53 | 54 | - TrigFunc and Pattern now accept a tuple as "arg" argument (fixed issue #90). 55 | 56 | - E-Pyo: Fixed a bug in the documentation window. 57 | 58 | - Fixed midi input events handling. 59 | 60 | - Set interpolation to off by default for midi continuous controllers. 61 | 62 | 63 | Olivier 64 | -------------------------------------------------------------------------------- /scripts/release_doc_src.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # 4 | # 1. change version number 5 | # 2. cd doc; python build.py 6 | # 3. Execute from pyo folder : ./scripts/release_doc_src.sh 7 | # 8 | 9 | version=1.0.6 10 | replace=XXX 11 | 12 | doc_rep=pyo_XXX-doc 13 | doc_tar=pyo_XXX-doc.tar.bz2 14 | 15 | src_rep=pyo_XXX-src 16 | src_tar=pyo_XXX-src.tar.bz2 17 | 18 | cp -R ./doc/build_html ./doc/${doc_rep/$replace/$version} 19 | cd doc 20 | tar -cjvf ${doc_tar/$replace/$version} ${doc_rep/$replace/$version} 21 | rm -R ${doc_rep/$replace/$version} 22 | cd .. 23 | 24 | git checkout-index -a -f --prefix=${src_rep/$replace/$version}/ 25 | tar -cjvf ${src_tar/$replace/$version} ${src_rep/$replace/$version} 26 | rm -R ${src_rep/$replace/$version} 27 | -------------------------------------------------------------------------------- /scripts/release_wheels_Win.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | RMDIR /S /Q build 4 | RMDIR /S /Q dist 5 | 6 | py -3.9 -m build --wheel --config-setting="--build-option=--use-double" 7 | py -3.10 -m build --wheel --config-setting="--build-option=--use-double" 8 | py -3.11 -m build --wheel --config-setting="--build-option=--use-double" 9 | py -3.12 -m build --wheel --config-setting="--build-option=--use-double" 10 | py -3.13 -m build --wheel --config-setting="--build-option=--use-double" 11 | -------------------------------------------------------------------------------- /scripts/win/windows-10-64bit-build-routine.txt: -------------------------------------------------------------------------------- 1 | === STEP 1 === 2 | --- Install msys2 64-bit and update it 3 | 4 | === STEP 2 === 5 | --- Install msys2 packages (pacman -S package_name) 6 | 7 | * setup.py file assumes that msys2 is installed on the default location. If 8 | not, you'll have to change the paths in include_dirs and library_dirs to 9 | reflect your installation. 10 | 11 | mingw-w64-x86_64-toolchain 12 | make 13 | autoconf 14 | automake 15 | libtool 16 | subversion 17 | 18 | === STEP 3 === 19 | Add the MinGW and MSYS2 bin dirs to your Windows PATH: 20 | 21 | Open System Properties, click Environment Variables, 22 | Then edit the system Path variable. Add these two paths in this order: 23 | 24 | C:\msys64\mingw64\bin 25 | C:\msys64\usr\bin 26 | 27 | === STEP 4 === 28 | --- Install Git 29 | https://git-scm.com/download/win 30 | 31 | === STEP 5 === 32 | --- Install Visual Studio Community 2022 33 | 34 | === STEP 6 === 35 | --- Clone vcpkg repo and bootstrap it. 36 | 37 | === STEP 7 === 38 | From vcpkg repo, install portaudio, portmidi, libsndfile, liblo and pthreads 39 | 40 | === STEP 8 === 41 | --- Install Python 3.9+ 64-bit. 42 | --- Add PythonXX and PythonXX\Scripts paths to environment variables. 43 | 44 | === STEP 9 === 45 | Update python modules (for all python versions) 46 | 47 | py -3.x -m pip install -U pip build numpy pytest wxPython 48 | 49 | === STEP 10 === 50 | --- Download pyo sources from git and build it with (in a standard command prompt): 51 | 52 | py -X.X -m build --config-setting="--build-option=--use-double" 53 | -------------------------------------------------------------------------------- /tests/bébêtte/IRMediumHallStereo.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/tests/bébêtte/IRMediumHallStereo.wav -------------------------------------------------------------------------------- /tests/bébêtte/noise.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/tests/bébêtte/noise.aif -------------------------------------------------------------------------------- /tests/bébêtte/transparent.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/belangeo/pyo/a7cbe87a52330defdede1f31d29ed719712a08a8/tests/bébêtte/transparent.aif -------------------------------------------------------------------------------- /tests/pytests/conftest.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from pyo import Server 3 | 4 | @pytest.fixture 5 | def audio_server(): 6 | # setup 7 | server = Server(sr=48000, buffersize=512, audio="manual").boot() 8 | 9 | yield server 10 | 11 | # teardown 12 | server.shutdown() 13 | -------------------------------------------------------------------------------- /tests/test_Expr_object/expr_test_01_simple.py: -------------------------------------------------------------------------------- 1 | from pyo import * 2 | 3 | s = Server().boot() 4 | s.amp = 0.1 5 | 6 | TEST = 0 7 | 8 | if TEST == 0: 9 | # Play a sine wave. 10 | ex = Expr(Sig(0), "sin (* twopi (~ 500)) ").out() 11 | elif TEST == 1: 12 | # Up rising stepped frequencies. 13 | ex = Expr(Sig(0), "sin (* twopi (~ (+ (* (floor (* (~ .25) 16)) 100) 500)))").out() 14 | elif TEST == 2: 15 | # Sampled and held frequencies. 16 | ex = Expr(Sig(0), "sin (* twopi (~ (sah (* (randi 5 10) 100) (~ 4 0)) 0))").out() 17 | elif TEST == 3: 18 | # Pulse-Width-Modulation generated wih two sligthly detuned ramps. 19 | ex = Expr(Sig(0), "< (~ 80 0) (~ 79.9 0)", add=-0.5).out() 20 | 21 | ex.editor() 22 | sc = Scope(ex) 23 | 24 | s.gui(locals()) 25 | -------------------------------------------------------------------------------- /tests/test_Expr_object/expr_test_04_define.py: -------------------------------------------------------------------------------- 1 | from pyo import * 2 | 3 | s = Server().boot() 4 | s.amp = 0.1 5 | 6 | TEST = 0 7 | 8 | if TEST == 0: 9 | t = """ 10 | (define nz (randf -1 1)) 11 | 12 | * (nz) 0.5 13 | """ 14 | ex = Expr(Sig(0), t).out() 15 | elif TEST == 1: 16 | t = """ 17 | (define osc ( 18 | sin (* twopi (~ $1)) 19 | ) 20 | ) 21 | 22 | (define lfo ( 23 | + (* (osc $1) (- $2 1)) $2 24 | ) 25 | ) 26 | 27 | tanh (* (+ (osc 400) (osc 300)) (lfo .25 10)) 28 | 29 | """ 30 | ex = Expr(Sig(0), t).out() 31 | elif TEST == 2: 32 | t = """ 33 | (define osc ( 34 | sin (* twopi (~ $1)) 35 | ) 36 | ) 37 | 38 | (define fm ( 39 | (let #1 $1) // carrier 40 | (let #2 $2) // ratio 41 | (let #3 (+ (* (osc $3) 5) 5)) // lfo on the index 42 | (osc (+ #1 (* (osc (* #1 #2)) (* #1 (* #2 #3))))) 43 | ) 44 | ) 45 | 46 | * (+ (fm 172 0.251 .1) 47 | (fm 86 0.499 .15)) 48 | 0.5 49 | 50 | """ 51 | ex = Expr(Sig(0), t).out() 52 | elif TEST == 3: 53 | t = """ 54 | (define hp ( 55 | (let #1 (exp (/ (* (neg twopi) $2) sr))) 56 | (let #2 (* (+ #1 1) 0.5)) 57 | rpole (rzero (* $1 #2) #2) #1 58 | ) 59 | ) 60 | 61 | (let #freq 1000) 62 | 63 | (hp (hp (randf -0.5 0.5) #freq) #freq) 64 | 65 | """ 66 | ex = Expr(Sig(0), t).out() 67 | 68 | ex.editor() 69 | sc = Scope(ex) 70 | sp = Spectrum(ex) 71 | 72 | s.gui(locals()) 73 | -------------------------------------------------------------------------------- /tests/test_Expr_object/expr_test_06_cond.py: -------------------------------------------------------------------------------- 1 | from pyo import * 2 | 3 | s = Server().boot() 4 | s.amp = 0.1 5 | 6 | TEST = 0 7 | 8 | if TEST == 0: 9 | t = """ 10 | (define osc ( 11 | sin (* twopi (~ $1)) 12 | ) 13 | ) 14 | 15 | (let #sig (osc 200)) 16 | 17 | // half-wave rectifier 18 | (if (>= #sig 0) 19 | (#sig) 20 | (0) 21 | ) 22 | 23 | """ 24 | ex = Expr(Sig(0), t).out() 25 | elif TEST == 1: 26 | t = """ 27 | (define osc ( 28 | sin (* twopi $1) 29 | ) 30 | ) 31 | 32 | (define env ( 33 | (+ (* (cos (* twopi $1)) -0.5) 0.5) 34 | ) 35 | ) 36 | 37 | (define pulsar ( 38 | (let #phase (~ $1)) 39 | (let #adjusted (/ #phase $2)) 40 | (* (< #phase $2) (* (osc #adjusted) (env #adjusted))) 41 | ) 42 | ) 43 | 44 | + (pulsar 172 (+ (* (osc (~ .1)) 0.4) 0.5)) 45 | (pulsar 86 (+ (* (osc (~ .15)) 0.4) 0.5)) 46 | 47 | """ 48 | ex = Expr(Sig(0), t).out() 49 | 50 | ex.editor() 51 | sc = Scope(ex) 52 | 53 | s.gui(locals()) 54 | -------------------------------------------------------------------------------- /tests/test_Expr_object/expr_test_07_load.py: -------------------------------------------------------------------------------- 1 | from pyo import * 2 | 3 | s = Server().boot() 4 | s.amp = 0.1 5 | 6 | TEST = 2 7 | 8 | if TEST == 0: 9 | t = """ 10 | (load utils.expr) // scalef 11 | (load generators.expr) // osc, pwm 12 | 13 | (pwm 110 14 | (scalef (osc 0.2) 0.05 0.95) 15 | ) 16 | """ 17 | ex = Expr(Sig(0), t).out() 18 | elif TEST == 1: 19 | t = """ 20 | (load generators.expr) // square 21 | (load filters.expr) //notch 22 | 23 | (notch (square 86) 5000 0.75) 24 | """ 25 | ex = Expr(Sig(0), t).out() 26 | elif TEST == 2: 27 | t = """ 28 | (load utils.expr) // scalef 29 | (load generators.expr) // noise 30 | (load filters.expr) // peak 31 | 32 | (peak (noise 0.5) (scalef (osc 0.2) 1000 5000) 0.9) 33 | """ 34 | ex = Expr(Sig(0), t).out() 35 | 36 | ex.editor() 37 | sc = Scope(ex) 38 | sp = Spectrum(ex) 39 | 40 | s.gui(locals()) 41 | -------------------------------------------------------------------------------- /tests/test_Expr_object/expr_test_08_multiout.py: -------------------------------------------------------------------------------- 1 | from pyo import * 2 | 3 | s = Server().boot() 4 | s.amp = 0.1 5 | 6 | TEST = 1 7 | 8 | if TEST == 0: 9 | t = """// Play multiple sine waves. 10 | (load generators.expr) 11 | (out 0 (* (osc 250) 0.2)) 12 | (out 1 (* (osc 500) 0.2)) 13 | (out 2 (* (osc 750) 0.2)) 14 | (out 3 (* (osc 1000) 0.2)) 15 | """ 16 | ex = Expr(Sig(0), t, outs=4).out() 17 | if TEST == 1: 18 | t = """// Lorenz strange attractor. 19 | (let #pit 500) // 1.0 -> 750.0 20 | (let #chaos 2.0) // 0.5 -> 3.0 21 | (let #delta (* (/ 1.0 sr) #pit)) 22 | (let #A 10.0) 23 | (let #B 28.0) 24 | 25 | (let #vDX (* (- $y1[-1] $y0[-1]) #A)) 26 | (let #vDY (- (* $y0[-1] (- #B $y2[-1])) $y1[-1])) 27 | (let #vDZ (- (* $y0[-1] $y1[-1]) (* #chaos $y2[-1]))) 28 | 29 | (out 0 (+ $y0[-1] (* #vDX #delta))) 30 | (out 1 (+ $y1[-1] (* #vDY #delta))) 31 | (out 2 (+ $y2[-1] (* #vDZ #delta))) 32 | 33 | """ 34 | ex = Expr(Sig(0), t, outs=3, initout=1.0, mul=[0.044, 0.0328, 0.0]).out() 35 | 36 | ex.editor() 37 | sc = Scope(ex) 38 | sp = Spectrum(ex) 39 | 40 | s.gui(locals()) 41 | -------------------------------------------------------------------------------- /tests/test_Expr_object/generators.expr: -------------------------------------------------------------------------------- 1 | // Sine wave oscillator 2 | // usage: (osc freq phase) 3 | (define osc ( 4 | sin (* twopi (~ $1 $2)) 5 | ) 6 | ) 7 | 8 | // Triangular wave oscillator 9 | // usage: (tri freq phase) 10 | (define tri ( 11 | (let #ph (~ $1 $2)) 12 | (- (* (min #ph (- 1 #ph)) 4) 1) 13 | ) 14 | ) 15 | 16 | // Square wave oscillator 17 | // usage: (square freq phase) 18 | (define square ( 19 | (- (* (< (~ $1 $2) 0.5) 2) 1) 20 | ) 21 | ) 22 | 23 | // Pulse-Width-Modulation oscillator 24 | // usage: (pwm freq duty) 25 | (define pwm ( 26 | (- (* (< (~ $1) $2) 2) 1) 27 | ) 28 | ) 29 | 30 | // White noise generator 31 | // usage: (noise gain) 32 | (define noise ( 33 | (randf (neg $1) $1) 34 | ) 35 | ) 36 | -------------------------------------------------------------------------------- /tests/test_Expr_object/utils.expr: -------------------------------------------------------------------------------- 1 | // Takes a signal in the range [0, 1] and scales it to [min, max] range. 2 | // usage: scale(signal min max) 3 | (define scale ( 4 | (+ (* $1 (- $3 $2)) $2) 5 | ) 6 | ) 7 | // Takes a signal in the range [-1, 1] and scales it to [min, max] range. 8 | // usage: scalef(signal min max) 9 | (define scalef ( 10 | (let #middle (* (+ $2 $3) 0.5)) 11 | (let #range (* (- $3 $2) 0.5)) 12 | (+ (* $1 #range) #middle) 13 | ) 14 | ) -------------------------------------------------------------------------------- /tests/valgrind/run_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for f in *.py 4 | do 5 | if [[ "$f" == *"dsl"* ]]; then 6 | continue 7 | fi 8 | 9 | echo 10 | echo 11 | echo "====== $f ======" 12 | echo 13 | echo 14 | PYTHONMALLOC=malloc valgrind --tool=memcheck --leak-check=yes --show-leak-kinds=definite --track-origins=yes --num-callers=12 --suppressions=valgrind-python3.9.supp python3 $f 15 | done 16 | -------------------------------------------------------------------------------- /tests/valgrind/test_memleak_PyoMatrixObject.py: -------------------------------------------------------------------------------- 1 | # Run this file in valgrind with: 2 | # PYTHONMALLOC=malloc valgrind --tool=memcheck --leak-check=yes --show-leak-kinds=definite --track-origins=yes --num-callers=12 --suppressions=valgrind-python.supp python3 test_memleak_PyoMatrixObject.py 3 | # There should not be any definitely lost bytes. 4 | 5 | import os 6 | from pyo import * 7 | 8 | s = Server(audio="manual").boot().start() 9 | 10 | m = NewMatrix(2, 2, [[1,2], [3,4]]) 11 | m.write(os.path.join(os.getcwd(),"matrix_write_temp.txt")) 12 | m.read(os.path.join(os.getcwd(),"matrix_write_temp.txt")) 13 | os.remove(os.path.join(os.getcwd(),"matrix_write_temp.txt")) 14 | m.getSize() 15 | m.normalize() 16 | m.blur() 17 | m.boost() 18 | m.put(0.5, 1, 1) 19 | v1 = m.get(1, 1) 20 | v2 = m.getInterpolated(0.5, 0.5) 21 | 22 | mp = MatrixPointer(m, Sig(0.5), Sig(0.5), mul=0.5, add=0.5) 23 | mp2 = MatrixPointer(m, Sig(0.5), Sig(0.5), mul=Sig(0.5), add=Sig(0.5)) 24 | 25 | m2 = NewMatrix(1024, 16) 26 | 27 | mr = MatrixRec(Sig(0), m2, fadetime=0.01) 28 | mr.matrix = NewMatrix(1024, 16) 29 | mr.input = Sig(1) 30 | 31 | mrl = MatrixRecLoop(Sig(0), m2) 32 | mrl.matrix = NewMatrix(1024, 16) 33 | mrl.input = Sig(1) 34 | 35 | sm1 = NewMatrix(1024, 16) 36 | sm2 = NewMatrix(1024, 16) 37 | sm3 = NewMatrix(1024, 16) 38 | mm = MatrixMorph(Sig(0), m2, [sm1, sm2]) 39 | mm.matrix = NewMatrix(1024, 16) 40 | mm.sources = [sm1, sm2, sm3] 41 | 42 | s.process() 43 | s.stop() 44 | s.shutdown() 45 | -------------------------------------------------------------------------------- /tests/valgrind/test_memleak_TableProcess.py: -------------------------------------------------------------------------------- 1 | # Run this file in valgrind with: 2 | # PYTHONMALLOC=malloc valgrind --tool=memcheck --leak-check=yes --show-leak-kinds=definite --track-origins=yes --num-callers=12 --suppressions=valgrind-python.supp python3 test_memleak_TableProcess.py 3 | # There should not be any definitely lost bytes. 4 | 5 | from pyo import * 6 | 7 | s = Server(audio="manual").boot().start() 8 | 9 | t1 = NewTable(2) 10 | t2 = NewTable(2) 11 | t3 = NewTable(2) 12 | 13 | i1 = Sig(0) 14 | i2 = Sig(0) 15 | 16 | a = TableRec(i1, t1) 17 | a.setInput(i2) 18 | a.setTable(t2) 19 | 20 | outT1 = NewTable(2) 21 | outT2 = NewTable(2) 22 | b = TableMorph(Sig(0.5), outT1, [t1, t2]) 23 | b.setInput(i2) 24 | b.setTable(outT2) 25 | b.setSources([t1, t2, t3]) 26 | 27 | trig1 = Trig().play() 28 | trig2 = Trig().play() 29 | c = TrigTableRec(i1, trig1, t1) 30 | 31 | d = TablePut(i1, t1) 32 | d.setInput(i2) 33 | d.setTable(t2) 34 | 35 | e = TableWrite(i1, i2, t1, 0, 1024) 36 | e.setInput(i2) 37 | e.setPos(i1) 38 | e.setTable(t2) 39 | 40 | s.process() 41 | s.process() 42 | s.stop() 43 | s.shutdown() 44 | -------------------------------------------------------------------------------- /tests/valgrind/test_memleak_analysis.py: -------------------------------------------------------------------------------- 1 | # Run this file in valgrind with: 2 | # PYTHONMALLOC=malloc valgrind --tool=memcheck --leak-check=yes --show-leak-kinds=definite --track-origins=yes --num-callers=12 --suppressions=valgrind-python.supp python3 test_memleak_analysis.py 3 | # There should not be any definitely lost bytes. 4 | 5 | from pyo import * 6 | 7 | s = Server(audio="manual").boot().start() 8 | 9 | i1 = Sig(0) 10 | i2 = Sig(0) 11 | 12 | a = Follower(i1) 13 | a.setInput(i2) 14 | a.setFreq(Sig(20)) 15 | 16 | b = Follower2(i1, 0.01, 0.1) 17 | b.setInput(i2) 18 | b.setRisetime(Sig(0.01)) 19 | b.setFalltime(Sig(0.1)) 20 | 21 | c = ZCross(i1, thresh=0.5) 22 | c.setInput(i2) 23 | 24 | d = Yin(i1) 25 | d.setInput(i2) 26 | d.setTolerance(0.1) 27 | d.setMaxfreq(2000) 28 | d.setCutoff(5000) 29 | 30 | e = Centroid(i1) 31 | e.setInput(i2) 32 | 33 | f = AttackDetector(i1) 34 | f.setInput(i2) 35 | f.setDeltime(0.12) 36 | f.setMaxthresh(-12.5) 37 | f.setCutoff(2500) 38 | 39 | def callback(x): 40 | print(x) 41 | def callback2(x): 42 | print(x) 43 | 44 | g = PeakAmp(i1, function=callback) 45 | g.setInput(Sig(0.5)) 46 | g.setFunction(callback2) 47 | 48 | h = RMS(i1, function=callback) 49 | h.setInput(Sig(0.5)) 50 | h.setFunction(callback2) 51 | 52 | s.process() 53 | s.process() 54 | s.stop() 55 | s.shutdown() 56 | -------------------------------------------------------------------------------- /tests/valgrind/test_memleak_arithmetic.py: -------------------------------------------------------------------------------- 1 | # Run this file in valgrind with: 2 | # PYTHONMALLOC=malloc valgrind --tool=memcheck --leak-check=yes --show-leak-kinds=definite --track-origins=yes --num-callers=12 --suppressions=valgrind-python.supp python3 test_memleak_arithmetic.py 3 | # There should not be any definitely lost bytes. 4 | 5 | from pyo import * 6 | 7 | s = Server(audio="manual").boot().start() 8 | 9 | i1 = Sig(0) 10 | i2 = Sig(0) 11 | 12 | a = Sin(i1) 13 | a.input = i2 14 | 15 | b = Cos(i1) 16 | b.input = i2 17 | 18 | c = Tan(i1) 19 | c.input = i2 20 | 21 | d = Tanh(i1) 22 | d.input = i2 23 | 24 | e = Abs(i1) 25 | e.input = i2 26 | 27 | f = Sqrt(i1) 28 | f.input = i2 29 | 30 | g = Log(i1) 31 | g.input = i2 32 | 33 | h = Log2(i1) 34 | h.input = i2 35 | 36 | i = Log10(i1) 37 | i.input = i2 38 | 39 | j = Atan2(b=0.5, a=0.5) 40 | j.b = Sig(0.5) 41 | j.a = Sig(0.5) 42 | 43 | k = Floor(i1) 44 | k.input = i2 45 | 46 | l = Ceil(i1) 47 | l.input = i2 48 | 49 | m = Round(i1) 50 | m.input = i2 51 | 52 | n = Pow(base=2.5, exponent=1.5) 53 | n.base = Sig(2.5) 54 | n.exponent = Sig(1.5) 55 | 56 | o = Exp(i1) 57 | o.input = i2 58 | 59 | p = Div(a=0.5, b=0.5) 60 | p.a = Sig(0.5) 61 | p.b = Sig(0.5) 62 | 63 | q = Sub(a=0.5, b=0.5) 64 | q.a = Sig(0.5) 65 | q.b = Sig(0.5) 66 | 67 | s.process() 68 | s.process() 69 | s.stop() 70 | s.shutdown() 71 | -------------------------------------------------------------------------------- /tests/valgrind/test_memleak_bandsplit.py: -------------------------------------------------------------------------------- 1 | # Run this file in valgrind with: 2 | # PYTHONMALLOC=malloc valgrind --tool=memcheck --leak-check=yes --show-leak-kinds=definite --track-origins=yes --num-callers=12 --suppressions=valgrind-python.supp python3 test_memleak_bandsplit.py 3 | # There should not be any definitely lost bytes. 4 | 5 | from pyo import * 6 | 7 | s = Server(audio="manual").boot().start() 8 | 9 | i1 = Sig(0) 10 | i2 = Sig(0) 11 | 12 | a = BandSplit(i1, num=8, q=0.5) 13 | a.input = i2 14 | a.q = Sig(0.5) 15 | 16 | b =FourBand(i1) 17 | b.input = i2 18 | b.freq1 = Sig(500) 19 | b.freq2 = Sig(1000) 20 | b.freq3 = Sig(3000) 21 | 22 | c = MultiBand(i1, num=12) 23 | c.input = i2 24 | c.setFrequencies(freqs=[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100]) 25 | 26 | s.process() 27 | s.process() 28 | s.stop() 29 | s.shutdown() 30 | -------------------------------------------------------------------------------- /tests/valgrind/test_memleak_randoms.py: -------------------------------------------------------------------------------- 1 | # Run this file in valgrind with: 2 | # PYTHONMALLOC=malloc valgrind --tool=memcheck --leak-check=yes --show-leak-kinds=definite --track-origins=yes --num-callers=12 --suppressions=valgrind-python.supp python3 test_memleak_randoms.py 3 | # There should not be any definitely lost bytes. 4 | 5 | from pyo import * 6 | 7 | s = Server(audio="manual").boot().start() 8 | 9 | a = Randi() 10 | a.min = Sig(0.5) 11 | a.max = Sig(0.7) 12 | a.freq = Sig(0.5) 13 | 14 | b = Randh() 15 | b.min = Sig(0.5) 16 | b.max = Sig(0.7) 17 | b.freq = Sig(0.5) 18 | 19 | l1 = [1.1,2.2,3.3,4.4,5.5] 20 | l2 = [1.2,2.3,3.4,4.5,5.6] 21 | 22 | c = Choice(l1) 23 | c.choice = l2 24 | c.freq = Sig(0.5) 25 | 26 | d = RandInt() 27 | d.max = Sig(10.5) 28 | d.freq = Sig(0.5) 29 | 30 | e = RandDur() 31 | e.min = Sig(0.5) 32 | e.max = Sig(0.7) 33 | 34 | f = Xnoise() 35 | f.freq = Sig(0.5) 36 | f.x1 = Sig(0.1) 37 | f.x2 = Sig(0.7) 38 | f.dist = 10 39 | 40 | g = XnoiseMidi() 41 | g.freq = Sig(0.5) 42 | g.x1 = Sig(0.1) 43 | g.x2 = Sig(0.7) 44 | g.scale = 2 45 | g.setRange(48, 64) 46 | g.dist = 10 47 | 48 | h = XnoiseDur() 49 | h.min = Sig(0.5) 50 | h.max = Sig(0.7) 51 | h.x1 = Sig(0.1) 52 | h.x2 = Sig(0.7) 53 | h.dist = 10 54 | 55 | i = Urn() 56 | i.max = (75) 57 | i.freq = Sig(0.5) 58 | 59 | j = LogiMap() 60 | j.chaos = Sig(0.5) 61 | j.freq = Sig(0.5) 62 | 63 | s.process() 64 | s.process() 65 | s.stop() 66 | s.shutdown() 67 | --------------------------------------------------------------------------------