What im trying to do is to simulate a 4 bit DAC (Digital to Analog Converter), well somebody in other forum told me that is not necessary to emulate the DAC cos the Sound Card has one. But if i send the 4 bit value to "waveOutWrite" it isnt playing what it should play.

Another question i have is, if i want to send a determinated hz to the sound card to play (suppose 120khz) and the only way to access the sound card (not thinking in directplay) is waveoutWrite, this means thru PCM, How do i do this?
Posted on 2005-01-14 17:07:46 by Ateneo
about the last question: 120kHz will be impossible, since the average soundcards go up to 44.1kHz, so according to mister Nyquist and Shannon you can go up to about 22kHz. and well, if you want a sound that has a "pure" frequency of a given frequency, you'll need to generate a sinewave, you can do it with the FPU.
Posted on 2005-01-15 11:23:37 by lifewire
Get BASS from http://www.un4seen.com/
See the "Synthesizer" example - it is exactly from where you need to start
Actually, start from here:

include bass.inc
includelib bass.lib

ramp1 dd 0

ComputeOneSample proc ; return in AX the sample data, in integer form
inc ramp1
mov eax,ramp1
and eax,255
sub eax,128
neg eax
shl eax,10
ComputeOneSample endp

WriteStream proc handle,buffer,buflen,usrData
mov ecx,buflen
shr ecx,1
mov ebx,buffer
invoke ComputeOneSample
mov ,ax
add ebx,2
dec ecx
jnz @B

mov eax,buflen
WriteStream endp

InitSound proc
invoke BASS_GetVersion
invoke BASS_Init,1,44100,BASS_DEVICE_LATENCY,0,0
invoke BASS_StreamCreate,44100,1,0,WriteStream,0
invoke BASS_ChannelPlay,eax,0
InitSound endp

ReleaseSound proc
invoke BASS_Free
ReleaseSound endp

Concentrate on the ComputeOneSample procedure - in AX (or EAX) return the sample data to be outputted via the waveout jack of the sndcard. The data is 16-bit . In the example above, ComputeOneSample generates a saw wave (ramp) with 172Hz frequency and around 0.5V max value (the amplitude depends on your soundcard and its current mixer settings).
Posted on 2005-05-08 07:20:40 by Ultrano
is bass written in asm?
Posted on 2005-05-09 10:26:48 by HeLLoWorld
Definitely NOT. C only.
Posted on 2005-05-09 13:20:45 by Ultrano