Multichannel Sampler?

51 views
Skip to first unread message

Jason Levine

unread,
Jan 9, 2018, 9:31:29 PM1/9/18
to extemp...@googlegroups.com
Hey all,

In instruments-ext.xtm  it says that the extempore sampler can be multichannel. How would I go about setting which channel(s) a sample should play on?  

--
Jason Levine
new media performer + creative coder

Andrew Sorensen

unread,
Jan 10, 2018, 12:18:53 AM1/10/18
to extemp...@googlegroups.com
are you talking about multichannel source material or spatialised output?

--
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

unread,
Jan 10, 2018, 11:59:11 AM1/10/18
to extemp...@googlegroups.com
Spatialized output.  I'm looking to send multiple stereo channels through soundflower to different channels in my DAW.

Andrew Sorensen

unread,
Jan 10, 2018, 7:17:27 PM1/10/18
to extemp...@googlegroups.com
Ok, so it turns out that true note level multi-channel panning in the sampler has not been implemented properly.  In *theory* support is there, but in practice it's broken - that's on me sorry :(  The fix for this isn't difficult but it's probably best if I do it.

However, I think what you're after is just some stereo busing which is straightforward.  There are a few ways you can do it, but the simplest is probably just something like this:

So assuming 4 stereo buses into your DAW:

(bind-func dsp:DSP
  (lambda (in time chan dat)
    (cond ((< chan 2)  ;; stereo bus 1
           (sampler1 in time (- chan 0) dat))
          ((< chan 4)  ;; stereo bus 2
           (sampler2 in time (- chan 2) dat))
          ((< chan 6)  ;; stereo bus 3
           (sampler3 in time (- chan 4) dat))
          ((< chan 8)  ;; stereo bus 4
           (* 0.1 (random))) ;; white noise for fun!
          (else 0.0))))

Take note of the (- chan x) which ensures that each sampler gets channels 0 & 1.

Now you have 4 sound generators (1 * sampler, 2 * fmsynth, 1* white noise) on 'isolated' stereo buses.

For you case you'll just make more samplers.

Cheers,
Andrew.


Andrew Sorensen

unread,
Jan 10, 2018, 7:18:56 PM1/10/18
to extemp...@googlegroups.com
sorry I changed it to 3 * samplers, 1 * white noise

Jason Levine

unread,
Jan 10, 2018, 9:25:27 PM1/10/18
to extemp...@googlegroups.com
Thanks for the example, but careful with your fun white noise, you may receive a copyright claim ;) 
I don't think I can pull off more than one sampler since I have close to 1000 samples(some long) and my RAM is pretty tight (also as you said, I may have a memory leak).  
What needs to be done to do per note channel selection?  

Andrew Sorensen

unread,
Jan 10, 2018, 9:50:56 PM1/10/18
to extemp...@googlegroups.com
Can you please explain what you are *really* trying to do?

It seems to me that you want to record different samples to different DAW tracks?

And that the samples that you are trying to record are stereo samples?  

I also presume that *ultimately* you are going to mix down your DAW tracks to a stereo output from your DAW?

Jason Levine

unread,
Jan 11, 2018, 1:03:19 AM1/11/18
to extemp...@googlegroups.com
So I have 1 sampler with all my samples, and some xtlang code which spatializes them in the stereo field based on their relative positions in the t-SNE plot.  I want to be able to livecode the way that certain samples go to specific tracks(preferably stereo) in the DAW so that they can be effected by different dsp chains.  Ideally, channel would be a parameter of play/play-note. And yes the tracks will be mixed down to stereo in the DAW.  For example, all samples with a centroid higher than a certain frequency go to one track with highpass filter and the rest go to a track with a lowpass filter.  Another example: on every 4th bar send the sampler audio to a track with a bandpass filter, a delay, and reverb processing. Finally, use cosr/sinr/rectr/trir to oscillate the samples between a clean compressed channel, and a channel with heavy saturation and modulation. 

Does this make sense?

Andrew Sorensen

unread,
Jan 11, 2018, 2:26:42 AM1/11/18
to extemp...@googlegroups.com
You're after behaviour that doesn't fit the general case very well so I don't want to change the existing sampler code.

So, you are going to need to write a custom sampler_note function, you may as well also do a custom sampler_fx at the same time and then you'll have a complete instrument.
Just copy the existing functions sampler_note and sampler_fx, rename them, and then edit as required.

My suggestion would be that you simply add an additional argument (nargs) that indexes a particular stereo bus
Leave the current rendering to happen on chans 1 & 2 for normal stereo panning, but buffer the l & r locally until the correct busnum comes around

It will take you some time to digest sampler_note, but once you understand it then making the appropriate changes will be quicker than reading this email :)

 

Andrew Sorensen

unread,
Jan 11, 2018, 2:29:24 AM1/11/18
to extemp...@googlegroups.com
where busnum = (pref dargs 4)

Jason Levine

unread,
Jan 11, 2018, 1:19:09 PM1/11/18
to extemp...@googlegroups.com
Ok, I will get deep with sampler_note. I have "feared" for a while that my t-SNE sampler will have to be its own Extempore instrument unique from the existing sampler. But just so I understand, what is the general case for spatialization?  I'm guessing that its the same as what I'm saying but without the stereo buses? So you can "pan" across multichannel output? Or At least select which channel a given sample is played through?

Ben Swift

unread,
Jan 11, 2018, 5:23:47 PM1/11/18
to extemp...@googlegroups.com
I guess it's also worth reminding (and hopefully encouraging!) you that
building your own instrument for this purpose isn't a bad thing -
Extempore has always been designed to allow you to tweak not just the
note level stuff, but also to play around with the signal chain.

So have fun :)

Cheers
Ben
>>>>>>>>>>> *https://www.behance.net/jasonlevine
>>>>>>>>>>> <https://www.behance.net/jasonlevine>*
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> 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 extemporelan...@googlegroups.com.
>>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> 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 extemporelan...@googlegroups.com.
>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Jason Levine
>>>>>>>>> new media performer + creative coder
>>>>>>>>> *https://www.behance.net/jasonlevine
>>>>>>>>> <https://www.behance.net/jasonlevine>*
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> 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 extemporelan...@googlegroups.com.
>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> --
>>>>>>> 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 extemporelan...@googlegroups.com.
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Jason Levine
>>>>>> new media performer + creative coder
>>>>>> *https://www.behance.net/jasonlevine
>>>>>> <https://www.behance.net/jasonlevine>*
>>>>>>
>>>>>> --
>>>>>> 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 extemporelan...@googlegroups.com.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>> --
>>>>> 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 extemporelan...@googlegroups.com.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Jason Levine
>>>> new media performer + creative coder
>>>> *https://www.behance.net/jasonlevine
>>>> <https://www.behance.net/jasonlevine>*
>>>>
>>>> --
>>>> 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 extemporelan...@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>> --
>> 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 extemporelan...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Jason Levine
> new media performer + creative coder
> *https://www.behance.net/jasonlevine <https://www.behance.net/jasonlevine>*

Andrew Sorensen

unread,
Jan 11, 2018, 6:37:52 PM1/11/18
to extemp...@googlegroups.com
The general case for 'panning' is to 'pan' :)  For stereo panning this is panning between 2 speakers - for multi-channel outputs this is panning between 'n' speakers.  The stereo case being a subset of the more general multi-channels case.

You do not actually want multi-channel 'panning' - you want stereo 'panning' with an additional option to send a stereo image to a discrete pair of output channels.  Which of course Extempore can easily accommodate, but this is not a general panning problem.

So, in brief there are two main considerations here. (1) panning is not (usually) discrete. (2) because panning is not (usually) discrete this introduces the notion of bleed - how much signal should be sent to each 'discrete' channel for any given real numbered pan position 

Extempore has a good general purpose tool for panning: pan_c (audio_dsp).  
Here is a really simple multi-channel example that should help you to better explain.
You don't need to hear this example in a multi-channel setup, simply 'watch' the channel level meters on your multi-channel mixer.
You'll need to run extempore with --channels set to something appropriate for your hardware (e.g. --channels=16)

The most important thing to play with in this example is the bleed number which can range from 0.0 -> CHANNELS.  For 'channels=16' that would be a bleed of anything between 0.0 and 16.0.

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

;; pan whitenoise around CHANNELS number of channels
(bind-func dsp:DSP
  (let ((panner (pan_c (i32toi64 CHANNELS))))
    (lambda (in time chan dat)
        (panner chan 
                (* 0.5 (random))   ;; mono signal
                0.1                ;; bleed (change manually to 0.5, 1.0, 2.0, 4.0)
                (% (* (i64tof time) 0.000025) (i32tof CHANNELS))))))

(dsp:set! dsp)


Make sure that you play with the bleed which can be anything from 0.0 up to CHANNELS.







Jason Levine

unread,
Feb 7, 2018, 6:40:46 PM2/7/18
to extemp...@googlegroups.com
Hey Andrew,

I had some success with the multichannel panning, and now I've gone back to the stereo bussing example you shared earlier in this thread.  For some reason, only channels 0 and 1 are making it from extempore through soundflower to the daw.  Even if I put  (* 0.5 (random)) on every bus, it only makes it to channels 0 and 1. If I run the panner example(above) with the same daw setup, all 8 channels make it through.   Is there something missing that I need to add?

(bind-func dsp:DSP
  (lambda (in time chan dat)
    (cond ((< chan 2)  ;; stereo bus 1
           (sampler1 in time (- chan 0) dat))
          ((< chan 4)  ;; stereo bus 2
           (sampler2 in time (- chan 2) dat))
          ((< chan 6)  ;; stereo bus 3
           (sampler3 in time (- chan 4) dat))
          ((< chan 8)  ;; stereo bus 4
           (* 0.1 (random))) ;; white noise for fun!
          (else 0.0))))


Jason Levine

unread,
Feb 8, 2018, 5:35:38 PM2/8/18
to extemp...@googlegroups.com
Apologies, I neglected to specify --channels 8 when running extempore  <facepalm>

I am now happily EQing the output of my tsnesampler based on the 2d position of the sample being played :)
Reply all
Reply to author
Forward
0 new messages