view dsp/synth/@sine/block.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents ae596261e75f
children
line wrap: on
line source
function [y,phi]=block(o,phi,n,f)
% block - generate block of sine wave samples
%
% sine/block :: 
%    sine      ~'sine generator object',
%    real      ~'phase at start of block',
%    N:natural ~'number of samples to generate',
%    real      ~'frequence in cycles per sample'
% -> [[1,N]]   ~'block of output samples',
%    real      ~'phase at end of block'.

w=2*pi*f;
y=sin(2*pi*phi + w*(0:n-1));
phi=mod(phi+f*n,1);