annotate 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 |
|
rev |
line source |
samer@34
|
1 function [y,phi]=block(o,phi,n,f)
|
samer@42
|
2 % block - generate block of sine wave samples
|
samer@42
|
3 %
|
samer@42
|
4 % sine/block ::
|
samer@42
|
5 % sine ~'sine generator object',
|
samer@42
|
6 % real ~'phase at start of block',
|
samer@42
|
7 % N:natural ~'number of samples to generate',
|
samer@42
|
8 % real ~'frequence in cycles per sample'
|
samer@42
|
9 % -> [[1,N]] ~'block of output samples',
|
samer@42
|
10 % real ~'phase at end of block'.
|
samer@34
|
11
|
samer@34
|
12 w=2*pi*f;
|
samer@34
|
13 y=sin(2*pi*phi + w*(0:n-1));
|
samer@34
|
14 phi=mod(phi+f*n,1);
|
samer@34
|
15
|