Jump to content


Photo

Micropitch formula device


  • Please log in to reply
5 replies to this topic

#1 pat

pat

    Big Masta Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPip
  • 509 posts
  • Gender:Male

Posted 29 January 2018 - 21:31

The Micropitch formula device gives you precise control over a sample-based instrument's tuning, in semitones and cents. It allows you to pitch sounds up and down without the bending sound of the Uxx and Dxx commands.

 
It requires a bit of setup:
 
* Create a modulation set, and add an Operand as a pitch modulator
* Set an instrument macro to automate the Operand pitch value
* Add an instrument automation device, and set the Micropitch formula device's output to the pitch macro
* If you change the modulation pitch range from its default of 12 semitones, you'll need to update the formula's pitchRange() function to match it
 
Now you have precise, immediate control over the tuning. The micropitch device provides three controls:
 
* Semitones
* Cents
* Polarity
 
You can automate them using track effects commands. The formula device converts track effect values to semitone and cents offsets. For example (assuming the Micropitch device is the first in the list):
 
1104 1203 -- will tune the pitch modulator +4 semitones +3 cents
Any non-zero value for polarity makes it negative:
 
1104 1203 1310 -- will tune the pitch modulator -4 semitones -3 cents

note: I just worked out the numbers by trial and error :)  They seem to work just fine... but maybe someone better at math than me can figure out better numbers if needed.

 

Example project: Attached File  micropitch-example.xrns   147.83KB   21 downloads

 

The formula device code:

<?xml version="1.0" encoding="UTF-8"?><FilterDeviceClipboard doc_version="0">
  <DeviceSlot type="FormulaMetaDevice">
    <CustomDeviceName>Micropitch</CustomDeviceName>
    <IsMaximized>true</IsMaximized>
    <IsSelected>true</IsSelected>
    <SelectedPresetName>Micropitch</SelectedPresetName>
    <SelectedPresetLibrary>User Library</SelectedPresetLibrary>
    <SelectedPresetIsModified>false</SelectedPresetIsModified>
    <IsActive>
      <Value>1.0</Value>
      <Visualization>Device only</Visualization>
    </IsActive>
    <FormulaParagraphs>
      <FormulaParagraph>calculatePitch(A, B, C)</FormulaParagraph>
    </FormulaParagraphs>
    <FunctionsParagraphs>
      <FunctionsParagraph>function pitchRange()</FunctionsParagraph>
      <FunctionsParagraph>  return 12</FunctionsParagraph>
      <FunctionsParagraph>end</FunctionsParagraph>
      <FunctionsParagraph/>
      <FunctionsParagraph>function calculatePitch(semitones, cents, negative)</FunctionsParagraph>
      <FunctionsParagraph>  local offset = 0.5</FunctionsParagraph>
      <FunctionsParagraph>  local semiOffset = 0</FunctionsParagraph>
      <FunctionsParagraph>  local centsOffset = 0</FunctionsParagraph>
      <FunctionsParagraph>  local polarity = 1</FunctionsParagraph>
      <FunctionsParagraph>  </FunctionsParagraph>
      <FunctionsParagraph>  if semitones &gt; 0 then</FunctionsParagraph>
      <FunctionsParagraph>    semiOffset = semitones * (10.625 / (pitchRange() / 12))</FunctionsParagraph>
      <FunctionsParagraph>  end</FunctionsParagraph>
      <FunctionsParagraph>  </FunctionsParagraph>
      <FunctionsParagraph>  if cents &gt; 0 then</FunctionsParagraph>
      <FunctionsParagraph>    centsOffset = cents / (9.375 * (pitchRange() / 12))</FunctionsParagraph>
      <FunctionsParagraph>  end</FunctionsParagraph>
      <FunctionsParagraph>  </FunctionsParagraph>
      <FunctionsParagraph>  if negative &gt; 0 then</FunctionsParagraph>
      <FunctionsParagraph>    polarity = -1</FunctionsParagraph>
      <FunctionsParagraph>  end</FunctionsParagraph>
      <FunctionsParagraph>  </FunctionsParagraph>
      <FunctionsParagraph>  return offset + polarity * (semiOffset + centsOffset)</FunctionsParagraph>
      <FunctionsParagraph>end</FunctionsParagraph>
    </FunctionsParagraphs>
    <InputNameA>Semitones</InputNameA>
    <InputNameB>Cents</InputNameB>
    <InputNameC>Negative</InputNameC>
    <EditorVisible>true</EditorVisible>
    <InputA>
      <Value>0.0</Value>
      <Visualization>Device only</Visualization>
    </InputA>
    <InputB>
      <Value>0.0</Value>
      <Visualization>Device only</Visualization>
    </InputB>
    <InputC>
      <Value>0.0</Value>
      <Visualization>Device only</Visualization>
    </InputC>
    <DestTrack>
      <Value>1.0</Value>
      <Visualization>Device only</Visualization>
    </DestTrack>
    <DestEffect>
      <Value>1.0</Value>
      <Visualization>Device only</Visualization>
    </DestEffect>
    <DestParameter>
      <Value>1.0</Value>
      <Visualization>Device only</Visualization>
    </DestParameter>
  </DeviceSlot>
</FilterDeviceClipboard>

(btw how do you do a "spoiler" so it doesn't show the whole thing?)

SaveSave

SaveSave


Edited by pat, 29 January 2018 - 21:45.

  • El°HYM likes this

#2 El°HYM

El°HYM

    Big Super GrandMasta Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 761 posts
  • Gender:Male
  • Location:NIBIRU
  • Interests:I AM El°HYM

Posted 29 January 2018 - 23:12

Can Me Tune My Samples to 432Hz with this?


Inside ur Renoise; helping Byte-Smasher putting Cab Sims on ur Master.  :ph34r: 


#3 pat

pat

    Big Masta Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPip
  • 509 posts
  • Gender:Male

Posted 29 January 2018 - 23:49

If you mean can you set a global tuning so A4=432hz then no that’s not what this does.

I can probably explain it more simply...

This gives you a way of pitching samples up or down by semitones and cents using track FX commands. It differs from the Uxx and Dxx commands in two ways:

1. It lets you specify tuning offset in cents
2. The tuning is applied directly to the sample, so there’s no pitch bend effect
  • El°HYM likes this

#4 Zer0 Fly

Zer0 Fly

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1213 posts
  • Gender:Male
  • Location:Oops
  • Interests:Flying

Posted 30 January 2018 - 16:59

interesting idea, to sequence microtonal notes via note + pattern command offset this way. might want to look at the calculations tonight, I've some experience with such stuff. any other suggestions the device should be capable of?

 

 

Can Me Tune My Samples to 432Hz with this?

 

 

Let's try something...I have made a lua function for tuning things. Let's find tuning for 432Hz and reverse it.

>>> print (freqtonote(432))
A-4 - 31.766653633429c / - 40.343650114455Rc

you can tune your instruments to 432 hz by using tuning or a static offset in the pitch modulation. you need to sub to all notes 31.766653633429 cents, or using the renoise sample tuning which is base 128 cents/semitone: 40.343650114455 rcents. So an operator in pitch modulation with range 12 semitones would need to substract a value of 0.31766653633429 / 12 = 0.026472211 from center position.

 

Short: place operand substracting a value of 0.026472211 into your pitch modulation if it is set to standard 12 semitones, and you instrument will be tuned to a-4=432Hz equal temperament if it had been tuned to 440Hz before.


Edited by OopsIFly, 30 January 2018 - 17:00.

  • El°HYM likes this

#5 pat

pat

    Big Masta Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPip
  • 509 posts
  • Gender:Male

Posted 31 January 2018 - 01:40

interesting idea, to sequence microtonal notes via note + pattern command offset this way. might want to look at the calculations tonight, I've some experience with such stuff. any other suggestions the device should be capable of?

 

 

 

Well... I would like a simpler interface if possible. Right now it's a modulation set + modulation device + macro + inst automation device, with three parameters. If there's some way to condense it, that would be awesome.

 

I've thought about condensing the cents modulation into a single effect so that anything above 50 is negative, but then I'd be getting into hex math territory that I don't feel like doing :)

Frankly if Uxx / Dxx had a mode that didn't produce the bend at the start then I wouldn't care about any of this :) So the closer I can get to Uxx / Dxx without the bend, the better.



#6 Zer0 Fly

Zer0 Fly

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1213 posts
  • Gender:Male
  • Location:Oops
  • Interests:Flying

Posted 31 January 2018 - 03:27

Hm, a simpler interface is not easy to do, other than making a tool that will setup the stuff for you automatically.

 

Also you are hopefully aware that your thing (and mine below also) are monophonic without cure? If you change the pitch modulation with operands, it will affect all currently playing notes of that set, not just the succeding ones.

 

And I still not get your coefficients. You must have understood something wrong about your design? The pitch operand/macro thing will map things as linear as cents would be mapped, the calculations thus are linear and rather straightforward.

 

I had some fun with your thing, and quasi recoded it. You know, I sometimes like a little mental excercise, so I am afraid the code is not so easy to understand as yours. Hehe branchless MBWAHAHAa!!1!!11

 

I made the range of cents definable (how many cents per semitone) as well as the operand range. As a gimmik, I seperated the negative flag to semitones and cents each, so you can for example transpose up by 2 semitones as well as down by 15 cents. The formula device macro must be programmed like:

pattern command:
12xx
both controls positive, both digits zero, slider is 0.0%:
1200
Negate semitones set first digit nonzero:
1210
Negate cents, second digit nonzero:
1202
Negate both:
1248


Otherwise like in your example, both other sliders are geared to take the number of semitones or "cents" (however many you choose to make a semitone) from pattern comands, not from automation or fiddling with the sliders! The results should be pretty exact tuning. I haven't tested it the whole lot, though...at least what I quickly tested while writing the code seemed at some point to work as expected...

 

Here goes the preset:

 

Spoiler