Re: [PD] pd-scheme / SIOD

2013-09-17 Thread Luigi Rensinghoff
Hi List, Hi Larry


I havent been using PD for a while.

But i have a little project which i like to explore

I found i nice scheme script in the context of the linux-sound-editor snd, 
that synthesizes plenty of birds, animals and insects.

So i was wondering if it possible to get this running inside of PD, so i can be 
played in realtime...

How difficult is it to compile SIOD on OS X ?

i dont know much about scheme and various dialects - so i post a little 
snippet of the code, to find out, if that would work.

;;;  Frogs and Toads 
;;;
;;;
;;; Knudsen's frog

(definstrument (a-frog beg dur freq amp amp-env gliss gliss-env pulse-dur 
pulse-env fm-index fm-freq)
  (let* ((start (seconds-samples beg))
 (stop (+ start (seconds-samples dur)))
 (base (make-oscil freq))
 (modm (if (and fm-index ( fm-index 0.0)) (make-oscil fm-freq) #f))
 (frqf (if gliss-env (make-env gliss-env :duration dur :base 32 :scaler 
(hz-radians gliss)) #f))
 (pulse (make-pulsed-env pulse-env pulse-dur (/ 1.0 pulse-dur)))
 (ampf (make-env amp-env :duration dur :scaler amp))
 (index (hz-radians (* fm-freq fm-index
(run
 (lambda ()
   (do ((i start (1+ i)))
   ((= i stop))
 (outa i (* (env ampf)
(pulsed-env pulse 0.0)
(oscil base (+ (if frqf (env frqf) 0.0) 
   (if modm (* index (oscil modm)) 0.0))

(define (knudsens-frog beg amp)
  (a-frog beg .25 480 amp '(0 0 1 1 3 1 4 0) 
  50 '(0 0 .5 .2 .8 1 1 1) 
  (/ .25 7) '(0 .1  .5 .4  .6 .75  1 .9  1.5 1  2 .9 2.3 .1) 
  1.75 40))  ; 0.01 here is about 1.75 as an fm index: (/ (radians-hz 
.01) 40)

#|
;;; cricket-like:
(with-sound (:play #t) 
(a-frog 0 .25 2000 .5 '(0 0 1 1 3 1 4 0) ; or 3000 6000 etc
50 '(0 0 .5 .2 .8 1 1 1) 
(/ .25 5) '(0 0 1 0 5 1 8 0 20 0) 
0.01 40))

(with-sound (:play #t) 
(a-frog 0 .25 4000 .5 '(0 0 1 1 3 1 4 0) 
0 #f
(/ .25 10) '(0 0 1 1 2 1 4 0 10 0) 
0.0 10))

;;; frog-like
(with-sound (:play #t) 
(a-frog 0 .25 2000 .5 '(0 0 1 1 3 1 4 0) 
50 '(0 0 .5 .2 .8 1 1 1) 
(/ .25 10) '(0 0 1 1 2 1 3 0 4 0 5 1 7 1 8 0 20 0) 
0.0 10))
|#

(definstrument (a-cricket beg dur freq freq1 amp amp-env pulse-dur pulse-env)
  (let* ((start (seconds-samples beg))
 (stop (+ start (seconds-samples dur)))
 (base (make-oscil freq))
 (base1 (make-oscil freq1))
 (pulse (make-pulsed-env pulse-env pulse-dur (/ 1.0 pulse-dur)))
 (ampf (make-env amp-env :duration dur :scaler amp)))
(run
 (lambda ()
   (do ((i start (1+ i)))
   ((= i stop))
 (outa i (* (env ampf)
(pulsed-env pulse 0.0)
(+ (* .8 (oscil base 0.0))
   (* .2 (oscil base1 0.0))

;(with-sound (:play #t) (a-cricket 0 .12 4500 5400 .5 '(0 0 1 1 3 1 4 0) (/ .11 
3) '(0 0 1 .8 5 1 6 0 15 0)))



;;; -

and this

(define* (calling-all-mammals :optional (beg 0.0) (spacing 0.0))
  (indri beg 0.25)(set! beg (+ beg spacing))
  (+ beg 2))


(define* (calling-all-insects :optional (beg 0.0) (spacing 0.0))
  (mosquito(+ beg 0) 5 560 0.2)(set! beg (+ beg 
spacing))
  (mosquito(+ beg 1) 3 880 0.05)   (set! beg (+ beg 
spacing))
  (broad-winged-tree-cricket   (+ beg 5.5) 2.0 0.2)(set! beg (+ beg 
spacing))
  (long-spurred-meadow-katydid (+ beg 8) 0.5)  (set! beg (+ beg 
spacing))
  (southern-mole-cricket   (+ beg 18.5) 3 0.15)(set! beg (+ beg 
spacing))
  (handsome-trig   (+ beg 22) 2 0.5)   (set! beg (+ beg 
spacing))
  (fast-calling-tree-cricket   (+ beg 24.5) 2 0.25)(set! beg (+ beg 
spacing))
  (dog-day-cicada  (+ beg 27) 2 0.1)   (set! beg (+ beg 
spacing))
  (linnaeus-cicada (+ beg 29.5) 2 0.125)   (set! beg (+ beg 
spacing))
  (lyric-cicada(+ beg 32) 2 0.125) (set! beg (+ beg 
spacing))
  (confused-ground-cricket (+ beg 34.5) 2 0.3) (set! beg (+ beg 
spacing))
  (tinkling-ground-cricket (+ beg 37) 2 0.3)   (set! beg (+ beg 
spacing))
  (marsh-meadow-grasshopper(+ beg 39.5) 0.3)   (set! beg (+ beg 
spacing))
  (striped-ground-cricket  (+ beg 45) 2 0.25)  (set! beg (+ beg 
spacing))
  (sphagnum-ground-cricket (+ beg 47.5) 2 0.3) (set! beg (+ beg 
spacing))
  (southeastern-field-cricket  (+ beg 50) 2 0.13)  (set! beg (+ beg 
spacing))
  (snowy-tree-cricket  (+ beg 52.5) 2.1 0.3)   (set! beg (+ beg 
spacing))
  (slightly-musical-conehead   (+ beg 55) 2 0.4)   (set! beg (+ beg 
spacing))
  (pine-tree-cricket   (+ beg 57.5) 

Re: [PD] pd-scheme / SIOD

2013-09-17 Thread Orm Finnendahl
Hi Luigi,

Am Dienstag, den 17. September 2013 um 11:29:02 Uhr (+0200) schrieb
Luigi Rensinghoff:
 
 I found i nice scheme script in the context of the
 linux-sound-editor snd, that synthesizes plenty of birds, animals
 and insects.

That really is a very nice and sweet thing.

 So i was wondering if it possible to get this running inside of PD,
 so i can be played in realtime...

This would require an enormous amount of work: The scheme code in snd
refers to a special built-in scheme (called s7) with lots of
optimizations (and to my knowledge foreign, non-scheme code) for sound
processing.

 How difficult is it to compile SIOD on OS X ?

I've used it 10 years ago on linux and it was no big deal. I didn't
look into it lately but I don't think it's very diffcult on OSX. Bear
in mind though, that siod is a very small interpreter. It's primary
focus is on scripting and prototyping in the control realm, not doing
audio.

If you really want to use snd's functions and the birdsong code, my
guess for the easiest way would be to create a small abstraction for
running snd with s7 as a pd subprocess or -even without programming-
piping to an external snd process (e.g. via sockets) and for capturing
snd's audio out either by creating a loopback via jack and pd's adc~
or by patching into snd's output routines. Lookup the snd
documentation about running snd as an inferior emacs subprocess to get
an idea of how this works.

HTH,
Orm

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] pd-scheme / SIOD

2013-09-17 Thread Kjetil Matheussen
On Tue, Sep 17, 2013 at 11:29 AM, Luigi Rensinghoff
soundg...@freenet.de wrote:
 Hi List, Hi Larry


 I havent been using PD for a while.

 But i have a little project which i like to explore

 I found i nice scheme script in the context of the linux-sound-editor 
 snd, that synthesizes plenty of birds, animals and insects.

 So i was wondering if it possible to get this running inside of PD, so i can 
 be played in realtime...

 How difficult is it to compile SIOD on OS X ?


I don't know how much time you want to spend on this. Making it work
on Linux shouldn't be too hard,
using snd-ls and compiling snd with the --pd-external option. This way
you create snd as a pd-external,
with the ability to run scheme code in real time (no kidding).
http://archive.notam02.no/arkiv/src/snd-ls/snd-ls-0.9.8.17.tar.gz

But you probably have to sweat a little bit for this to work, and to
make it work on OSX you might have
to spend a good amount of time, since I don't think anyone has run
snd-ls/snd-rt on OSX.

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] pd-scheme / SIOD

2013-09-17 Thread Kjetil Matheussen
On Tue, Sep 17, 2013 at 3:40 PM, Kjetil Matheussen
k.s.matheus...@gmail.com wrote:

 I don't know how much time you want to spend on this. Making it work
 on Linux shouldn't be too hard,
 using snd-ls and compiling snd with the --pd-external option. This way
 you create snd as a pd-external,
 with the ability to run scheme code in real time (no kidding).
 http://archive.notam02.no/arkiv/src/snd-ls/snd-ls-0.9.8.17.tar.gz


More info here: http://users.notam02.no/~kjetism/snd-rt/

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list