python-sonic
python-sonic copied to clipboard
Feature - load_sample
Hey guys,
Awesome library and really easy to use, also great documentation so thanks!
I was wondering if there was any way of implementing the load_sample function from sonic pi into your library.
eg
bass = "~/Desktop/dnb/Bass Track.wav" load_sample bass sample(bass)
I tried to add it to the library but it seems like the UPD interface doesn't remember loading a sample in when you run it as separate commands, which means you'll have to reload the sample every time you want to use it - which is a bit clunky, especially on a Rpi.
so this will work
command = 'bass = "~/Desktop/dnb/Bass Track.wav"\nload_sample bass\nbass = sample(bass)'
self.run(command)
However this won't
command = 'bass = "~/Desktop/dnb/Bass Track.wav"\nload_sample bass'
self.run(command)
command = 'sample(bass)'
self.run(command)
Happy to contribute in any way - just need some guidance :)
Thanks!
Hi at the moment the communication between Python and Sonic Pi is stateless. Python sends a message and Sonic Pi does something. Every message is independent from others.
With the current Sonic Pi API I do not see a solution.
Best Regards
Gerhard