# Transpose number in one range into another range

**URL:** <https://forum.juce.com/t/transpose-number-in-one-range-into-another-range/14211>\
**Category:** General JUCE discussion\
**Created:** [January 26, 2015, 2:26pm UTC](https://forum.juce.com/t/transpose-number-in-one-range-into-another-range/14211 "2015-01-26T14:26:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ndika](https://avatars.discourse-cdn.com/v4/letter/n/c6cbf5/32.png) [@ndika](https://forum.juce.com/u/ndika)\
**Post date:** [January 26, 2015, 2:26pm UTC](https://forum.juce.com/t/transpose-number-in-one-range-into-another-range/14211/1 "2015-01-26T14:26:11Z")

</div>

hey folks

is there any class in Juce (or STL etc)&nbsp;for dealing with converting a number in one range to a number in another?

For example, maybe I have an incoming MIDI value which is between 0 - 127 and I want to transpose that value into another range (say 0 - 22,000).

I knocked together a simple function that does this, but now I need something more flexible (not linear), and figured I would ask before trying to reinvent the wheel :)

nick

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [January 26, 2015, 4:26pm UTC](https://forum.juce.com/t/transpose-number-in-one-range-into-another-range/14211/2 "2015-01-26T16:26:14Z")

</div>

There's&nbsp;NormalisableRange, and also the&nbsp;jmap function?

---

<div class="post-metadata">

**Author:** ![ndika](https://avatars.discourse-cdn.com/v4/letter/n/c6cbf5/32.png) [@ndika](https://forum.juce.com/u/ndika)\
**Post date:** [January 27, 2015, 6:50am UTC](https://forum.juce.com/t/transpose-number-in-one-range-into-another-range/14211/3 "2015-01-27T06:50:00Z")

</div>

ah yes thanks!&nbsp;thought I'd seen something like that but couldn't find it ... probably because i was typing "normaliZe" into the search box :D
