Possible to #define a range of values?

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

Moderators: eric_telemaque, davidv

ricforduk
Posts: 5
Joined: Mon Jun 12, 2017 10:11 am

Possible to #define a range of values?

Postby ricforduk » Tue Jun 13, 2017 3:32 am

First, I am a newcomer here with little programming knowledge so very grateful for your patience.

I am using smdrums. I should like to be able to define, for example, a range of keyboard keys to the kick drum rather than just a single key.

So, in my kick_bus.sfz file I currently have:

#define $KICKKEY 36

Which I believe makes the kick drum sound when middle c is pressed.

I imagine it may be possible to do something like:

#define $KICKKEY { 36, 37, 38 ... }

to nake three or more keys available for the kick drum but cannot find suitable syntax.

Is there a simple approach to make this sort of thing possible please?

Best wishes,
Richard

pljones
Posts: 100
Joined: Wed Oct 15, 2014 2:05 pm

Re: Possible to #define a range of values?

Postby pljones » Tue Jun 13, 2017 12:34 pm

#define defines a name (a string of characters) for a string of characters. Nothing more than that.

To have separate notes trigger the same sample, you can just do this:

Code: Select all

<group> sample=kick.wav
<region> key=10
<region> key=20

or whatever you need. The common stuff in the group, the key-specific stuff in the regions.

ricforduk
Posts: 5
Joined: Mon Jun 12, 2017 10:11 am

Re: Possible to #define a range of values?

Postby ricforduk » Tue Jun 13, 2017 2:12 pm

Thanks, that's kind of you, I'll try it out..

eric_telemaque
Posts: 215
Joined: Tue Jan 31, 2012 1:10 pm

Re: Possible to #define a range of values?

Postby eric_telemaque » Wed Jun 14, 2017 9:44 am

pljones wrote:#define defines a name (a string of characters) for a string of characters. Nothing more than that.

To have separate notes trigger the same sample, you can just do this:

Code: Select all

<group> sample=kick.wav
<region> key=10
<region> key=20

or whatever you need. The common stuff in the group, the key-specific stuff in the regions.


I'm afraid that this won't work in SM Drums
The $KICKKEY macro is associated to the opcode "key=" in the kick drum sfz mapping, hence only one key, not a range of keys...
Éric Patenaude,
Plogue Art et Technologie Inc. Montreal.
http://www.plogue.com

ricforduk
Posts: 5
Joined: Mon Jun 12, 2017 10:11 am

Re: Possible to #define a range of values?

Postby ricforduk » Thu Jun 15, 2017 1:02 am

Thnka you Eric That sounds as if there may be no easy wasy.

eric_telemaque
Posts: 215
Joined: Tue Jan 31, 2012 1:10 pm

Re: Possible to #define a range of values?

Postby eric_telemaque » Thu Jun 15, 2017 9:11 am

ricforduk wrote:Thnka you Eric That sounds as if there may be no easy wasy.

Maybe, but I just found the hard way! :lol:

Bear with me

In your SM Drums folder, go to Programs/mappings

Duplicate smdrums_sfz_kick.sfz and name it smdrums_sfz_kick2.sfz

In the original smdrums_sfz_kick.sfz, replace all the instances of key=$KICKKEY with key=$KICKKEY1 (8 total)

In smdrums_sfz_kick2.sfz, replace all the instances of key=$KICKKEY with key=$KICKKEY2 (8 total)


Open Programs/Kick_bus.sfz
replace #define $KICKKEY 36
with
#define $KICKKEY1 36
#define $KICKKEY2 35


Then add #include "mappings/smdrums_sfz_kick2.sfz" at the bottom under the <global> tag.

Make the same modification to SM_Drums_kit.sfz if you want the same key range for the full kit.

Presto! it's now assigned to B (MIDI note 35) and C (MIDI note 36)
If you want it assigned to more or to different keys, you can take it from there.
Éric Patenaude,
Plogue Art et Technologie Inc. Montreal.
http://www.plogue.com

pljones
Posts: 100
Joined: Wed Oct 15, 2014 2:05 pm

Re: Possible to #define a range of values?

Postby pljones » Thu Jun 15, 2017 12:12 pm

You can make it slightly "easier" by making it significantly harder, of course... If I remember correctly how the expansion works, too..!

Make "n" wrapper files, smdrums_sfz_kick1.sfz to smdrums_sfz_kickn.sfz. In the wrapper, set $KICKKEY to be the value you want and then #include the smdrums_sfz_kick.sfz file. Then, back where smdrums_sfz_kick.sfz was originally included, #include all "n" of the new files instead.

ricforduk
Posts: 5
Joined: Mon Jun 12, 2017 10:11 am

Re: Possible to #define a range of values?

Postby ricforduk » Thu Jun 15, 2017 9:47 pm

My goodness, quite a lot to try. I thank you both for your help. i shall let you know how it goes in due course...
Many good wishes,
Richard

ricforduk
Posts: 5
Joined: Mon Jun 12, 2017 10:11 am

Re: Possible to #define a range of values?

Postby ricforduk » Thu Jun 22, 2017 8:06 am

These suggestions have worked marvellously and I am now able to play the very fast triplets and other complex drum figures that I was hoping to achieve. My thanks again to all of you for your time.
Very best wishes,
Richard


Return to “SFZ Programming”

Who is online

Users browsing this forum: No registered users and 2 guests