Sonic Pi examples in Extempore

113 views
Skip to first unread message

Robert Herman

unread,
Jul 9, 2017, 8:28:42 PM7/9/17
to Extempore
I know I ran the Sonic Pi examples from https://extemporeexamples.wordpress.com/ successfully before, but for some reason, now on a freshly built Extempore from a few days ago I am getting the stack trace errors below. I realize the sys:load notification is just that, a notification, but I don't fully understand the 'no valid polymorphic options ast:" bit.

I am trying to get back into Extempore with a dedicated old notebook (Lenovo T430u 2012), that has Lubuntu on it. Extempore built fine, and the shipped examples work for the most part - I haven't tried all especially the graphics ones yet. Any help here would be much appreciated! Thanks.

New Client Connection
Successfully connected to remote process
Loading xtmbase library... done in 4.368254 seconds
New Client Connection
Loading xtmmath library... done in 12.965442 seconds
Loading xtmaudiobuffer library... done in 3.442358 seconds
Loading xtmaudio_dsp library... done in 24.392562 seconds
Loading xtminstruments library... done in 8.115374 seconds
Loading xtmsndfile library... done in 7.410068 seconds
Loading xtminstruments_ext library... done in 1.044898 seconds
sys:load notification instruments_ext already loaded 
Compiled:  sampler_nofx >>> [float,float,i64,i64,float*]*
Compiler Error  no valid polymorphic options ast: (reverb_c##3 80.000000)
stack-catch: ()
stack-catch: ()
stack-catch: ()
eval: unbound variable: noise.sustain
Trace: 
stack-catch: ()
stack-catch: ()
stack-catch: ()
eval: unbound variable: noise.decay
Trace: 
eval: unbound variable: noise.attack
Trace: loop 


Andrew Sorensen

unread,
Jul 9, 2017, 10:24:38 PM7/9/17
to extemp...@googlegroups.com
I'm afraid that since the Instrument API change Andrew's sonic pi examples are out of date with respect to HEAD.  Bringing them up to date would require updating Andrew's Sonic-Pi-setup.xtm file to use the new instrument API.

The new instrument API is a little more complicated than before but gives the instrument builder significantly more flexibility.

Below is about the simplest instrument that you can construct using the new API.  Main things to notice are (a) both note and fx are one level higher order than they used to be (b) you (the developer of the instrument) are now responsible for when a note "turns off" (c) you (the dev of instrument) must provide fx with a reference to notekernel (d) you must use the same character string for both note and fx (i.e. blah_note and blah_fx).

None of this matters to and end-user of the instrument.  What *does* matter to an end-user of the instrument is that they (the end user) now defines an instrument (defined as blah_note and blah_fx) like so:  

(make-instrument myinst blah)

where myinst is whatever name the user wants the instrument to be bound too.  'blah' needs to map to valid note (blah_note) and fx (blah_fx) implementations.  Significantly a user can now bind any number of unique instances of the instrument (which was not possible before)

(make-instrument myinst2 blah)
(make-instrument myinst3 blah)
etc..

I present to you the "simple" instrument  :)

;;;;;;;;;;;;;;;;;;;;;;;;;

(sys:load "libs/core/instruments.xtm")

;; a tivial sine instrument with no enveloping!
(bind-func simple_note
  (lambda ()
    (lambda (data:NoteData* nargs:i64 dargs:SAMPLE*)
      (let (;; you'll probably want the note start time
            (starttime (note_starttime data))              
            ;; you'll probably want the note frequency (in hz)
            (frq (note_frequency data))
            ;; you'll probably want the note amplitude (0.0-1.0)
            (amp (note_amplitude data))
            ;; you'll probably need the duration (in samples)
            (dur (note_duration data))   
            (osc (osc_mc_c 0.0)))
        (lambda (time:i64 chan:i64)
           ;; you are responsible for stopping a note!
          (if (> (- time starttime) dur) (note_active data #f))
          (osc chan amp frq))))))

;; a stereo fx for trivial sine instrument
(bind-func simple_fx
  (lambda ()
    (let ((notekernel:NOTE_KERNEL null) ;; you must provide this line
          (gain 1.0)
          (dly (delay_st_c (ftoi64 (* SRf 0.333)) (ftoi64 (* SRf 0.25)))))
      (lambda (in:SAMPLE time:i64 chan:i64 dat:SAMPLE*)
        (if (< chan 2)
            (* gain (dly chan in 0.7 0.5))
            0.0)))))

(make-instrument myinst simple)

(bind-func dsp:DSP
  (lambda (in time chan dat)
    (myinst in time chan dat)))

(dsp:set! dsp)

;; 'clicking' because no envelope for simple instrument
(define test
  (lambda (beat dur)
    (playp 1 0 myinst 0 `(60 63 ,(random '(67 67 67 68))) 80 dur)
    (playp 2 0 myinst 12 `(60 63 ,(random '(67 67 67 68 70 72))) 80 dur)
    (playp 3 0 myinst -24 `(60 67 72) 80 dur)
    (callback (*metro* (+ beat (* .5 dur))) 'test (+ beat dur) dur)))

(test (*metro* 'get-beat 4) 1/4)

;;;;;;;;;;;;;;;;;;;;;;;;;


If you're interested in a moderately complex instrument see fmsynth in instruments.xtm.  For a very complex full on modular synth implementation check out analogue in instruments.xtm.

Probably not quite the email you were hoping for but ...

Cheers,
Andrew.




--
You received this message because you are subscribed to the Google Groups "Extempore" group.
To unsubscribe from this group and stop receiving emails from it, send an email to extemporelang+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ben Swift

unread,
Jul 9, 2017, 10:52:59 PM7/9/17
to extemp...@googlegroups.com
Hi all

The docs are out of date at the moment re: some of the instruments stuff
- and the sonic pi examples will be out of date too. Sorry about that.
Although I'm not 100% sure that's the problem you're seeing.

I'll try and fix them up today/tomorrow.

Cheers,
Ben

Ben Swift

unread,
Jul 9, 2017, 10:53:23 PM7/9/17
to extemp...@googlegroups.com
Great, thanks Andy :)

Cheers
Ben
>> email to extemporelan...@googlegroups.com.

Robert Herman

unread,
Jul 9, 2017, 11:46:28 PM7/9/17
to Extempore
Thanks a lot, Andrew!

I can work through it now that I know why. You've improved Extempore, and I wasn't around when all of this happened.

Anything else major since over a year ago?

Any news on Extempore being used in HPC outside of livecoding circles?

Thanks again.

Rob
To unsubscribe from this group and stop receiving emails from it, send an email to extemporelan...@googlegroups.com.

Robert Herman

unread,
Jul 9, 2017, 11:47:23 PM7/9/17
to Extempore
Thanks, Ben. I'll work on the new core examples or instruments libraries to get back up to speed.

Rob

Toby Gifford

unread,
Jul 9, 2017, 11:47:41 PM7/9/17
to extemp...@googlegroups.com
Speaking of extempore an pi, did anyone ever get extempore running on ARM?

To unsubscribe from this group and stop receiving emails from it, send an email to extemporelang+unsubscribe@googlegroups.com.

Ben Swift

unread,
Jul 9, 2017, 11:54:23 PM7/9/17
to extemp...@googlegroups.com
It did work, for a brief shining moment on a specific board. And a bunch
of work was done with the LLVM MCJIT upgrade a year ago which would make
it easier to get in running on ARM in a more general sense.

There are still a bunch of things to do before that happens, though.
It'd be an interesting hons project, if anyone on the list is looking
for/has students who are looking for that sort of thing :)

Cheers
Ben

Andrew Sorensen

unread,
Jul 10, 2017, 12:10:24 AM7/10/17
to extemp...@googlegroups.com
Extempore has made huge progress over the past year with major updates to audio, graphics and XTLang (core language and compiler).  Even more importantly Extempore continues to make substantial progress and is being used for more commercial work than ever before.  Extempore is alive and well.

In some sense the problem is too much work going on.  Unfortunately what Extempore has not had in a long time is any documentation updates to keep up with the changes - so our incredibly meagre documentation is even less useful than usual ;)  This situation is unlikely to change in the short term.  I am still focused on a v1.0 release.  I'm not going to provide a date for that, but I can say that I wont be putting any effort into documentation/tutorials until after the v1.0 release is done.  Once that is out of the way then I plan to work on an in-depth Extempore video screencast series.  Not until v1.0 though, still lots to do.

Not so much on the HPC front at the moment - more computer graphics side.

Cheers,
Andrew.


On Mon, Jul 10, 2017 at 1:46 PM, Robert Herman <rpjh...@gmail.com> wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to extemporelang+unsubscribe@googlegroups.com.

Andrew Sorensen

unread,
Jul 10, 2017, 12:17:56 AM7/10/17
to extemp...@googlegroups.com
I had Extempore running on a Pandaboard a few years back, but then let it slide.  Actually the biggest impediment at the moment is not ARM so much as 32bit.  64bit ARM would be quite straight forward, but 32bit (anything) needs some help.  I am still motivated to get this happening though, so one day.

You can tell Ben is a *real* academic now -- everything looks like "a great honours project" :)

Ben Swift

unread,
Jul 10, 2017, 3:53:08 AM7/10/17
to extemp...@googlegroups.com
Yeah. Not sure whether to be pumped about that realisation or fall into
a pit of despair.

Regardless of the context in which the work is undertaken, my main point
is that Andy did a bunch of hard work on this a while ago and the
process of getting it back and working would be able to leverage some of
that. And would involve a bunch of code gardening around issues where
the codebase has thus far only expected to be living in an x64 world
(using long ints instead of size_t, etc.).

Cheers
Ben

Andrew Sorensen <dig...@gmail.com> writes:

algomusic

unread,
Jul 12, 2017, 6:55:54 AM7/12/17
to Extempore
I will update the Sonic Pi extempore examples ASAP to meet the new instrument API. Thanks for the heads up.

Cheers, Andrew Brown

Jason Levine

unread,
Jul 12, 2017, 1:26:08 PM7/12/17
to extemp...@googlegroups.com
I am still focused on a v1.0 release.  I'm not going to provide a date for that

*grinds teeth nervously, continues to refresh groups.google.com/d/forum/extemporelang repeatedly*

--
You received this message because you are subscribed to the Google Groups "Extempore" group.
To unsubscribe from this group and stop receiving emails from it, send an email to extemporelang+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Jason Levine
new media performer + creative coder

Robert Herman

unread,
Jul 15, 2017, 8:30:50 AM7/15/17
to Extempore
Same here! I can't seem to re-write even one properly to get it to work.

Thanks for your efforts in advance, Andrew!
To unsubscribe from this group and stop receiving emails from it, send an email to extemporelan...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages