Jump to content

Recommended Posts

Posted (edited)

Thanks for testing, I'll update the UDF

https://docs.microsoft.com/en-us/windows/desktop/api/Audioclient/nf-audioclient-iaudioclient-initialize

On Windows versions prior to Windows 10, a pull-mode capture client will not receive any events when a stream is initialized with event-driven buffering (AUDCLNT_STREAMFLAGS_EVENTCALLBACK) and is loopback-enabled (AUDCLNT_STREAMFLAGS_LOOPBACK). If the stream is opened with this configuration, the Initialize call succeeds, but relevant events are not raised to notify the capture client each time a buffer becomes ready for processing. To work around this, initialize a render stream in event-driven mode. Each time the client receives an event for the render stream, it must signal the capture client to run the capture thread that reads the next set of samples from the capture endpoint buffer. As of Windows 10 the relevant event handles are now set for loopback-enabled streams that are active.

Note that all streams must be opened in share mode because exclusive-mode streams cannot operate in loopback mode. For more information about audio loopback, see Loopback Recording.

LIES!

Edited by Bilgus
Posted

It writes directly to disk so length should only depend on harddisk space

I found with the data in memory at very high bitrates as the memory filled up it started gathering a lot of glitches.

An Improvement might be a small buffer to decrease disk writes but I didn't bother for the example

Thanks for testing :)

Posted

I've finally found a decent spec for the Wave Extensible Format:

http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html

turns out that Windows Media Player needs a 'fact' field added for Wave Extensible Formats

 

In light of the new info I've added a new function to the udf _WASAPI_RIFF_Header

this function replaces the previous wave header function in the example script

(WavHeader_Init) that I've left it commented out in the example script for now just in case an issue arises.

 

The generated WAV files do play in VLC and Windows Media Player so are probably fine.

I've also added padding to the WavSaver per the above spec but not sure how important it really is...

 

Bilgus

Posted

added a "pause" ( since is there to code ) to the example  :)

  Reveal hidden contents

 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted

I Fixed an error with Non Extensible wave formats that I introduced with the last change

 

I also incorporated the changes argumentum posted above

-- just be aware that not all devices pass back the silence flag and if the sound just recently

stopped you probably won't receive the notification even on devices that do pass the flag..

Posted

Updated the UDF and example code No longer a WIP, I think it is pretty complete now

I tried playback as well but unfortunately it will only play wav files in the same format as the soundcard

READ same sample rate (bitrate, bits/sample)  otherwise you need to do format conversion

which is possible but I mainly was interested in this for the loopback interface and is thus beyond the scope I need it for

 

  • Bilgus changed the title to WASAPI Audio Capture w/ loopback (WHAT U HEAR) UDF
Posted (edited)

it does not even compile now.

plus, could you please just attach the au3 files, this highlighting code isn't working for me, too much effort to test it.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Posted

@Earthshine I attached the files to the first post

You know I attributed not being able to compile a script I copy and pasted to test

last night to a user being an arse but perhaps its the forum software placing

non-breaking white spaces into the code blocks...

 

I suppose I owe him/her an apology.

  • 4 months later...
Posted
  • 6 months later...
Posted

hi guys  i try to use  this UDF with Sample  but i have  2 problem .

1 when i push ESC the program not  stop it

2. i force the  stop  and  when listen a file .raw  i listen it  bad  1 second listen good 2 second stay mute

Posted (edited)

Windows version?

did you download or copy paste?

any errors?

the raw file is pcm at whatever sampling rate your sound card is set to

what does this mean 'when listen a file .raw  i listen it  bad  1 second listen good 2 second stay mute'?

 

also please post output of console..

Edited by Bilgus

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...