Re: Reading audio samples immediately





Hitchkas wrote:

This is probably asking too much but do you know if it is possible to
read audio samples as they are sampled. For example if the soundcard
is sampling at 22 kS/sec then each sample becomes available every
45usec. Is it possible in this case to have a callback function
invoked every 45usec immediately after the sample is taken?

Thanks



I once did exactly that; but it was a total hack and incompatible with
the operating system. I don't know (but would love to know) how to adapt
it to Windows today.
My project is real-time pitch feedback. Way back under W3.1, as I was
learning about how soundcards operate, I copied and adapted the basic
driver assembly code for my particular soundcard and set up, started and
stopped the card and the DMA controller myself. The card used DMA to
transfer the incoming/outgoing data and by polling the particular DMA
control words I could see exactly when the next data point was dropped
into the memory area I had allocated. So I did have a latency of only
one sample (44 kHZ). In one mode I play back an "in-tune" note depending
upon which note is closest to what the user is playing/singing. This is
the only time I have had such a mode work really beautifully, it could
react basically instantly - using the Windows sound interface, ( a total
piece of $@!&*, the input and output delays are just so long that the
results are often pathetic.
Of course this isn't compatible with running anything else
simultaneously, it completely took over the system with a polling loop,
or with keeping Windows from crashing. But I learned a lot, and keep
wishing some special mode would be created for use of real-time sound.
But from what has been written on newsgroups about Vista, we step
backwards with each new incarnation.
I don't know exactly what contemporary sound cards do for data transfer
but suspect that with USB or whatever, there is little datum-by-datum
transfer, but rather a block of data moves at one time. And it doesn't
help to set up WaveIn with tiny buffers, as the driver often uses a
bigger buffer and so you can't get the data any more quickly than the
size the driver uses. DirectX from all reports is no better than the
WaveIn API, as it all depends on the driver's latency.

You might look into the Macs instead! I've heard they are much better
but I have no experience.



Michael
.



Relevant Pages

  • Re: VIA Envy24PT sound card driver loads at startup properly 9 of 10 times
    ... driver updates including the latest and correct driver for the sound card. ... Onboard sound chip is disabled in BIOS and the driver for it is not installed. ... The sound card, Chaintech, Envy24 Family Audio Controller WDM, is installed/seated properly and uses the IRQ 16 exclusively. ...
    (microsoft.public.windowsxp.hardware)
  • Re: Udp sending performance in Gbit Ethernet
    ... > saw a sudden drop of perfromance for certain packet sizes. ... > there can be just so many reasons like interrupts and DMA. ... > such as the maximum DMA block size or alike, which forces the driver to ... Try different versions of the driver for the card. ...
    (microsoft.public.development.device.drivers)
  • RE: Sound device problems
    ... Tomorrow I shall reinstall the PCI card. ... I once had to reinstall windows and I used a Flopy to boot then ... sometimes pc makers use a variety of sound card manufacturers. ... install the sound device but will install the audio driver as well. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: DeviceIOControl
    ... I have own driver for a virtual sound ... > card and I want to redirect some sound data to the hardware sound card ... device's filter with the output pin connected to the input of real sound ...
    (microsoft.public.development.device.drivers)
  • Re: Trying to Install New Sound Card... ARRRRGGGGHHH!
    ... The only sound card I've had is the one on-board, ... but their driver does no better. ... rebooted and install the drivers. ...
    (microsoft.public.windowsxp.hardware)

Loading