Hi,
I want to try creating a program that records samples from a sound card or opens a wave file and then I want to be able to modify the sampled bytes directly before outputting them to the sound card. Does anyone know how this can be done?

Thanks,
Programinator
Posted on 2005-09-21 20:00:07 by programinator
You want to record, DSP, and then output on the fly?
Posted on 2005-09-21 21:06:22 by comrade
Yes, I want to record, DSP then output. I want to make a music synthesiser which allows you to record a sound then it creates a table with that sound in all the different music keys (frequencys)
Posted on 2005-09-21 21:19:49 by programinator
I really just want want to know the best way to access the soundcard (APIs or otherwise)  :)
Posted on 2005-09-21 23:47:02 by programinator
Look at the Multimedia Audio section of the Platform SDK -- functions like waveInOpen, waveOutOpen etc.
Posted on 2005-09-22 06:34:08 by Frank
yeah... u will have to keep short buffers to minimize the latency
there is a trick u do, having 2 buffers and swapping them as soon as one of them is done, but both are always queued at any time with waveInPrepareHeader or somethin g like that
Posted on 2005-09-22 13:39:15 by comrade
programinator, look up DirectSound. It's the way to fly.
Posted on 2005-09-23 07:27:29 by f0dder
something to start with....

here's a directsound example

http://members.home.nl/siekmanski/playsound.zip
Posted on 2005-09-23 10:15:42 by Siekmanski
Duplex software performs best with DirectSound + WDM streaming.
I have Audigy1 sndcard, and a high-end PC (thus, cpu power won't affect results), and these are the minimum latencies for each of the 3 implementations:
waveOut - 40ms
DirectSound, default settings - 20ms
DirectSound, WDM streaming - 5ms (probably can go even lower on better soundcards+drivers)

This is the one-way latency (thus, double the numbers for the overall one)

I just found about WDM streaming, and now I'm trying to implement it (in asm).
It's great that we don't have to make ASIO wrappers and all, to achieve low latency on Audigy :D
Posted on 2005-09-23 18:28:38 by Ultrano
Studied a bit the srccode of PortAudio, turns out WDM streaming (aka KS) isn't a part of DirectSound.
Instead, we have to load KsUser.dll , and use "pins" - a DirectShow complexity. KS takes up the audiocard for itself, thus doesn't allow for other apps to play/record sound. Thus, removes the extra-latency, induced by the kmixer (which is usually tens of ms).

So, a bit more reallistic latencies are:
waveOut - 200+ ms
DirectSound - 40+ ms
KS - 5 ms
ASIO - 2ms (96samples @ 48kHz)

The first two methods are very dependant on sndcard, OS, drivers, polling/events, and one environmental variable.

lol Now I see that using DirectSound is a walk in the park, compared to KS and ASIO.
Posted on 2005-09-23 19:51:17 by Ultrano