开发者

Fading the start of a sound with Python

开发者 https://www.devze.com 2023-04-08 22:43 出处:网络
I\'m a student in a programming class and I just can\'t get this fading in开发者_如何学运维 to work... Right now it\'s just muting the first few samples of length fade_length... can anyone tell me why

I'm a student in a programming class and I just can't get this fading in开发者_如何学运维 to work... Right now it's just muting the first few samples of length fade_length... can anyone tell me why it does so so I can find out a way to fix it?

<code erased>

Help without direct answers would be great. Thank you


If you're using Python 2.x, try

factor = 1.0 * index / fade_length

An int divided by a larger int is 0. You have to coerce the operation to floating point division.

Edit:

You can also use from __future__ import division to make the division operator use true division like Python 3. Use '//' for floor division.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号