FoxDot.lib.Extensions.SonicPi¶
This extension allows you to use the synths defined by Sonic Pi.
You need to load/download the synths:
from FoxDot.lib.Extensions.SonicPi import LoadSonicPiSynths, pisynth
# (down)load the SonicPi synths
LoadSonicPiSynths() # >> It takes a while on the first run, because the sonic-pi synth files
# See what new Synths are available
print(sorted(pisynth))
After that, you can use the synths normally:
s1 >> pisynth.sine() # as an attribute
s2 >> pisynth['zawa']() # as a key
# or update namespace with new synths
FoxDotCode.namespace |= pisynth
SynthDefs |= pisynth
# and use like any other synth
s1 >> sine()
s2 >> zawa()
- class FoxDot.lib.Extensions.SonicPi.Container[source]¶
Bases:
dictSimple dict that allows access to keys via properties
- FoxDot.lib.Extensions.SonicPi.GenerateSonicPiData(sonic_pi_dir)[source]¶
Generate the sonic-pi json metadata from a sonic-pi source repo
- FoxDot.lib.Extensions.SonicPi.LoadSonicPiSynths(metadata_file='/workspace/taconi/FoxDot/FoxDot/lib/Extensions/SonicPi/sonicpi.json')[source]¶
Load sonic-pi synths from json metadata, downloading compiled synths if needed
- FoxDot.lib.Extensions.SonicPi.LoadSonicPiSynthsDev(sonic_pi_dir)[source]¶
Load the sonic pi synths from a live sonic-pi repo
- class FoxDot.lib.Extensions.SonicPi.SonicPiSynthDef(name, filename, synthdata)[source]¶
Bases:
CompiledSynthDef- bus_name = 'out_bus'¶
- FoxDot.lib.Extensions.SonicPi.HERE = '/workspace/taconi/FoxDot/FoxDot/lib/Extensions/SonicPi'¶
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to ‘utf-8’. errors defaults to ‘strict’.
- FoxDot.lib.Extensions.SonicPi.SONIC_PI_FILE = '/workspace/taconi/FoxDot/FoxDot/lib/Extensions/SonicPi/sonicpi.json'¶
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to ‘utf-8’. errors defaults to ‘strict’.
- FoxDot.lib.Extensions.SonicPi.RUBY_SCRIPT = '/workspace/taconi/FoxDot/FoxDot/lib/Extensions/SonicPi/generate.rb'¶
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to ‘utf-8’. errors defaults to ‘strict’.
- FoxDot.lib.Extensions.SonicPi.pisynth = {}¶
Simple dict that allows access to keys via properties