Skip to main content

Intuitive sound synthesis in python.

Project description

cover

Intuitive sound synthesis in python.

Installation

pip install pynthlib

Or directly from this repo:

git clone https://github.com/MatejBevec/pynth
pip install ./pynthlib

Usage

Below are some usage examples. For more info, feel free to read DESCRIPTION.pdf and check out examples.py.

Please note that this project is in a prototype stage and is not optimized in terms of performance and reliability and is missing many planned features.

Overtones

from pynth import *

out = 0.5 * Sin(200)
for i in range(5):
  out += 0.1 * Sin(100*i)
  
drawgraph(out)
showsound(out, t2=0.1)
out.play(5*SR)

https://user-images.githubusercontent.com/40042371/213463015-5cdd5f04-aa9d-4fe6-bfb3-5fa47394b6f1.mp4

Vocal remover

sample, sr = librosa.load("file.wav", mono=False)
l = Wave(sample[0, :])
r = Wave(sample[1, :])
SR = sr

out = 0.5 * (0.5*l - 0.5*r)
out += 0.5 * MovingAvg(0.5*l + 0.5*r, M=50)

https://user-images.githubusercontent.com/40042371/213463075-75020d90-9f85-4ac3-9728-504b07fb9995.mp4

Procedural wind

noise = WhiteNoise()
cutmod = Unipol(.5*Sin(1/3) + .5*Sin(1/5)) * 0.1
resmod = Unipol((.5*Sin(1) + .5*Sin(.8)) >> 0.3)
resmod = resmod * 0.4 + 0.1
out = Scope(Lowpass(noise, cutmod, resmod))

https://user-images.githubusercontent.com/40042371/213463145-76281843-c404-4aa1-a73d-95d23d691cea.mp4

Karplus-Strong string emulator

noise = Wave(np.random.rand(4000)-0.5)
delay = Delay(None, delay=0.005)
add = noise + delay
delay.ins["a"] = 0.95 * MovingAvg(add, M=10)
out = add

frozen = Wave(add.eval(2*SR))

https://user-images.githubusercontent.com/40042371/213463212-e894d9f7-7ee3-4b75-9c26-2594c877b96c.mp4

User input, envelopes and scopes

import keyboard
control = Input()
env = Envelope(Scope(control), (2000, 0, 0, 8000))
out = Scope(env)
out = Scope(out * Saw(100))

val = 0
def loop(t):
  if keyboard.is_pressed(l):
    control.set(1)
  else:
    control.set(0)
    
out.play(30*SR, live=True, callback=loop)

Project details


Download files

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

Source Distribution

pynthlib-0.0.1.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pynthlib-0.0.1-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file pynthlib-0.0.1.tar.gz.

File metadata

  • Download URL: pynthlib-0.0.1.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.7

File hashes

Hashes for pynthlib-0.0.1.tar.gz
Algorithm Hash digest
SHA256 4b7105809b6281c1005dc2b97f6101da4721257b54c099516ce3997f81628f73
MD5 e4943bd3b957cf62f57b1812e8e48d7d
BLAKE2b-256 f9a1f55d1c1c961673aa11a7591f1304deb338c8385bacf3ec98f6f7430de28f

See more details on using hashes here.

File details

Details for the file pynthlib-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pynthlib-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.7

File hashes

Hashes for pynthlib-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d378a2850f8c0324095a2550fb450479863615b721e8fb2b174ba76aa90e041f
MD5 f1efa19819ea5393c7cff6bd4e1b8824
BLAKE2b-256 e09bd500cafb4b74c9b2347d299b5fd8ff465f761cf8802c3364bb17778b4993

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page