SlideShare una empresa de Scribd logo
1 de 49
Descargar para leer sin conexión
Creare
Soundscape con
PYO
PyCon 5 - Maggio 2014
Chi sono
Riccardo Lemmi
sviluppatore Zope/Plone
chitarrista ERG (8string)
Damned Chorus
Ascolto
PYO
https://code.google.com/p/pyo/
“pyo is a Python module written in C to help
digital signal processing script creation”
Come funziona Pyo
Suono come:
vettore di float
stream di sample
flusso di campioni
Pyo Hello world
from pyo import *
s = Server().boot()
s.start()
a = Sine(mul=0.01).out()
Esempio di generatore
Sine(freq=1000, phase=0, mul=1, add=0)
● freq: frequenza
● phase: fase iniziale
● mul: moltiplicatore dei campioni
● add: parametro sommato ai campioni
Cambiare i parametri
Es: la frequenza
a.setFreq(1000)
a.freq = 1000
a.set('freq', 1000, 5)
… in qualsiasi momento
Concatenare stream
Modulazione
mod = Sine(freq=6, mul=50)
a = Sine(freq=mod + 440, mul=0.1).out()
amp = Sine(freq=6)
a = Sine(freq=440, mul=amp).out()
Concatenare stream
Inviluppo
amp = Adsr(attack=.01, decay=.2,
sustain=.5, release=.1,
dur=5, mul=.5)
a = Sine(mul=amp).out()
amp.play()
Audio Server
Server Setup
from pyo import *
s = Server(???).boot()
s.start()
a = Sine(440, mul=0.01).out()
s.gui(locals())
Audio Server
class Server(
sr=44100,
nchnls=2,
buffersize=256,
duplex=1,
audio='portaudio',
jackname='pyo')
Audio Server
Server
nchnls
streams
Audio Server
Tipi
● portaudio
● offline
● jackd
Audio Server
.boot: setup server
.start: inizia l’elaborazione
.stop: ferma l’elaborazione
.gui: attiva la UI
Audio Server
Interazione
s.gui(locals())
locals() per accedere agli oggetti istanziati
Classi base
PyoObject
rappresenta uno stream
Classi base
PyoObject
.play(dur=0, delay=0)
.out(...)
.stop()
.mix(voices=1) -> Mix
.set(attr, value, port=0.025)
Classi base
PyoObject
s1 = Sine().out()
s1.set('freq', 500, 5)
Classi base
PyoObject
.get & .set
.ctrl: gestione UI
.mul: moltiplica il sample
.add: aggiuge al sample
Classi base
PyoTableObject
buffer dove memorizzare
un vettore pre-calcolato
Classi base
PyoMatrixObject
matrice bidimensionale
dove memorizzare
campioni pre-calcolati
Operazioni matematiche
sin
cos
pow
round
...
Segnali di controllo
Generatori di campioni
utilizzabili per controllare
i parametri dei segnali audio
Segnali di controllo
Fader
Genera un inviluppo Fade-in/Fade-out
Adsr:
Generatore di inviluppo:
Attack - Decay - Sustain - Release
Segnali di controllo
Linseg
Generatore di inviluppo lineare:
collega i punti con segmenti
.graph
Segnali di controllo
Sig
Segnale continuo: stream di un solo sample
.value stream
.get sample
Gestione dinamica
Gestione dell’ampiezza del segnale
Clip
Compress
...
Effetti
Disto: distorsore
Delay: ritardo
Chorus
...
Filtri
EQ
AllPass
...
Trasformata di Fourier
Analisi del segnale nel dominio della frequenza.
FFT e IFFT...
Spectrum: mostra lo spettro del segnale
Generatori di segnali audio
Possono essere usati come
generatori di segnali audio
oppure come
generatori di segnali di controllo
Generatori di segnali
Oscillatori
Sine sinusoide
SineLoop
Phasor dente di sega, rampa
FM modulatore di frequenza
LFO… low frequency oscillator
Generatori di segnali
Rumore
BrownNoise
Noise (white)
PinkNoise
Routing
Mixer: audio mixer
Pan: distribuisce uno stream su due canali
Selector: interpola più stream
Generatori di Eventi
CallAfter: call al tempo t
Pattern: call periodica
Generatori di Eventi
a = Sine()
def callback1():
a.set('freq', 100, 1)
c1 = CallAfter(callback1, 2)
Lettori di file audio
Modellano un file audio
SfPlayer: legge un file e genera lo stream
Generatori Random
Generatori di rumore
usati prevalentemente come controllori
per i parametri di altri generatori
Choice
Rand*
Xnoise*
Tabelle
Vettori monodimensionali
che contengono
campioni pre-calcolati
Tabelle
CosTable: punti intepolati con un coseno
.graph
DataTable: tabella vuota
SawTable: contiene un “dente di sega”
SndTable: riempita con un file
...
Processori di Tabelle
Granulator: synth granulare
Looper: player
Osc: oscillatore che usa una tabella
OscLoop: oscillatore con feedback
...
Trigger
Flusso di 0 in cui “ogni tanto” c’è un 1
Generatori di Trigger
Trig: genera un singolo evento
Metro: metronomo
Seq: generatore di pattern ritmici
Beat: generatore di pattern ritmici pseudo-random
...
Handler di Trigger
Iter: cambia valore sequenzialmente
TrigRand: genera un valore random
TrigChoice: cambia valore scegliendo da una lista
TrigFunc: esegue una funzione
...
Interfaccia utente
SLMap: slider generico
SLMapFreq: legato a ‘freq’
SLMapMul: legato a ‘mul’
…
Interfaccia utente
a = Sine(440, mul=0.5).out()
a.ctrl([
SLMapFreq(init=a.freq),
SLMapMul(init=a.mul),
])
Utilities
Print: stampa il valore corrente di uno stream
Record: scrive su disco
Il coro demoniaco
Analisi del codice

Más contenido relacionado

Destacado

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Destacado (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Pycon5 creare soundscape con pyo