Re: [CM] portamento

2022-05-11 Thread bil

I wouldn't use a linear envelope for the amplitude and
frequency.  There are some examples online, but I would
get a recording that has the effect you want,
and try to mimic it -- that process makes you
focus on the details (like is the sweep continuous,
is it changing in speed, etc).

___
Cmdist mailing list
Cmdist@ccrma.stanford.edu
https://cm-mail.stanford.edu/mailman/listinfo/cmdist


Re: [CM] S7 questions and libc issue

2022-05-11 Thread bil

By support for types, are you referring to srfi-9 or
srfi-99? That stuff is trivial; I'd use lets + methods
in s7, but r7rs.scm also has an implementation using vectors.
I thought you were referring to typed variables
like saying "int i" in C. You'd use a setter for that in s7.

___
Cmdist mailing list
Cmdist@ccrma.stanford.edu
https://cm-mail.stanford.edu/mailman/listinfo/cmdist


Re: [CM] S7 questions and libc issue

2022-05-11 Thread bil

That's an interesting project!  To answer some of
your questions:

I think tcc can build s7 statically in linux.  Here's an example
in Ubuntu:

tcc -o s7 s7.c -I. -lm -DWITH_MAIN
s7
s7: 9-May-2022


(+ 1 2)

3

The -DWITH_MAIN switch includes a minimal repl, so you don't need
repl.c or libc_s7.so.  The other choice is nrepl.scm but that
requires the notcurses-core library.

I notice you're using musl -- I think s7 works with it, but there was
some header problem in libgsl -- I did not pursue it.  I haven't
tried tcc with musl in linux.

On your chart, the s7 entries looks accurate to me.  s7 has the full
numeric tower (including multiprecision support for all types via
gmp, mpfr, and mpc).  s7 macros are "low-level" -- CL-style
define-macro.  s7 has full tail recursion optimization, unless
I inadvertently missed some case.  You can define arbitrary types
via "setters", but the optimizer is not very smart about them
yet.

___
Cmdist mailing list
Cmdist@ccrma.stanford.edu
https://cm-mail.stanford.edu/mailman/listinfo/cmdist


[CM] portamento

2022-05-11 Thread James Hearon
Hi,
I'm still pondering how best to accomplish this.  I tried a couple of exs 
below, one adding filters.

I thought bandpass was best to try but couldn't get good high cutoff results 
with just one filter so I went to two overlapping bandpass filters.  But I've 
buggered the freqs by an octave somehow.  That could have been in using 
hz->radians as cutoffs.

I think my experiments still sound too glissy overall.

I'm wondering if there are other suggestions?

Thank you,
Jim

;no portamento.
(definstrument (noport start-time duration frequency (amp-env '(0 0 1 1 2 1 3 
0)) sampling-rate)
  (let* ((beg (floor (* start-time sampling-rate)))
(end (+ beg (floor (* duration sampling-rate
(sine-wave (make-oscil :frequency frequency))
(ampf (make-env amp-env :duration duration :scaler 1.0))
 )
 (do ((i beg (+ i 1)))
 ((= i end))
 (outa i (* (env ampf) (oscil sine-wave )))
 (outb i (* (env ampf) (oscil sine-wave )))
 )))

;portamento. no filter.
(definstrument (myport start-time duration frequency start-freq end-freq 
(amp-env '(0 0 1 1 2 1 3 0)) sampling-rate)
  (let* ((beg (floor (* start-time sampling-rate)))
(end (+ beg (floor (* duration sampling-rate
(sine-wave (make-oscil :frequency frequency))
(ampf (make-env amp-env :duration duration :scaler 1.0))
(frqf (make-env '(0 0 1 1) :scaler (hz->radians (- end-freq start-freq)) 
:duration duration :base 0.67))
 )
 (do ((i beg (+ i 1)))
 ((= i end))
 (outa i (* (env ampf) (oscil sine-wave (env frqf) )))
 (outb i (* (env ampf) (oscil sine-wave (env frqf) )))
 )))

(with-sound (:srate 48000 :channels 2 :header-type mus-riff  :play #t)
  (myport 0 1 300 300 400 '(0 .3 .5 .1  1 .09) 48000)
  (noport 1.1 .9 400 '(0 .01 1 .1) 48000)

  (myport 2 1 400 400 500 '(0 .2 .5 .1  1 .09) 48000)
  (noport 3.1 .9 500 '(0 .01 1 .1) 48000)

  (noport 4 .3 500 '(0 .19 .3 .001) 48000)
  (myport 4.2 .6 500 500 300 '(0 .001 .5 .1 1 .3) 48000)
  (noport 5 1 300 '(0 .08 .3 .001) 48000)
)

;portamento adding filters.
(definstrument (myportfilt start-time duration frequency start-freq end-freq 
(glissamp-env '(0 0 1 1 2 0)) (amp-env '(0 0 1 1 2 1 3 0)) sampling-rate order1 
flow1 fhigh1 order2 flow2 fhigh2)
  (let* ((beg (floor (* start-time sampling-rate)))
(end (+ beg (floor (* duration sampling-rate
(sine-wave (make-oscil :frequency frequency)) ;sine osc
(ampf (make-env amp-env :duration duration :scaler 1.0)) ;overall amp env
(frqf (make-env '(0 0 1 1) :scaler (hz->radians (- end-freq start-freq)) 
:duration duration :base 0.67)) ;gliss
(gliss_amp (make-env glissamp-env :duration duration :scaler 1.0)) ;another amp 
env for the gliss
(flt1 (make-butterworth-bandpass order1 (hz->radians flow1)  (hz->radians 
fhigh1)))
(flt2 (make-butterworth-bandpass order2 (hz->radians flow2)  (hz->radians 
fhigh2)))
)
 (do ((i beg (+ i 1)))
 ((= i end))
(outa i (* (env ampf) (+  (* (env gliss_amp)(flt1 (oscil sine-wave  (env 
frqf (* (env gliss_amp)(flt2 (oscil sine-wave  (env frqf)))
(outb i (* (env ampf) (+  (* (env gliss_amp)(flt1 (oscil sine-wave  (env 
frqf (* (env gliss_amp)(flt2 (oscil sine-wave  (env frqf)))
 )))

(with-sound (:srate 48000 :channels 2 :header-type mus-riff  :play #t)
  (noport 0 .55 400 '(0 .03 1 .01) 48000)
  (myportfilt .5 .4 200 200 400 '(0 .3 .4 .1) '(0 0.03 .9 0.06) 
48000 8 100 150 8 100 200)
  (noport .5 .5 800 '(0 .01 1 .01) 48000)

 (noport 1 .55 800 '(0 .03 1 .01) 48000)
  (myportfilt 1.5 .4 400 400 200 '(0 .3 .4 .01) '(0 0.03 .9 0.06) 
48000 8 100 150 8 100 200)
  (noport 1.5 .5 400 '(0 .01 1 .01) 48000)

  (noport 3 1.1 400 '(0 .03 1 .01) 48000)
  (myportfilt 4 .9 200 200 400 '(0 .3 .9 .1) '(0 0.03 .9 0.06) 
48000 8 100 150 8 100 200)
  (noport 5 1 800 '(0 .02 1 .1) 48000)
  )
___
Cmdist mailing list
Cmdist@ccrma.stanford.edu
https://cm-mail.stanford.edu/mailman/listinfo/cmdist