refactor parameterstore
This commit is contained in:
Binary file not shown.
@@ -58,6 +58,8 @@ Write-Host "Building metabolus..."
|
||||
cmake --build $BUILD_DIR --config $CONFIG
|
||||
|
||||
# TODO: install
|
||||
cd $BUILD_DIR
|
||||
cmake --install . --prefix ".\"
|
||||
|
||||
# link dlls
|
||||
Write-Host "Deploying metabolus..."
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
|
||||
import math
|
||||
|
||||
from generate_wavetable import generateWavetable
|
||||
|
||||
WAVETABLE_FILE_NAME = "sharkFin"
|
||||
|
||||
# process expects a waveform from x=[0, 2pi) centered around f(x)=0
|
||||
# normalization is handled by the wavetableGenerator
|
||||
|
||||
def sine(phase):
|
||||
return math.sin(phase)
|
||||
|
||||
@@ -36,8 +41,9 @@ def sharkFin(phase):
|
||||
def sphere(phase):
|
||||
return 1
|
||||
|
||||
# process get called by generate_wavetable.py
|
||||
# it calculates a single sample at a specified phase
|
||||
# normalization is handled by generate_wavetable.py
|
||||
def process(phase):
|
||||
return sharkFin(phase)
|
||||
# pass in the name of your wavtable file and the process function
|
||||
def main():
|
||||
generateWavetable(WAVETABLE_FILE_NAME, process)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -12,16 +12,15 @@
|
||||
|
||||
# this script uses the function defined in example_wavetable.py to calculate samples
|
||||
# if you want a custom wavetable, copy/edit/modify the example function (desmos is great for brainstorming)
|
||||
# import this script and call generateWavetable(processFunction) to generate a custom wavetable
|
||||
|
||||
from array import array
|
||||
import math
|
||||
|
||||
import example_wavetable
|
||||
|
||||
wavetableLength = 2048
|
||||
|
||||
def createFile():
|
||||
filename = example_wavetable.WAVETABLE_FILE_NAME + ".wt"
|
||||
def createFile(name):
|
||||
filename = name + ".wt"
|
||||
print("creating file " + filename)
|
||||
file = open(filename, "wb")
|
||||
return file
|
||||
@@ -29,7 +28,7 @@ def createFile():
|
||||
def writeMetadata(file):
|
||||
print(">> im writing metadata")
|
||||
|
||||
def generateWavetable(file):
|
||||
def writeData(file, processFunction):
|
||||
print(">> im generating the wavetable")
|
||||
|
||||
# init variables
|
||||
@@ -40,7 +39,7 @@ def generateWavetable(file):
|
||||
|
||||
# generate each discrete sample
|
||||
for i in range(wavetableLength):
|
||||
sample = example_wavetable.process(x)
|
||||
sample = processFunction(x)
|
||||
accumulator += sample * sample
|
||||
x += phaseInc
|
||||
data_list[i] = sample
|
||||
@@ -59,14 +58,11 @@ def closeFile(file):
|
||||
print(">> finishing up")
|
||||
file.close()
|
||||
|
||||
def main():
|
||||
def generateWavetable(name, processFunction):
|
||||
print("Hello main")
|
||||
file = createFile()
|
||||
file = createFile(name)
|
||||
writeMetadata(file)
|
||||
generateWavetable(file)
|
||||
writeData(file, processFunction)
|
||||
closeFile(file)
|
||||
print("done")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user