cwbe coordinatez:
101
792011
1366411
5176767

ABSOLUT
KYBERIA
permissions
you: r,
system: public
net: yes

neurons

stats|by_visit|by_K
source
tiamat
commanders
polls

total descendants::0
total children::0
2 ❤️


show[ 2 | 3] flat


Vratko Pol: algoritmicky stlacitelna hudba



#include <iostream>
#include <fstream>
#include <cmath>

using namespace std;

class C
{
private:
ofstream f;
public:
void p(unsigned long int i){f.write(((char*)&i),sizeof(unsigned long int));}
void s(signed short int i){f.write(((char*)&i),sizeof(signed short int));}
C(){f.open("my.wav", ofstream::binary|ofstream::trunc);}
~C(){f.close();}
};

int main()
{
float pi=acos(-1);
unsigned long int N=75000;//samplerate
unsigned long int M=2559;//#chunks
unsigned long int S=(M 1)/14;//seconds
float bs=2*pi/((N*S/M));//circular frequency for chunktime in sampletimes
float k=4*bs;//73Hz?

C c;
c.p(0x46464952);//"RIFF"
c.p(N*2*S 36);//Ss 32d 74898r 36
c.p(0x45564157);//"WAVE"
c.p(0x20746D66);//fmtn
c.p(16);//format size
c.p(0x00010001);//chunk,mono
c.p(N);//samplerate
c.p(N*2);//byterate
c.p(0x00100002);//16 bits per sample
c.p(0x61746164);//"data"
c.p(N*2*S);//Ss 32d 74898r

// float h=2*pi/N;//1Hz
long int i=0,j=0,jj=0;
#define B(x,y) (((float)0x1000)/x*(sin(x*y*k*i)))
for(i=0;i<(N*S-((N*S)/M)*M);i )c.s(0);//align
signed long int v2,v3,v5,v7,v11;
float w;
for(j=0;j<M;j )
{
v2=0;v3=v5=v7=v11=-1;
jj=M-j 0;
while(jj%2==0)jj/=2,v2 =1;
jj ;while(jj%2==0)jj/=2,v3 =1;
jj ;while(jj%2==0)jj/=2,v5 =1;
jj ;while(jj%2==0)jj/=2,v7 =1;
jj ;while(jj%2==0)jj/=2,v11 =1;

cout<<v2<<v3<<v5<<v7<<v11<<endl;

for(long int i=0; i<((N*S)/M); i )
{
w=0;
for(jj=0;jj<v2;jj )w =B(2,jj)/(v2-jj 1);
if(j>=M/5)for(jj=0;jj<v3;jj )w =B(3,jj)/(v3-jj 1);
if(j>=M/5*2)for(jj=0;jj<v5;jj )w =B(5,jj)/(v5-jj 1);
if(j>=M/5*3)for(jj=0;jj<v7;jj )w =B(7,jj)/(v7-jj 1);
if(j>=M/5*4)for(jj=0;jj<v11;jj )w =B(11,jj)/(v11-jj 1);
c.s((signed short int)w);
}
}
return 0;

(original post)