TravisWhitaker / libPOLY

A Musical Instrument for Computers
MIT License
13 stars 7 forks source link

Generated wave forms don't look right #5

Closed rossdylan closed 10 years ago

rossdylan commented 10 years ago

screenshot from 2014-04-29 19 15 45

rossdylan commented 10 years ago

generated using my libpoly rust bindings. Functions match the C API exactly.

extern crate poly;

use std::io::timer::sleep;
use poly::Poly;

fn main() {
    let mut poly = Poly::new(16, 2, 44100, 1, "test.wav");
    poly.init_generator(0, poly::poly_square, 1.0, 220 as f64);
    poly.start();
    sleep(1000);
    poly.set_wavetype(0, poly::poly_sine);
    sleep(1000);
    poly.stop();
}
Mikejmoffitt commented 10 years ago

This looks as though it is rolling over at peak. Try an amplitude slightly less than 1.0 and see if the results reoccur.

TravisWhitaker commented 10 years ago

Yep, I'm considering internally multiplying all frames by 0.999... transparently, as API callers will probably assume an amplitude of '1.0' is A-OK.

rossdylan commented 10 years ago

yep that was the problem.

TravisWhitaker commented 10 years ago

I just bumped down POLY_AMP_MAX, should do the trick.