Skip to content

How to automate linearly or exponentially? #111

Answered by DBraun
samuelbraun04 asked this question in Q&A
Discussion options

You must be logged in to vote

There are many subjective ways to do this.

import numpy as np
num_samples = AudioSegment.from_wav(file).duration_seconds * SAMPLE_RATE

a = np.linspace(0, 1, num=num_samples, endpoint=True)
# now a starts at 0 and ends at 1

# choose a base, either e or another number greater than 1
base = np.e
# base = 2
b = np.power(base, a)
# now b starts at 1 and ends at base

# remap from [1,base] to [0, 1]
c = (b-1)/(base-1)

# remap from [0, 1] to [300, 20000]
freq = 300. + (20000-300.)*c

filter_processor.set_automation("freq", freq)

For linear, just set c = a before creating freq. Also experiment with matplotlib, wolfram alpha etc to your liking.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@samuelbraun04
Comment options

Answer selected by samuelbraun04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants