lordmauve / wasabi2d

Cutting-edge 2D game framework for Python
https://wasabi2d.readthedocs.io/
GNU Lesser General Public License v3.0
154 stars 24 forks source link

Tone generation #57

Closed stemvork closed 3 years ago

stemvork commented 4 years ago

Running

import wasabi2d as w
from wasabi2d import tone

scene = w.Scene()
scene.background = 0.1, 0.2, 0.4
scene.center = scene.width/2, scene.height/2

pitch = tone.create('A3', 0.5)
pitch.play()

w.run()

yields

Traceback (most recent call last):
  File "main.py", line 8, in <module>
    pitch = tone.create('A3', 0.5)
  File "/usr/local/lib/python3.8/site-packages/wasabi2d/tone.py", line 144, in create
    return _create(params)
  File "/usr/local/lib/python3.8/site-packages/wasabi2d/tone.py", line 154, in _create
    cycle = sample_gen[params.waveform](params.hz)
  File "/usr/local/lib/python3.8/site-packages/wasabi2d/tone.py", line 97, in sine_array_onecycle
    xvalues = np.linspace(0, np.pi * 2, length)
  File "<__array_function__ internals>", line 5, in linspace
  File "/usr/local/lib/python3.8/site-packages/numpy/core/function_base.py", line 113, in linspace
    num = operator.index(num)
TypeError: 'float' object cannot be interpreted as an integer