Skip to content

Instantly share code, notes, and snippets.

@mathigatti
Last active November 21, 2019 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mathigatti/15a17d41734a877b1aa181b248263ee9 to your computer and use it in GitHub Desktop.
Save mathigatti/15a17d41734a877b1aa181b248263ee9 to your computer and use it in GitHub Desktop.
FoxDot
# Acceder a este archivo en: https://bit.ly/2OyyWr2
# (Prestar atención a mayusculas y minusculas)
# Tempo y escala
print(help(Scale))
Scale.default = Scale.minor
print(Clock.bpm)
# Que instrmentos hay
print(SynthDefs)
## Como se usa un instrumento? ##
### Si es una bateria se usa asi:
p1 >> play("abcdefg*-123")
# Cada caracter representa un sonido
p1 >> play("X-O-")
### Si es otro instrumento se usa asi:
p1 >> bass([0,1,2,3,4,5,6])
# El instrumento recibe como parametro las notas que se quieren tocar, por defecto el 0 es Do
# Se pueden especificar muchas cosas mas
p1 >> bass([0,1,2,3,4,5,6],dur=0.5)
p1 >> bass([0,2,3,4],dur=4,chop=3)
# Links útiles
## Ejemplos que suenan lindo en 10 lineas o menos
## https://github.com/Qirky/ten-lines-or-less
## Documentación oficial
## https://buildmedia.readthedocs.org/media/pdf/foxdotcode/latest/foxdotcode.pdf
## https://foxdot.org/docs/
# Extendiendo FoxDot
## Samples modificados
def note2index(note):
scale = list(Scale.default)
return scale[note]
def play2notes(notas,sample="b",rate_dur=1,rythm_dur=1,oct=0):
rates = []
for nota in notas:
nota = note2index(nota)
rates.append(math.pow(2,(nota+12*oct)/12))
p1 >> play(sample,dur=rythm_dur, rate=var(rates,rate_dur),amp=1,sample=2)
play2notes([0,2,3,4],"Q",[4],1,oct=0)
## Voces sinteticas
from .Extensions.Voice import voice
voice([0,1,2,3,4,3,2,1,0],lyrics="hola como te va",dur=[1]*8+[4],scale=Scale.major)
v1.reload()
v1 >> loop("v1",P[0:12])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment