<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vDSP/formStereoRamp(withInitialValue:multiplyingBy:_:increment:results:_:)-9be28",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate4vDSPO14formStereoRamp16withInitialValue13multiplyingBy_9increment7results_ySfz_xxSfq_zq_ztAA0A6BufferRzAA0a7MutableM0R_Sf7ElementRtzSfAKRt_r0_lFZ"
  },
  "title" : "formStereoRamp(withInitialValue:multiplyingBy:_:increment:results:_:)"
}
-->

# formStereoRamp(withInitialValue:multiplyingBy:_:increment:results:_:)

Populates two single-precision vectors that contain stereo monotonically incrementing or decrementing values multiplied by two source vectors.

```
static func formStereoRamp<U, V>(withInitialValue initialValue: inout Float, multiplyingBy multiplierOne: U, _ multiplierTwo: U, increment: Float, results resultOne: inout V, _ resultTwo: inout V) where U : AccelerateBuffer, V : AccelerateMutableBuffer, U.Element == Float, V.Element == Float
```

## Parameters

`initialValue`

The initial value of the ramp.

`multiplierOne`

The first input vector that’s multiplied by the ramp function.

`multiplierTwo`

The second input vector that’s multiplied by the ramp function.

`increment`

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

`resultOne`

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

`resultTwo`

The array to overwrite with the first generated ramp.

## Discussion

Use this function to populate two vectors by multiplying the values in two input vectors with the corresponding values of a ramp.

For example, the following code fills the arrays `multiplierOne` and `multiplierTwo` with sine values:

```swift
let n = vDSP_Length(1024)

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

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

The following figure illustrates the values of `multiplierOne`, as a solid line, and `multiplierTwo`, as a dashed line:

![A graphic shows two sine waves. The first sine wave appears as a solid line and the second sine wave appears as a dashed line. The first sine wave has a higher freqency and a higher amplitude than the second sine wave. ](images/com.apple.accelerate/media-3732289@2x.png)

Pass `multiplierOne` and `multiplierTwo` as the `multiplyingBy` parameter of [`formStereoRamp(withInitialValue:multiplyingBy:_:increment:results:_:)`](/documentation/Accelerate/vDSP/formStereoRamp(withInitialValue:multiplyingBy:_:increment:results:_:)-9be28):

```swift
var start: Float = 0
let step: Float = 0.1

var resultOne = [Float](repeating: 0,
                count: Int(n))
var resultTwo = [Float](repeating: 0,
                count: Int(n))

vDSP.formStereoRamp(withInitialValue: &start,
                    multiplyingBy: multiplierOne, multiplierTwo,
                    increment: step,
                    results: &resultOne, &resultTwo)
```

On return, the output vectors, `results.firstOutput` and `results.secondOutput`, contain ramped-sine waves. The figure below shows the first output as a solid line and the second output as a dashed line:

![A graphic shows two sine waves. The first sine wave appears as a solid line and the second sine wave appears as a dashed line. The first sine wave and has a higher freqency and a higher amplitude than the second sine wave.  Both sine waves are tapered, that is, they begin on the left with a very low amplitude and their amplitudes ramp up towards the right of the image.](images/com.apple.accelerate/media-3732291@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)