This forum is now locked and moved (back) to Plogue's forum http://plogue.com/phpBB3/viewforum.php?f=14
Round robin question
  • Posts: 0
    I'm trying to figure out a clever way of mapping round robin for a snare with both bottom mic and top mic samples. This is what I've come up with so far:
    // SNARE ///////////////////////////////////////////////////////////////////////////
    //----------------------------------------------------------------------------------

    // Snare Top
    <group> key=38 loop_mode=one_shot lovel=0 hivel=10 amplitude_oncc20=100 pan_oncc22=100
    <region> sample=Snare\snare top 1 - 14in pearl master custom.wav seq_length=2 seq_position=1 tune=0 lorand=0 hirand=0.2
    <region> sample=Snare\snare top 2 - 14in pearl master custom.wav seq_length=2 seq_position=2 tune=0 lorand=0 hirand=0.2
    <region> sample=Snare\snare top 1 - 14in pearl master custom.wav seq_length=2 seq_position=1 tune=1 lorand=0.21 hirand=0.4
    <region> sample=Snare\snare top 2 - 14in pearl master custom.wav seq_length=2 seq_position=2 tune=1 lorand=0.21 hirand=0.4
    <region> sample=Snare\snare top 1 - 14in pearl master custom.wav seq_length=2 seq_position=1 tune=-1 lorand=0.41 hirand=0.6
    <region> sample=Snare\snare top 2 - 14in pearl master custom.wav seq_length=2 seq_position=2 tune=-1 lorand=0.41 hirand=0.6
    <region> sample=Snare\snare top 1 - 14in pearl master custom.wav seq_length=2 seq_position=1 tune=2 lorand=0.61 hirand=0.8
    <region> sample=Snare\snare top 2 - 14in pearl master custom.wav seq_length=2 seq_position=2 tune=2 lorand=0.61 hirand=0.8
    <region> sample=Snare\snare top 1 - 14in pearl master custom.wav seq_length=2 seq_position=1 tune=-2 lorand=0.81 hirand=1
    <region> sample=Snare\snare top 2 - 14in pearl master custom.wav seq_length=2 seq_position=2 tune=-2 lorand=0.81 hirand=1

    // Snare Bottom
    <group> key=38 loop_mode=one_shot lovel=0 hivel=10 amplitude_oncc21=100 pan_oncc22=100
    <region> sample=Snare\snare bottom 1 - 14in pearl master custom.wav seq_length=2 seq_position=1 tune=0 lorand=0 hirand=0.2
    <region> sample=Snare\snare bottom 2 - 14in pearl master custom.wav seq_length=2 seq_position=2 tune=0 lorand=0 hirand=0.2
    <region> sample=Snare\snare bottom 1 - 14in pearl master custom.wav seq_length=2 seq_position=1 tune=1 lorand=0.21 hirand=0.4
    <region> sample=Snare\snare bottom 2 - 14in pearl master custom.wav seq_length=2 seq_position=2 tune=1 lorand=0.21 hirand=0.4
    <region> sample=Snare\snare bottom 1 - 14in pearl master custom.wav seq_length=2 seq_position=1 tune=-1 lorand=0.41 hirand=0.6
    <region> sample=Snare\snare bottom 2 - 14in pearl master custom.wav seq_length=2 seq_position=2 tune=-1 lorand=0.41 hirand=0.6
    <region> sample=Snare\snare bottom 1 - 14in pearl master custom.wav seq_length=2 seq_position=1 tune=2 lorand=0.61 hirand=0.8
    <region> sample=Snare\snare bottom 2 - 14in pearl master custom.wav seq_length=2 seq_position=2 tune=2 lorand=0.61 hirand=0.8
    <region> sample=Snare\snare bottom 1 - 14in pearl master custom.wav seq_length=2 seq_position=1 tune=-2 lorand=0.81 hirand=1
    <region> sample=Snare\snare bottom 2 - 14in pearl master custom.wav seq_length=2 seq_position=2 tune=-2 lorand=0.81 hirand=1

    If I understand my own mapping correctly a strike (with a velocity of 0-10) will make the sequence start and pick one of the position 1 samples. One sample from the Snare Top and one sample from the Snare Bottom and they will play/sound at them same time. The next strike will generate a sample from the once in seq_position=2. One from Snare Top and one from Snare Bottom and they will play/sound at the same time.

    There's 5 variations for seq_position=1 to choose from and the same goes for seq_position=2. Each variation has 20% probability to be chosen according to my lorand hirand numbers. The same sample variation will never be chosen twice in a row.

    I can control the amplitude separately for both bottom and top snare with cc20 and 21 and I can pan the bottom and top snare samples together with cc22.

    The bad thing is that there can be a mismatch between bottom and top snare samples. Let's say it picks the top snare sample with tune=-1 and the bottom snare sample with tune=2... they wouldn't match and sound weird if played together. Even more if I had real variations sampled.
    Maybe something like this could solve that problem?:
    // Snare Top and Bottom
    <group> key=38 loop_mode=one_shot lovel=0 hivel=127 amplitude_oncc20=100 pan_oncc22=100
    <region> sample=Snare\snare top 1 - 14in pearl master custom.wav sample=Snare\snare bottom 1 - 14in pearl master custom.wav seq_length=2 seq_position=1 tune=0 lorand=0 hirand=0.2
    <region> sample=Snare\snare top 2 - 14in pearl master custom.wav sample=Snare\snare bottom 2 - 14in pearl master custom.wav seq_length=2 seq_position=2 tune=0 lorand=0 hirand=0.2
    <region> sample=Snare\snare top 1 - 14in pearl master custom.wav sample=Snare\snare bottom 1 - 14in pearl master custom.wav seq_length=2 seq_position=1 tune=1 lorand=0.21 hirand=0.4
    <region> sample=Snare\snare top 2 - 14in pearl master custom.wav sample=Snare\snare bottom 2 - 14in pearl master custom.wav seq_length=2 seq_position=2 tune=1 lorand=0.21 hirand=0.4
    <region> sample=Snare\snare top 1 - 14in pearl master custom.wav sample=Snare\snare bottom 1 - 14in pearl master custom.wav seq_length=2 seq_position=1 tune=-1 lorand=0.41 hirand=0.6
    <region> sample=Snare\snare top 2 - 14in pearl master custom.wav sample=Snare\snare bottom 2 - 14in pearl master custom.wav seq_length=2 seq_position=2 tune=-1 lorand=0.41 hirand=0.6
    <region> sample=Snare\snare top 1 - 14in pearl master custom.wav sample=Snare\snare bottom 1 - 14in pearl master custom.wav seq_length=2 seq_position=1 tune=2 lorand=0.61 hirand=0.8
    <region> sample=Snare\snare top 2 - 14in pearl master custom.wav sample=Snare\snare bottom 2 - 14in pearl master custom.wav seq_length=2 seq_position=2 tune=2 lorand=0.61 hirand=0.8
    <region> sample=Snare\snare top 1 - 14in pearl master custom.wav sample=Snare\snare bottom 1 - 14in pearl master custom.wav seq_length=2 seq_position=1 tune=-2 lorand=0.81 hirand=1
    <region> sample=Snare\snare top 2 - 14in pearl master custom.wav sample=Snare\snare bottom 2 - 14in pearl master custom.wav seq_length=2 seq_position=2 tune=-2 lorand=0.81 hirand=1

    This way both the Top and Bottom sample will trigger within the same region and have the same tune. But now I can't control volume or amplitude separately for bottom or top samples. Could I solve that somehow?
  • davidvdavidv
    Posts: 453
    <region> sample=Snare\snare top 1 - 14in pearl master custom.wav sample=Snare\snare bottom 1 - 14in pearl master custom.wav seq_length=2 seq_position=1 tune=0 lorand=0 hirand=0.2

    You have two sample definitions in your <region>?
  • Posts: 0
    davidv said:
    <region> sample=Snare\snare top 1 - 14in pearl master custom.wav sample=Snare\snare bottom 1 - 14in pearl master custom.wav seq_length=2 seq_position=1 tune=0 lorand=0 hirand=0.2

    You have two sample definitions in your <region>?

    Yes in that round robin version I have two sample definitions in one region. It felt weird, but I couldn't resist trying it. It actually plays both samples at the same time and that's what I want.

    Did you look at both my attempts for a solution? What do you think of them? Are my reasoning of what they do valid?
  • davidvdavidv
    Posts: 453
    "rockdude" said:

    Yes in that round robin version I have two sample definitions in one region. It felt weird, but I couldn't resist trying it :lol: It actually plays both samples at the same time and that's what I want.

    Did you look at both my attempts for a solution? What do you think of them? Are my reasoning of what they do valid?


    Seems you dont really care about compliance to the spec, linuxsampler, if it allows two samples in one region, is broken.

    The idea would be to try to do what you want in a SFZ compliant way, I dont see the relevance in helping you find ways to make it work using linuxsampler's specific implementation details.
  • Posts: 0
    "davidv" said:
    [quote="rockdude"]
    Yes in that round robin version I have two sample definitions in one region. It felt weird, but I couldn't resist trying it :lol: It actually plays both samples at the same time and that's what I want.

    Did you look at both my attempts for a solution? What do you think of them? Are my reasoning of what they do valid?


    Seems you dont really care about compliance to the spec,
    linuxsampler, if it allows two samples in one region, is broken. I dont see the point in trying to pursue this.[/quote]
    Well I'm sorry David if I somehow offended a sfz-veteran like you. I do care about compliance to the spec. As I've said before, I'm a total noob at this so I really don't know when I'm doing something that's out of spec. Sfz documentation is kind of blurry at times...version 2.x is not even completely available online so sometimes you just have to try what works or not. I'm almost all Aria Player at the moment since it's more strict and stable, and a big plus is that I can discuss sfz here with you and others (The Linux Sampler forum is kind of dead). This round robin attempt with two samples in the same region were only tested in Linux Sampler though, prior to your comment about compliance. I've now tested it in Aria Player and it doesn't work as you hinted.

    My first version of the round robin in my post doesn't have two samples in the same region. Does it break compliance to the spec?
    Just ignore Linux sampler and discuss what works in Aria Player...(and remember that I'm still a stupid and wild sfz-monkey trying to find my place) :D

    (The postman delivered "Cakewalk Synthesizers: From Presets to Power User" when I writing this post)
  • davidvdavidv
    Posts: 453
    "rockdude" said:

    My first version of the round robin in my post doesn't have two samples in the same region. Does it break compliance to the spec?
    Just ignore Linux sampler and discuss what works in Aria Player...(and remember that I'm still a stupid and wild sfz-monkey trying to find my place) :D


    Sorry i didnt mean to be rude, just that its hard as it is to try to be compliant. I'm not saying ARIA is perfect, i've been improving the SFZ stuff all week
    right now doing xfin_xxcc and xfout_xxcc which are interresting to say the least.

    "rockdude" said:

    (The postman delivered "Cakewalk Synthesizers: From Presets to Power User" when I writing this post)


    Thats pretty good, i hope its the second edition though :)

    back to the issue at hand, a few potential problems

    <region> X hirand=0.2
    <region> Y lorand=0.21

    since hirand is a real value, this will generate an uncertainty and at some point you will get silences since
    the [0.20000(...)1; 0.20999(...)9] AKA ]0.2;2.1[ range is not covered.
    The spec in that book calls hirand "exclusive" , so you can safely use

    <region> (...) hirand=0.2
    <region> (...) lorand=0.2

    However, just a few days ago i noticed that my implemention was dodgeyso it should be 100% working in ARIA 1.120 (soon)

    I think your sfz file (first example) is free of errors, i dont see how two tunes should mismatch since the random and sequences for both Snare Top
    and Snare Bottom should be in sync, otherwise theres a bug in either aria or linuxsampler, can you confirm and mention each version?
  • davidvdavidv
    Posts: 453
    Simplifying to work without samples using ARIA's built in *sine and *saw generators (easier to test)

    I dont get any tune problems in my current 1.120 version. (nor 1.111)
    Pan is used to show both layers at once playing for each sequence/random. if there were pitch problems, your ears would hurt :)



    // SNARE ///////////////////////////////////////////////////////////////////////////
    //----------------------------------------------------------------------------------

    // Snare Top
    &lt;group&gt; key=38 pan=-100
    &lt;region&gt; sample=*saw seq_length=2 seq_position=1 tune=0 lorand=0 hirand=0&#46;2
    &lt;region&gt; sample=*sine seq_length=2 seq_position=2 tune=0 lorand=0 hirand=0&#46;2
    &lt;region&gt; sample=*saw seq_length=2 seq_position=1 tune=50 lorand=0&#46;2 hirand=0&#46;4
    &lt;region&gt; sample=*sine seq_length=2 seq_position=2 tune=50 lorand=0&#46;2 hirand=0&#46;4
    &lt;region&gt; sample=*saw seq_length=2 seq_position=1 tune=-50 lorand=0&#46;4 hirand=0&#46;6
    &lt;region&gt; sample=*sine seq_length=2 seq_position=2 tune=-50 lorand=0&#46;4 hirand=0&#46;6
    &lt;region&gt; sample=*saw seq_length=2 seq_position=1 tune=100 lorand=0&#46;6 hirand=0&#46;8
    &lt;region&gt; sample=*sine seq_length=2 seq_position=2 tune=100 lorand=0&#46;6 hirand=0&#46;8
    &lt;region&gt; sample=*saw seq_length=2 seq_position=1 tune=-100 lorand=0&#46;8 hirand=1
    &lt;region&gt; sample=*sine seq_length=2 seq_position=2 tune=-100 lorand=0&#46;8 hirand=1

    // Snare Bottom
    &lt;group&gt; key=38 pan=100
    &lt;region&gt; sample=*saw seq_length=2 seq_position=1 tune=0 lorand=0 hirand=0&#46;2
    &lt;region&gt; sample=*sine seq_length=2 seq_position=2 tune=0 lorand=0 hirand=0&#46;2
    &lt;region&gt; sample=*saw seq_length=2 seq_position=1 tune=50 lorand=0&#46;2 hirand=0&#46;4
    &lt;region&gt; sample=*sine seq_length=2 seq_position=2 tune=50 lorand=0&#46;2 hirand=0&#46;4
    &lt;region&gt; sample=*saw seq_length=2 seq_position=1 tune=-50 lorand=0&#46;4 hirand=0&#46;6
    &lt;region&gt; sample=*sine seq_length=2 seq_position=2 tune=-50 lorand=0&#46;4 hirand=0&#46;6
    &lt;region&gt; sample=*saw seq_length=2 seq_position=1 tune=100 lorand=0&#46;6 hirand=0&#46;8
    &lt;region&gt; sample=*sine seq_length=2 seq_position=2 tune=100 lorand=0&#46;6 hirand=0&#46;8
    &lt;region&gt; sample=*saw seq_length=2 seq_position=1 tune=-100 lorand=0&#46;8 hirand=1
    &lt;region&gt; sample=*sine seq_length=2 seq_position=2 tune=-100 lorand=0&#46;8 hirand=1
  • Posts: 0
    "davidv" said:

    Sorry i didnt mean to be rude, just that its hard as it is to try to be compliant. I'm not saying ARIA is perfect, i've been improving the SFZ stuff all week
    right now doing xfin_xxcc and xfout_xxcc which are interresting to say the least.

    No harm done. I'm thrilled you're working on improving sfz. I do see great use for xfin and xfout for drums! :D

    "davidv" said:

    Thats pretty good, i hope its the second edition though :)

    It's the second edition.

    "davidv" said:

    The spec in that book calls hirand "exclusive" , so you can safely use

    <region> (...) hirand=0.2
    <region> (...) lorand=0.2

    However, just a few days ago i noticed that my implemention was dodgeyso it should be 100% working in ARIA 1.120 (soon)

    So you're saying there's no possibility that <region> (...) hirand=0.2 <region> (...) lorand=0.2 could generate a overlap causing two samples to play at the same time? I thought it might be so, but didn't no for sure. Thanks for explaining. Now I think I understand. Looking forward to ARIA 1.120! 8)

    "davidv" said:
    I think your sfz file (first example) is free of errors, i dont see how two tunes should mismatch since the random and sequences for both Snare Top
    and Snare Bottom should be in sync, otherwise theres a bug in either aria or linuxsampler, can you confirm and mention each version?

    Maybe I'm misunderstanding how seq_length and seq_position operates.
    Let's say I strike my snare drum. My thought is that the drum strike goes into seq_position=1 where there's five versions of the sample snare top 1 and snare bottom 1 with different tune. There's a 20% probability for a sample to be chosen in the pool. Let's say the first strike generates snare top 1 with tune=-2 and snare bottom 1 with tune=1.....that would mean they have different tunings and even though they're a matching couple the different tuning would sound a bit unnatural when they're played at the same time. The best thing would be if for example snare top 1 with tune=-2 is chosen it should also choose snare bottom 1 with tune=-2.
  • davidvdavidv
    Posts: 453
    "rockdude" said:

    So you're saying there's no possibility that <region> (...) hirand=0.2 <region> (...) lorand=0.2 could generate a overlap causing two samples to play at the same time? I thought it might be so, but didn't no for sure. Thanks for explaining. Now I think I understand. Looking forward to ARIA 1.120!


    First the chances that a real number random value falls exaclty on 0.2 is one in more than a million. (depending on the random algorithm used)
    and even WHEN this happens, since the spec declares hirand as exclusive, theres no chances that the two regions will play.


    "rockdude" said:

    Maybe I'm misunderstanding how seq_length and seq_position operates.
    Let's say I strike my snare drum. My thought is that the drum strike goes into seq_position=1 where there's five versions of the sample snare top 1 and snare bottom 1 with different tune. There's a 20% probability for a sample to be chosen in the pool. Let's say the first strike generates snare top 1 with tune=-2 and snare bottom 1 with tune=1.....that would mean they have different tunings and even though they're a matching couple the different tuning would sound a bit unnatural when they're played at the same time. The best thing would be if for example snare top 1 with tune=-2 is chosen it should also choose snare bottom 1 with tune=-2.


    That may be a border case implementation thing, in ARIA i evaluate seq_position once all other region selection checks have been made (including rand). Each region has a counter, its not at the group level. With these two peices of info, you can surely do the steps. (sorry my time is limited)
  • Posts: 0
    "davidv" said:

    That may be a border case implementation thing, in ARIA i evaluate seq_position once all other region selection checks have been made (including rand). Each region has a counter, its not at the group level. With these two peices of info, you can surely do the steps. (sorry my time is limited)

    Sorry for being stupid...I'm not sure I'm following. Do you mean that Aria runs the rand opcode before it runs seq_position? And for example all samples in seq_position=1 is not considered a pool from which rand chooses a sample to play?
  • davidvdavidv
    Posts: 453
    "rockdude" said:

    Sorry for being stupid...I'm not sure I'm following. Do you mean that Aria runs the rand opcode before it runs seq_position? And for example all samples in seq_position=1 is not considered a pool from which rand chooses a sample to play?


    yes ARIA runs the rand opcode, then checks the internal counter of this region for position. I think SFZ player does the same, need to recheck.
  • Posts: 0
    "davidv" said:
    [quote="rockdude"]
    Sorry for being stupid...I'm not sure I'm following. Do you mean that Aria runs the rand opcode before it runs seq_position? And for example all samples in seq_position=1 is not considered a pool from which rand chooses a sample to play?


    yes ARIA runs the rand opcode, then checks the internal counter of this region for position. I think SFZ player does the same, need to recheck.[/quote]
    Ouch! internal counters... hmm I think I have to experiment a little more to be able to understand how its treated. My reasoning seemed so logical. I really wanted it to be like how I imagined :)
  • davidvdavidv
    Posts: 453
    lorand/hirand, like lokey/hikey, lovel/hivel, (and many others) are conditions for a region to start.

    Once the region is selected in the pool to start, we look for position. Think about how the opposite would make a logic mess :)
  • Posts: 0
    "davidv" said:
    lorand/hirand, like lokey/hikey, lovel/hivel, (and many others) are conditions for a region to start.

    Once the region is selected in the pool to start, we look for position. Think about how the opposite would make a logic mess :)

    Ok, you're right I guess. But my reasoning still applies for the sfz code I wrote above, but in another order? The internal counters still makes me quiver a bit (don't know if it ruins how I think). This is my new attempt to understand what happens in my sfz code. Please correct me if I'm wrong. I really want to understand exactly what happens.

    1. I strike the drum once.

    2. lorand/hirand finds two regions with samples for Snare top; one of them is a snare top 1 sample and the other is snare top 2 sample.
    lorand/hirand also finds two regions with samples for Snare bottom; one of them is snare bottom 1 sample and the other is snare bottom 2 sample.

    3. Engine looks for position and since the regions with the snare top 1 and snare bottom 1 sample is placed in seq_position=1 in my code, those are chosen and played at the same time.

    4. I strike the drum again.

    5. lorand/hirand finds two regions with samples for Snare top; one of them is a snare top 1 sample and the other is snare top 2 sample.
    lorand/hirand also finds two regions with samples for Snare bottom; one of them is snare bottom 1 sample and the other is snare bottom 2 sample.

    6. Engine looks for position and since the regions with the snare top 2 and snare bottom 2 sample is placed in seq_position=2 in my code, those are chosen and played at the same time.

    7. I strike the drum again.

    8. The sequence_length was set to 2 and since two strikes have been made, this third strike makes it start at position 1 when the time comes to look for position.

    9. lorand/hirand finds two regions with samples for Snare top; one of them is a snare top 1 sample and the other is snare top 2 sample.
    lorand/hirand also finds two regions with samples for Snare bottom; one of them is snare bottom 1 sample and the other is snare bottom 2 sample.

    10. Engine looks for position and since the regions with the snare top 1 and snare bottom 1 sample is placed in seq_position=1 in my code, those are chosen and played at the same time.

    And so on in eternity....
  • Posts: 0
    I'm reviving this thread again David. I never got my last post confirmed by you.

    I'm about to record a snare rigorously that I'll map with sfz, so I need to fully grasp the concept
  • davidvdavidv
    Posts: 453
    Assume:


    lorand=0 hirand=0.5 seq_length=2

    sample=RED seq_position=1
    sample=BLACK seq_position=2


    lorand=0.5 hirand=1.0 seq_length=4

    sample=BLUE seq_position=1
    sample=YELLOW seq_position=2
    sample=ORANGE seq_position=3
    sample=PURPLE seq_position=4

    1)hit any key .... say random gets evaluated to 0.25
    ->RED plays

    2)hit any key .... say random gets evaluated to 0.75
    ->BLUE plays

    3)hit any key .... say random gets evaluated to 1.0
    ->YELLOW plays

    4)hit any key .... say random gets evaluated to 0.6
    ->ORANGE plays

    5)hit any key .... say random gets evaluated to 0.0
    BLACK plays.


    Two sequences, one for each random group. but in principle each region could have a different sequence length

    I dont know how i could be clearer.
  • Posts: 0
    by rockdude » Thu Oct 27, 2011 1:09 pm

    davidv wrote:
    I dont know how i could be clearer.

    I don't know how you could be clearer either ....but I appreciate this explanation very much! When written like this it can't be misinterpreted.

    Btw, did you get xfin_xxcc and xfout_xxcc implemented in a good way?
  • davidvdavidv
    Posts: 453
    rockdude wrote:
    Btw, did you get xfin_xxcc and xfout_xxcc implemented in a good way?


    Yes it should be as per the SFZ 2.0 spec now. Just need to ship the update. Still adding features ....
  • Posts: 0
    davidv wrote:
    rockdude wrote:
    Btw, did you get xfin_xxcc and xfout_xxcc implemented in a good way?


    Yes it should be as per the SFZ 2.0 spec now. Just need to ship the update. Still adding features ....

    Great, and more features....nice! I would love to see a way to add sfz knob controls in Arias effect section that you can control custom midi cc with so that it's possible to control whatever you want in the sfz code that has an opcode with a midi cc number attached to it.
  • davidvdavidv
    Posts: 453
    rockdude wrote:
    Great, and more features....nice! I would love to see a way to add sfz knob controls in Arias effect section that you can control custom midi cc with so that it's possible to control whatever you want in the sfz code that has an opcode with a midi cc number attached to it.


    This is in fact a new feature that I've implemented
  • Posts: 0
    by rockdude » Thu Oct 27, 2011 2:43 pm

    davidv wrote:
    rockdude wrote:
    Great, and more features....nice! I would love to see a way to add sfz knob controls in Arias effect section that you can control custom midi cc with so that it's possible to control whatever you want in the sfz code that has an opcode with a midi cc number attached to it.


    This is in fact a new feature that I've implemented

    YEEEEEEES!!!!!!!!!

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!