Round robin question

Discussion on the SFZ implementation and opcodes available in the ARIA engine.

Moderators: eric_telemaque, davidv

rockdude
Posts: 21
Joined: Thu Apr 21, 2011 9:12 am

Round robin question

Postby rockdude » Fri Apr 29, 2011 5:28 pm

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:

Code: Select all

// 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?:

Code: Select all

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

davidv
Site Admin
Posts: 1567
Joined: Tue Mar 02, 2004 7:23 pm
Contact:

Re: Round robin question

Postby davidv » Mon May 02, 2011 9:14 am

<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>?
David Viens,
Plogue Art et Technologie Inc. Montreal.
http://www.plogue.com

rockdude
Posts: 21
Joined: Thu Apr 21, 2011 9:12 am

Re: Round robin question

Postby rockdude » Tue May 03, 2011 4:40 am

davidv wrote:<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 :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?

davidv
Site Admin
Posts: 1567
Joined: Tue Mar 02, 2004 7:23 pm
Contact:

Re: Round robin question

Postby davidv » Tue May 03, 2011 8:27 am

rockdude wrote: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.
David Viens,

Plogue Art et Technologie Inc. Montreal.

http://www.plogue.com

rockdude
Posts: 21
Joined: Thu Apr 21, 2011 9:12 am

Re: Round robin question

Postby rockdude » Tue May 03, 2011 9:02 am

davidv wrote:
rockdude wrote: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.

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)

davidv
Site Admin
Posts: 1567
Joined: Tue Mar 02, 2004 7:23 pm
Contact:

Re: Round robin question

Postby davidv » Tue May 03, 2011 9:58 am

rockdude wrote: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 wrote:(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?
David Viens,

Plogue Art et Technologie Inc. Montreal.

http://www.plogue.com

davidv
Site Admin
Posts: 1567
Joined: Tue Mar 02, 2004 7:23 pm
Contact:

Re: Round robin question

Postby davidv » Tue May 03, 2011 10:06 am

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


Code: Select all

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

// Snare Top
<group> key=38 pan=-100
<region> sample=*saw  seq_length=2 seq_position=1 tune=0    lorand=0   hirand=0.2
<region> sample=*sine seq_length=2 seq_position=2 tune=0    lorand=0   hirand=0.2
<region> sample=*saw  seq_length=2 seq_position=1 tune=50   lorand=0.2 hirand=0.4
<region> sample=*sine seq_length=2 seq_position=2 tune=50   lorand=0.2 hirand=0.4
<region> sample=*saw  seq_length=2 seq_position=1 tune=-50  lorand=0.4 hirand=0.6
<region> sample=*sine seq_length=2 seq_position=2 tune=-50  lorand=0.4 hirand=0.6
<region> sample=*saw  seq_length=2 seq_position=1 tune=100  lorand=0.6 hirand=0.8
<region> sample=*sine seq_length=2 seq_position=2 tune=100  lorand=0.6 hirand=0.8
<region> sample=*saw  seq_length=2 seq_position=1 tune=-100 lorand=0.8 hirand=1
<region> sample=*sine seq_length=2 seq_position=2 tune=-100 lorand=0.8 hirand=1

// Snare Bottom
<group> key=38 pan=100
<region> sample=*saw  seq_length=2 seq_position=1 tune=0    lorand=0   hirand=0.2
<region> sample=*sine seq_length=2 seq_position=2 tune=0    lorand=0   hirand=0.2
<region> sample=*saw  seq_length=2 seq_position=1 tune=50   lorand=0.2 hirand=0.4
<region> sample=*sine seq_length=2 seq_position=2 tune=50   lorand=0.2 hirand=0.4
<region> sample=*saw  seq_length=2 seq_position=1 tune=-50  lorand=0.4 hirand=0.6
<region> sample=*sine seq_length=2 seq_position=2 tune=-50  lorand=0.4 hirand=0.6
<region> sample=*saw  seq_length=2 seq_position=1 tune=100  lorand=0.6 hirand=0.8
<region> sample=*sine seq_length=2 seq_position=2 tune=100  lorand=0.6 hirand=0.8
<region> sample=*saw  seq_length=2 seq_position=1 tune=-100 lorand=0.8 hirand=1
<region> sample=*sine seq_length=2 seq_position=2 tune=-100 lorand=0.8 hirand=1
David Viens,

Plogue Art et Technologie Inc. Montreal.

http://www.plogue.com

rockdude
Posts: 21
Joined: Thu Apr 21, 2011 9:12 am

Re: Round robin question

Postby rockdude » Tue May 03, 2011 2:44 pm

davidv wrote: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 wrote:Thats pretty good, i hope its the second edition though :)

It's the second edition.

davidv wrote: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 wrote: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.

davidv
Site Admin
Posts: 1567
Joined: Tue Mar 02, 2004 7:23 pm
Contact:

Re: Round robin question

Postby davidv » Wed May 04, 2011 9:07 am

rockdude wrote: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 wrote: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)
David Viens,

Plogue Art et Technologie Inc. Montreal.

http://www.plogue.com

rockdude
Posts: 21
Joined: Thu Apr 21, 2011 9:12 am

Re: Round robin question

Postby rockdude » Fri May 06, 2011 4:00 am

davidv wrote: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?

davidv
Site Admin
Posts: 1567
Joined: Tue Mar 02, 2004 7:23 pm
Contact:

Re: Round robin question

Postby davidv » Fri May 06, 2011 8:09 am

rockdude wrote: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.
David Viens,

Plogue Art et Technologie Inc. Montreal.

http://www.plogue.com

rockdude
Posts: 21
Joined: Thu Apr 21, 2011 9:12 am

Re: Round robin question

Postby rockdude » Sat May 07, 2011 5:51 am

davidv wrote:
rockdude wrote: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.

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

davidv
Site Admin
Posts: 1567
Joined: Tue Mar 02, 2004 7:23 pm
Contact:

Re: Round robin question

Postby davidv » Sat May 07, 2011 9:04 am

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 :)
David Viens,

Plogue Art et Technologie Inc. Montreal.

http://www.plogue.com

rockdude
Posts: 21
Joined: Thu Apr 21, 2011 9:12 am

Re: Round robin question

Postby rockdude » Sun May 08, 2011 4:45 pm

davidv wrote: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....

rockdude
Posts: 21
Joined: Thu Apr 21, 2011 9:12 am

Re: Round robin question

Postby rockdude » Wed Oct 26, 2011 2:35 pm

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


Return to “SFZ Programming”

Who is online

Users browsing this forum: No registered users and 1 guest