OK. Here's a little source from my CB101:

;-----------------
mov ecx,0
mov ebx,offset Wave7
.while ecx<2048
mov shit2,ecx
fild shit2
mov shit2,2048
fidiv shit2
mov shit2,20000
fimul shit2
mov eax,ecx
fst real4 ptr
mov eax,4096
sub eax,ecx
fst real4 ptr
fchs
mov eax,4096
add eax,ecx
fst real4 ptr
mov eax,8192
sub eax,ecx
fstp real4 ptr
inc ecx
.endw
mov shit2,20000
fild shit2
mov ecx,2048
fstp real4 ptr
mov shit2,-20000
fild shit2
mov ecx,6144
fstp real4 ptr



;-------[ Sine wave ]---------
mov ecx,0
mov ebx,offset Wave5
fldpi
mov shit2,4096
fidiv shit2
.while ecx<8192
;out=20000 * sin(2*3.14/8192 * i)
mov shit2,ecx
fld ST(0)
fimul shit2
fsin
mov shit2,20000
fimul shit2
fstp real4 ptr
inc ecx
.endw
fstp shit2

;-------[ Saw wave ]-----------
mov ecx,0
mov ebx,offset Wave6
.while ecx<8192
mov eax,ecx
sub eax,4096
neg eax
shl eax,2
mov shit2,eax
fild shit2
fstp real4 ptr
inc ecx
.endw



These are very simple forumas to do the waves, and they lean on the lowpassfilter. I've included 3 types of saw in the CB101 (the third type is only at my comp), and noticed that they produce different harmonic stuff, so it's good to supply them all. The "Saw wave" above is the same shape of the saw in Reason's SubTractor.
Posted on 2002-10-08 21:18:05 by Ultrano
hi ultrano.

thx for the code. but i have allready a solution. i looked at the mini-fmod library and played with the params. looked at your code and i have a different - thing better solution because i dont need to unnecesarry memcpy...

what i do is i do the waveOutWrite only once, define the wav as endless-looping.
the main-thread checks the current position and i only need to calculate the time from the last position to the current-position-1. them the thread sleeps for about 20msecs.

btw. i tested dreamer and i really like it. but plse add more example-songs. maybe you could convert some reason songs to your format??

your asm code looks good except the shit variables...
that is what i do:

db 0x68 ;push dword 0.03
dd 0.03
pop eax ;to correct the stackpointer, note eax is destroyed.
fld dword ;read 0.03 into fpu stack
Posted on 2002-12-02 05:16:42 by peci
hi, Peci,

MME does not work well on _all_ computers. And it does not allow latency below 45ms, which is hell for music artists (that's why I jmp to DSound and 've forsaken MME). Your approach to using the wave loop is the ideal thing for your purpose- it can take total of below 100 bytes for creation, maintenance and deletion of sound.
I won't make more demo songs for DR 0.130. I am currently developing a better version, which has little in common with the one, published at my site. And Reason's songs cannot be imported, as the format is closed, and the instruments cannot output MIDI, which I can record. But there's a way around- DR 1.0 (the one I'm developing) can now (and in future) hear 'n' record MIDI from all channels at once, and as Reason (full version, not demo) can export MIDI from its sequencer, it will be possible to convert .rps to .dream in realtime. I know several Reason artists, who might help me with ripping the MIDIs. Of course, I will have a month to create original music myself, but it's not very soon for that, and plans are now to focus on programming.
I used "sh*t" variables coz that's how I felt while making that part of the DR, now I use mostly "baka", in Japanese "idiot" lol, it's time consumin' to create names for variables, I suppose it's also my style to have
stg proc
local baka,baka2,baka3,baka4
;...
ret
stg endp

I see your style is to shrink code as much as possible :).

cya
Posted on 2002-12-02 20:13:02 by Ultrano

hi, Peci,

MME does not work well on _all_ computers. And it does not allow latency below 45ms, which is hell for music artists (that's why I jmp to DSound and 've forsaken MME). Your approach to using the wave loop is the ideal thing for your purpose- it can take total of below 100 bytes for creation, maintenance and deletion of sound.
I won't make more demo songs for DR 0.130. I am currently developing a better version, which has little in common with the one, published at my site. And Reason's songs cannot be imported, as the format is closed, and the instruments cannot output MIDI, which I can record. But there's a way around- DR 1.0 (the one I'm developing) can now (and in future) hear 'n' record MIDI from all channels at once, and as Reason (full version, not demo) can export MIDI from its sequencer, it will be possible to convert .rps to .dream in realtime. I know several Reason artists, who might help me with ripping the MIDIs. Of course, I will have a month to create original music myself, but it's not very soon for that, and plans are now to focus on programming.
I used "sh*t" variables coz that's how I felt while making that part of the DR, now I use mostly "baka", in Japanese "idiot" lol, it's time consumin' to create names for variables, I suppose it's also my style to have
stg proc
local baka,baka2,baka3,baka4
;...
ret
stg endp

I see your style is to shrink code as much as possible :).

cya


I'm looking forward to your DR 1.0, BTW my mixer is fully functional, can mix like 16~32 channels with 0% CPU on My Athlon 900Mhz, thanks Ultrano :D
Posted on 2002-12-02 20:43:42 by x86asm