Wednesday, June 27, 2007
frequency modulation converted from matlab to scilab
This is converted by hand from matlab to scilab. and I could probily do a awk or python script to search and replace a couple of things to make the conversion easier... Then you can take a second pass with scipad... looks like after that you are on your own looking up commands to see what they are...
The second part of this would be to read a text file to get frequency, duration, and give it a code so that the editor will know what it is (without knowing what it is but to treat it different from csound) I was also looking at rlab it appears there is an rlab+ that has music functions but only works on unix or linix or whatever.
sf = 22050; //% sample frequency (Hz)
d = 1.0; //% duration (s)
n = sf * d; //% number of samples
//% set carrier
cf = 1000; //% carrier frequency (Hz)
c = (1:n) / sf; //% carrier data preparation
c = 2 * %pi * cf * c;
//% set modulator
mf = 5; //% modulator frequency (Hz)
mi = 0.5; //% modulator index
m = (1:n) / sf; //% modulator data preparation
m = mi * cos(2 * %pi * mf * m); //% sinusoidal modulation
//% frequency modulation
s = sin(c + m); //% frequency modulation
//% sound presentation
sound(s, sf); //% sound presentation
//pause(d + 0.5); //% wating for sound end
The second part of this would be to read a text file to get frequency, duration, and give it a code so that the editor will know what it is (without knowing what it is but to treat it different from csound) I was also looking at rlab it appears there is an rlab+ that has music functions but only works on unix or linix or whatever.
sf = 22050; //% sample frequency (Hz)
d = 1.0; //% duration (s)
n = sf * d; //% number of samples
//% set carrier
cf = 1000; //% carrier frequency (Hz)
c = (1:n) / sf; //% carrier data preparation
c = 2 * %pi * cf * c;
//% set modulator
mf = 5; //% modulator frequency (Hz)
mi = 0.5; //% modulator index
m = (1:n) / sf; //% modulator data preparation
m = mi * cos(2 * %pi * mf * m); //% sinusoidal modulation
//% frequency modulation
s = sin(c + m); //% frequency modulation
//% sound presentation
sound(s, sf); //% sound presentation
//pause(d + 0.5); //% wating for sound end
Labels: frequency modulation, hacking, matlab, rlab, scilab
Tuesday, June 26, 2007
a couple of scilab music links
http://www.lumanmagnum.net/physics/physics_body.html
The example looks pretty easy to try out scilab and additive synth... I was doing well until I hit the envp and then either through my fault or the programs fault the envolope crashs it and gives me a cryptic error message... The cryptic part is the part that makes me complain... It apears at first glance that you can use files as text grids fairly easy.. hacks to treat files like csound files might not be that hard.. (you wouldn't be able to mix and match probily)
matlab files are supposed to be easy to convert to scilab but I haven't had a chance to test that. http://www.h6.dion.ne.jp/~fff/technique/auditory/matlab.html has a bunch of matlab examples that could be tried..
The example looks pretty easy to try out scilab and additive synth... I was doing well until I hit the envp and then either through my fault or the programs fault the envolope crashs it and gives me a cryptic error message... The cryptic part is the part that makes me complain... It apears at first glance that you can use files as text grids fairly easy.. hacks to treat files like csound files might not be that hard.. (you wouldn't be able to mix and match probily)
matlab files are supposed to be easy to convert to scilab but I haven't had a chance to test that. http://www.h6.dion.ne.jp/~fff/technique/auditory/matlab.html has a bunch of matlab examples that could be tried..