instead of the arrays amplitude and duration being static, I want to give their length in the argument of the function then create them inside
If the arrays are local to the function then there's nothing stopping you from declaring them as local automatic variables - as long as you have enough memory available for the stack. The size can be dynamic in the sense that it is determined within the function at runtime but is fixed in the sense that within a given execution of the function, once the variable has been declared the size is fixed.
If the arrays are persistent or global then you could allocate them from the heap and store the address in your static or global variable (wherever you would have declared the array if it had been a fixed size) but I don't know enough about your project to know whether that's a sensible approach to take. If you take the approach you have to design your code to know whether the array has been allocated and what size it is.