In the JUCE DSP Tutorial, different waveforms are created using a lamda function and the jmap function.

Can someone help me dig a little deeper to understand the relationship of the lamda function with jmap?

More importantly, how does the jmap function and its parameters help create the saw wave? Can someone walk me through that DSP concept/algorithm a little more than what the tutorial says?

Since we do not have access to a

`std`

version of a sawtooth function, we need to implement a manual mapping of values using the`jmap`

function. To do this, map the range between -Pi … Pi to -1 … 1 providing a linear ramp from -1 to 1. Since a sawtooth only has 2 breakpoints, we need only supply 2 discrete points to the lookup table.

```
processorChain.template get<oscIndex>().initialise ([] (Type x)
{
return juce::jmap (x,
Type (-juce::MathConstants<double>::pi),
Type (juce::MathConstants<double>::pi),
Type (-1),
Type (1));
}, 128);
break;
I notice similar jmaps used in the next tutorial for waveshapers...
Thanks
-Mike
```