sample_duration path (string)
Given the name of a loaded sample, or a path to a .wav, .wave, .aif or .aiff file this returns the length of time in beats that the sample would play for. It’s useful when looping samples to make sure there are no gaps - see the examples. You may pass a rate opt which it will use to scale the returned time to match the duration at that rate. The time returned is scaled to the current bpm.
Introduced in v2.0
| rate: |
Rate modifier. For example, doubling the rate will halve the duration. |
| start: |
Start position of sample playback as a value from 0 to 1 |
| finish: |
Finish position of sample playback as a value from 0 to 1 |
| attack: |
Duration of the attack phase of the envelope. |
| decay: |
Duration of the decay phase of the envelope. |
| sustain: |
Duration of the sustain phase of the envelope. |
| release: |
Duration of the release phase of the envelope. |
| # Example 1 | |
|
|
|
| # Example 2 | |
|
|
|
| # Example 3 | |
|
|
|
| # Example 4 | |
|
|
|