<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.6.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vDSP_vrampmuladd2",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@F@vDSP_vrampmuladd2"
  },
  "title" : "vDSP_vrampmuladd2"
}
-->

# vDSP_vrampmuladd2

Multiplies a single-precision, stereo input vector by a value that ramps up on successive calls, and cumulatively adds the result to the output vector.

```
void vDSP_vrampmuladd2(const float *__I0, const float *__I1, vDSP_Stride __IS, float *__Start, const float *__Step, float *__O0, float *__O1, vDSP_Stride __OS, vDSP_Length __N);
```

## Parameters

`__I0`

The first input vector, multiplied by the ramp function.

`__I1`

The second input vector, multiplied by the ramp function.

`__IS`

The stride for both input vectors.

`__Start`

On input, the initial value of the ramp. On output, the next value in the ramp.

`__Step`

The increment, or decrement if negative, between each generated element.

`__O0`

The first output vector.

`__O1`

The second output vector.

`__OS`

The stride for both output vectors.

`__N`

The number of elements that the function processes.

## Discussion

The functions in this group are similar to [`vDSP_vrampmul`](/documentation/Accelerate/vDSP_vrampmul), but rather than overwriting the output vector, they add the results to the existing values in the output vector. The following code describes the calculation:

```c
for (i = 0; i < N; ++i) {
    O[i*OS] += *Start * I[i*IS];
    *Start += *Step;
}
```

For example, the following code fills the array `i` with sine values:

```swift
let n = vDSP_Length(1024)

let i: [Float] = (0 ..< n).map {
    return sin(Float($0) / 20)
}
```

The following illustrates the values of `i`:

![Visualization of a sine wave.](images/com.apple.accelerate/media-3239805@2x.png)

The following code fills the output array, o, with increasing powers of two:

```swift
var o = (0 ..< n).map {
    return pow(Float($0), 2) * 0.0001
}
```

The following illustrates the values of `o`:

![Visualization of the exponential curve.](images/com.apple.accelerate/media-3239864@2x.png)

Pass `i` as the input vector, and `o` as the output vector to [`vDSP_vrampmuladd`](/documentation/Accelerate/vDSP_vrampmuladd)…

```swift
let stride = vDSP_Stride(1)

var start: Float = 0
var step: Float = 0.1

vDSP_vrampmuladd(i,
                 stride,
                 &start,
                 &step,
                 &o,
                 stride,
                 n)
```

On return, the output vector, `o`, is overwritten with a ramped-sine wave, based on its original exponential curve:

![Visualization of the generated vector.](images/com.apple.accelerate/media-3239836@2x.png)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)