AudioDriverKit

RSS for tag

Develop drivers for audio devices using AudioDriverKit.

Posts under AudioDriverKit tag

31 Posts

Post

Replies

Boosts

Views

Activity

SimpleAudioDriver sample, cannot install dext
Hi, I'm a little newbie on MacOS but did audio development for many years on other systems. Now I started some development on MacOS and tried to get this SimpleAudioDriver sample running. Compilation works fine and when I try to install the dext I'm prompted for my credentials. Afterwards "systemextensionsctl list" shows the dext as enabled and active but the SimpleAudio device is not shown in the "Audio MIDI Setup" and the SimpleAudioDriverApp says the extension is not running. I already tried various things from "csrutil disable" to "systemextensionsctl developer on" to "sudo nvram boot-args=-arm64e_preview_abi" My console log shows error entries like this: Error occurred while handling request "DextLaunch(arguments: Optional(["Check In Token": 18447, "Driver Extension Server Tag": 4294973749, "CFBundleIdentifier": de.bebetterorganized.dev.SimpleAudio.Driver, "DriverKit Reslide Shared Cache": 0, "Driver Extension Server Name": de.bebetterorganized.dev.SimpleAudio.Driver, "kOSBundleDextUniqueIdentifier": <3eb592b5 11e19191 027e272f 7fc6f5cc f24eaa62 367de83c 2fc697b5 4db10ed7>]))": Error Domain=NSPOSIXErrorDomain Code=8 "Exec format error" Now I'm not sure whether my extension is not loaded at all or whether it's just not detected as audio device and not connectable for any reason. I'm trying all these things on a MacBook Air with Apple M2 CPU, MacOS 13.2.1 and XCode Version 14.2 (14C18), MacOS Any hint would be appreciated, thanks a lot, Johannes
7
0
2.3k
Jun ’23
Request IOS Audio Driver change
Hello, I have been creating an audio recording app that records audio in the background. For example, you are just starting to pull over in your car, or are walking down an alley, you hit "record" and the app will record in the background, allowing you to use your phone otherwise like normal while you are going through the tense time. I have noticed that, on any audio recording app, once you start recording audio, all audible notification tones get muted. I have narrowed the issue down to the IOS audio driver. That said, is there a way to request a revision to this audio driver issue, in the next IOS update? Thanks!
0
0
897
Apr ’23
inaudible output after CoreAudio device initialises+limited number of controls per engine?
hi everyone, so i am wondering what else i must do after my device successfully completes the CoreAudio initialisation process? it seems ready to roll: but when i play something in itunes i don't hear anything. the slider moves as you'd expect. i compared some properties of the device to the headphone jack and noticed the latter maps to an output device (my headphones). in the case of this sound card, it's just a jack. is there something simple i'm missing? lastly, i noticed that the engine is limited to approximately 8 controls. i couldn't add the full 8 channels plus an 'allchannels' volume control, as you can see on the right panel of the second image. this is not due to a programming error. is it possible that the designers were stingy and used exactly 8 bits to describe the number of each kind of control on an engine (i.e. 8 toggles/8 selectors/8level controls)?
1
0
1.6k
Jan ’23
Help in debugging an Audio Server Plugin
I followed apple's demo application to create an audio server plugin named NullAudio. However, since the code is written in C with some COM interfaces, it is hard for a Swift Programmer. So I want to attach XCode to the Null Audio Plugin to take a look at the method calls. I googled and found the audio server plugin maybe debug in this way: Note the BGMDevice is another audio server plugin they created. So I followed, xcode attaches to coreaudiod process. But any breakpoint in the code just go grey, how can I make the break point active?
3
1
2.4k
Dec ’22
DriverKit - SetProperties
Hi, I'm currently port old driver to DriverKit framework. This driver use the properties mechanism to change the state of the device from user space. I would like also use it, but I can not force the call to overridden SetProperties function on driver site. Is it possible that SetProperties will be called when client call IOConnectSetCFProperties on given service? or I have to use the ExternalMethod mechanism. Or I will be possible to pass some dictionary structure which will mimic the SetProperty Call. Thank you for your answer. Best Regards, Andrzej
1
0
807
Dec ’21
Example code of AudioDriverKit stopped to work on macOS 12.0.1
Hi, Example code of AudioDriverKit from WWDC2021 stopped to work correctly for me. It builds and loads but when I want to record sine wave immediately after startIO function stopIO is called. It happens on both MacBook Air and Mac mini with macOS 12.0.1. I discovered it because my audio driver also stopped to work correctly - exactly the same problem I described above. Earlier I was testing both example code and my audio driver on macOS 12 public beta and everything was ok. Below I paste logs from console when I start recording: default 12:54:19.161261+0100 kernel StartIO: Start IO: device 2 default 12:54:19.161274+0100 kernel StartIO: Start IO: device 2 default 12:54:19.161092+0100 coreaudiod HALS_IOEngine2::StartIO: starting IO on device SimpleAudioDevice-UID default 12:54:19.161279+0100 kernel StartIO: Start IO: device 2 default 12:54:19.161138+0100 coreaudiod HALS_IOEngine2::_StartIO(435) on Context 443 state: Prewarm: 0 Play: 0 State: Stopped default 12:54:19.161374+0100 CAReportingService CAReportingService.mm:157 service type 9 set for reporter 897648164879 default 12:54:19.161437+0100 coreaudiod HALS_IOEngine2::_StartIO(435) on Context 443 state: Prewarm: 0 Play: 1 State: Running default 12:54:19.161761+0100 coreaudiod HALS_Device::_GetCombinedVolumeScalar: client 246 (pid 517) is not present and has a combined volume scalar is 1.000000 default 12:54:19.161798+0100 coreaudiod HALS_Device::_GetCombinedVolumeScalar: client 246 (pid 517) is not present and has a combined volume scalar is 1.000000 default 12:54:19.161808+0100 coreaudiod HALS_IOUADevice::HandlePropertiesChanged: Object: 431: SimpleAudioDevice-UID default 12:54:19.162034+0100 coreaudiod 'goin', 'glob', 0 default 12:54:19.162580+0100 coreaudiod CAReportingClient.mm:508 message { "device_is_aggregate" = 0; "input_avail_phys_formats" = "{ [16/48000/1 lpcm], [16/44100/1 lpcm] }"; "input_avail_virt_formats" = "{ [32/48000/1 lpcm], [32/44100/1 lpcm] }"; "input_bits_per_channel" = 32; "input_bytes_per_frame" = 4; "input_bytes_per_packet" = 4; "input_channels_per_frame" = 1; "input_device_source_list" = Unknown; "input_device_transport_list" = BuiltIn; "input_device_uid_list" = "SimpleAudioDevice-UID"; "input_format_id" = lpcm; "input_frames_per_packet" = 1; "input_num_tap_streams" = 0; "input_scalar_volume" = "1.000000"; "io_buffer_size" = 15; message = StartHardware; "output_num_tap_streams" = 0; "output_scalar_volume" = "1.000000"; "sample_rate" = 48000; }: ( 897648164879 ) error 12:54:19.163011+0100 coreaudiod 206515 HALS_IOUAUCDriver.cpp:500 Throwing Exception: ret != kIOReturnSuccess Failed to register event link error 12:54:19.163100+0100 coreaudiod 206515 HALS_IOUAEngine.cpp:157 Failed to register io thread! default 12:54:19.163950+0100 kernel StopIO: Stop IO: device 2 default 12:54:19.163968+0100 kernel StopIO: Stop IO: device 2 default 12:54:19.163974+0100 kernel StopIO: Stop IO: device 2 default 12:54:19.163166+0100 coreaudiod HALS_IOContext_Legacy_Impl::IOWorkLoop: failed to register io thread error 12:54:19.163310+0100 coreaudiod 206515 HALS_IOUAEngine.cpp:180 Throwing Exception: error != 0 Failed to disassociate event link 22 error 12:54:19.163482+0100 coreaudiod 206515 HALS_IOUAEngine.cpp:187 Failed to unregister io thread! default 12:54:19.163613+0100 coreaudiod HALS_IOEngine2::StopIO: stopping IO on device SimpleAudioDevice-UID default 12:54:19.163744+0100 coreaudiod HALS_IOEngine2::_StopIO(435) on Context 443 state: Prewarm: 0 Play: 1 State: Running default 12:54:19.164082+0100 coreaudiod HALS_IOUADevice::HandlePropertiesChanged: Object: 431: SimpleAudioDevice-UID default 12:54:19.164134+0100 coreaudiod 'goin', 'glob', 0 default 12:54:19.164289+0100 coreaudiod CAReportingClient.mm:480 stopping ( 897648164879 ) default 12:54:19.164542+0100 coreaudiod CAReportingClient.mm:508 message { "session_duration" = "0.003519058227539062"; }: ( 897648164879 ) error 12:54:19.165611+0100 Audacity HALC_ProxyIOContext::IOWorkLoop: the server failed to start, Error: 0x77686174 default 12:54:19.165045+0100 coreaudiod IO Stopped Context 443 after 0 frames. default 12:54:19.165199+0100 coreaudiod HALS_IOContext_Legacy_Impl::IOThreadEntry: 443 SimpleAudioDevice-UID (SimpleAudioDevice-UID): stopping with error 2003329396 default 12:54:19.165220+0100 coreaudiod HALB_PowerAssertion::Release: releasing power assertion ID 34859 of type 'PreventUserIdleSystemSleep' with name: 'com.apple.audio.context443.preventuseridlesleep' on behalf of 517 error 12:54:19.165390+0100 coreaudiod HALS_IOContext_Legacy_Impl::StartIOThread: the IO thread failed to start, Error: 2003329396 (what) Any advice? Thank you and regards
3
0
1.6k
Dec ’21
High CPU Usage for low latency USBDriverKit Audio Driver
I'm using USBDriverKit to write an audio driver for a High Speed USB device. In an attempt to understand the difference between DriverKit Extension and Kernel Extension latencies, I'm dispatching individual isochronous microframes that for this device each account for a duration 125µs, or 6 samples at 48kHz. I don't yet know what kind of latency I'm actually getting but I was surprised to see a high CPU usage of ~11% on a 512GB M1 mac mini running Big Sur 11.6. That's 8000 IsochIO() calls and 8000 completion callbacks per second. Instruments.app tells me that most of my time (60%) is being spent inside mach_msg, as part of a remote procedure call. Multiple questions occur to me: is this normal? should I expect lower CPU usage? isn't mach_msg blocking? shouldn't CPU usage be low? don't low latency audio folks avoid things like remote procedure calls? is seeking low latency throughput with USBDriverKit futile? does Monterey's AudioDriverKit enable lower latency, or is it a convenience API?
1
0
1.5k
Nov ’21
OSSystemExtensionErrorDomain error 9 while trying to run the SimpleAudioDriverExtension
Video: https://developer.apple.com/videos/play/wwdc2021/10190/ I'm trying to run the sample code from the SimpleAudioExtension workshop I get a validation error for OSSystemExtensionErrorDomain. Is there something that is missing from the instructions that is required to work around this error? If not, how would one work around this?
0
0
573
Nov ’21
Block multiple devices
Hello, I rewriting a audio driver that was created in IOKit to a new one based on AudioDriverKit. I would like to block possibility to connect multiple devices to the computer so that driver support just one device. In IOKit it was done by overriding IOAudioEngine::getLocalUniqueID() method and I cannot find anything similar in AudioDriverKit (IOUserAudioDevice). Do you know how to do it? Best Regards
2
0
956
Nov ’21
0.3 sec audio latency when using macOS M1 guest on macOS M1 host via Virtualization API
Hello! There are a few similar open-source projects that implement support for creating macOS M1 guest Virtual Machine on macOS M1 Host, for example: https://github.com/jspahrsummers/Microverse https://github.com/KhaosT/MacVM But both of them share a common problem: any audio from guest VM (system sounds or youtube videos in Safari or Firefox) is played late on host by approximately 0.3 seconds. Is there any way how we can remove this latency, so it is possible to hear real-time audio from guest VM? Regards, Eugene.
0
1
869
Nov ’21
SimpleAudioDriver sample, cannot install dext
Hi, I'm a little newbie on MacOS but did audio development for many years on other systems. Now I started some development on MacOS and tried to get this SimpleAudioDriver sample running. Compilation works fine and when I try to install the dext I'm prompted for my credentials. Afterwards "systemextensionsctl list" shows the dext as enabled and active but the SimpleAudio device is not shown in the "Audio MIDI Setup" and the SimpleAudioDriverApp says the extension is not running. I already tried various things from "csrutil disable" to "systemextensionsctl developer on" to "sudo nvram boot-args=-arm64e_preview_abi" My console log shows error entries like this: Error occurred while handling request "DextLaunch(arguments: Optional(["Check In Token": 18447, "Driver Extension Server Tag": 4294973749, "CFBundleIdentifier": de.bebetterorganized.dev.SimpleAudio.Driver, "DriverKit Reslide Shared Cache": 0, "Driver Extension Server Name": de.bebetterorganized.dev.SimpleAudio.Driver, "kOSBundleDextUniqueIdentifier": <3eb592b5 11e19191 027e272f 7fc6f5cc f24eaa62 367de83c 2fc697b5 4db10ed7>]))": Error Domain=NSPOSIXErrorDomain Code=8 "Exec format error" Now I'm not sure whether my extension is not loaded at all or whether it's just not detected as audio device and not connectable for any reason. I'm trying all these things on a MacBook Air with Apple M2 CPU, MacOS 13.2.1 and XCode Version 14.2 (14C18), MacOS Any hint would be appreciated, thanks a lot, Johannes
Replies
7
Boosts
0
Views
2.3k
Activity
Jun ’23
Request IOS Audio Driver change
Hello, I have been creating an audio recording app that records audio in the background. For example, you are just starting to pull over in your car, or are walking down an alley, you hit "record" and the app will record in the background, allowing you to use your phone otherwise like normal while you are going through the tense time. I have noticed that, on any audio recording app, once you start recording audio, all audible notification tones get muted. I have narrowed the issue down to the IOS audio driver. That said, is there a way to request a revision to this audio driver issue, in the next IOS update? Thanks!
Replies
0
Boosts
0
Views
897
Activity
Apr ’23
inaudible output after CoreAudio device initialises+limited number of controls per engine?
hi everyone, so i am wondering what else i must do after my device successfully completes the CoreAudio initialisation process? it seems ready to roll: but when i play something in itunes i don't hear anything. the slider moves as you'd expect. i compared some properties of the device to the headphone jack and noticed the latter maps to an output device (my headphones). in the case of this sound card, it's just a jack. is there something simple i'm missing? lastly, i noticed that the engine is limited to approximately 8 controls. i couldn't add the full 8 channels plus an 'allchannels' volume control, as you can see on the right panel of the second image. this is not due to a programming error. is it possible that the designers were stingy and used exactly 8 bits to describe the number of each kind of control on an engine (i.e. 8 toggles/8 selectors/8level controls)?
Replies
1
Boosts
0
Views
1.6k
Activity
Jan ’23
Sample is wrong project
The sample is not updated
Replies
1
Boosts
0
Views
1.8k
Activity
Dec ’22
Help in debugging an Audio Server Plugin
I followed apple's demo application to create an audio server plugin named NullAudio. However, since the code is written in C with some COM interfaces, it is hard for a Swift Programmer. So I want to attach XCode to the Null Audio Plugin to take a look at the method calls. I googled and found the audio server plugin maybe debug in this way: Note the BGMDevice is another audio server plugin they created. So I followed, xcode attaches to coreaudiod process. But any breakpoint in the code just go grey, how can I make the break point active?
Replies
3
Boosts
1
Views
2.4k
Activity
Dec ’22
DriverKit - SetProperties
Hi, I'm currently port old driver to DriverKit framework. This driver use the properties mechanism to change the state of the device from user space. I would like also use it, but I can not force the call to overridden SetProperties function on driver site. Is it possible that SetProperties will be called when client call IOConnectSetCFProperties on given service? or I have to use the ExternalMethod mechanism. Or I will be possible to pass some dictionary structure which will mimic the SetProperty Call. Thank you for your answer. Best Regards, Andrzej
Replies
1
Boosts
0
Views
807
Activity
Dec ’21
Example code of AudioDriverKit stopped to work on macOS 12.0.1
Hi, Example code of AudioDriverKit from WWDC2021 stopped to work correctly for me. It builds and loads but when I want to record sine wave immediately after startIO function stopIO is called. It happens on both MacBook Air and Mac mini with macOS 12.0.1. I discovered it because my audio driver also stopped to work correctly - exactly the same problem I described above. Earlier I was testing both example code and my audio driver on macOS 12 public beta and everything was ok. Below I paste logs from console when I start recording: default 12:54:19.161261+0100 kernel StartIO: Start IO: device 2 default 12:54:19.161274+0100 kernel StartIO: Start IO: device 2 default 12:54:19.161092+0100 coreaudiod HALS_IOEngine2::StartIO: starting IO on device SimpleAudioDevice-UID default 12:54:19.161279+0100 kernel StartIO: Start IO: device 2 default 12:54:19.161138+0100 coreaudiod HALS_IOEngine2::_StartIO(435) on Context 443 state: Prewarm: 0 Play: 0 State: Stopped default 12:54:19.161374+0100 CAReportingService CAReportingService.mm:157 service type 9 set for reporter 897648164879 default 12:54:19.161437+0100 coreaudiod HALS_IOEngine2::_StartIO(435) on Context 443 state: Prewarm: 0 Play: 1 State: Running default 12:54:19.161761+0100 coreaudiod HALS_Device::_GetCombinedVolumeScalar: client 246 (pid 517) is not present and has a combined volume scalar is 1.000000 default 12:54:19.161798+0100 coreaudiod HALS_Device::_GetCombinedVolumeScalar: client 246 (pid 517) is not present and has a combined volume scalar is 1.000000 default 12:54:19.161808+0100 coreaudiod HALS_IOUADevice::HandlePropertiesChanged: Object: 431: SimpleAudioDevice-UID default 12:54:19.162034+0100 coreaudiod 'goin', 'glob', 0 default 12:54:19.162580+0100 coreaudiod CAReportingClient.mm:508 message { "device_is_aggregate" = 0; "input_avail_phys_formats" = "{ [16/48000/1 lpcm], [16/44100/1 lpcm] }"; "input_avail_virt_formats" = "{ [32/48000/1 lpcm], [32/44100/1 lpcm] }"; "input_bits_per_channel" = 32; "input_bytes_per_frame" = 4; "input_bytes_per_packet" = 4; "input_channels_per_frame" = 1; "input_device_source_list" = Unknown; "input_device_transport_list" = BuiltIn; "input_device_uid_list" = "SimpleAudioDevice-UID"; "input_format_id" = lpcm; "input_frames_per_packet" = 1; "input_num_tap_streams" = 0; "input_scalar_volume" = "1.000000"; "io_buffer_size" = 15; message = StartHardware; "output_num_tap_streams" = 0; "output_scalar_volume" = "1.000000"; "sample_rate" = 48000; }: ( 897648164879 ) error 12:54:19.163011+0100 coreaudiod 206515 HALS_IOUAUCDriver.cpp:500 Throwing Exception: ret != kIOReturnSuccess Failed to register event link error 12:54:19.163100+0100 coreaudiod 206515 HALS_IOUAEngine.cpp:157 Failed to register io thread! default 12:54:19.163950+0100 kernel StopIO: Stop IO: device 2 default 12:54:19.163968+0100 kernel StopIO: Stop IO: device 2 default 12:54:19.163974+0100 kernel StopIO: Stop IO: device 2 default 12:54:19.163166+0100 coreaudiod HALS_IOContext_Legacy_Impl::IOWorkLoop: failed to register io thread error 12:54:19.163310+0100 coreaudiod 206515 HALS_IOUAEngine.cpp:180 Throwing Exception: error != 0 Failed to disassociate event link 22 error 12:54:19.163482+0100 coreaudiod 206515 HALS_IOUAEngine.cpp:187 Failed to unregister io thread! default 12:54:19.163613+0100 coreaudiod HALS_IOEngine2::StopIO: stopping IO on device SimpleAudioDevice-UID default 12:54:19.163744+0100 coreaudiod HALS_IOEngine2::_StopIO(435) on Context 443 state: Prewarm: 0 Play: 1 State: Running default 12:54:19.164082+0100 coreaudiod HALS_IOUADevice::HandlePropertiesChanged: Object: 431: SimpleAudioDevice-UID default 12:54:19.164134+0100 coreaudiod 'goin', 'glob', 0 default 12:54:19.164289+0100 coreaudiod CAReportingClient.mm:480 stopping ( 897648164879 ) default 12:54:19.164542+0100 coreaudiod CAReportingClient.mm:508 message { "session_duration" = "0.003519058227539062"; }: ( 897648164879 ) error 12:54:19.165611+0100 Audacity HALC_ProxyIOContext::IOWorkLoop: the server failed to start, Error: 0x77686174 default 12:54:19.165045+0100 coreaudiod IO Stopped Context 443 after 0 frames. default 12:54:19.165199+0100 coreaudiod HALS_IOContext_Legacy_Impl::IOThreadEntry: 443 SimpleAudioDevice-UID (SimpleAudioDevice-UID): stopping with error 2003329396 default 12:54:19.165220+0100 coreaudiod HALB_PowerAssertion::Release: releasing power assertion ID 34859 of type 'PreventUserIdleSystemSleep' with name: 'com.apple.audio.context443.preventuseridlesleep' on behalf of 517 error 12:54:19.165390+0100 coreaudiod HALS_IOContext_Legacy_Impl::StartIOThread: the IO thread failed to start, Error: 2003329396 (what) Any advice? Thank you and regards
Replies
3
Boosts
0
Views
1.6k
Activity
Dec ’21
High CPU Usage for low latency USBDriverKit Audio Driver
I'm using USBDriverKit to write an audio driver for a High Speed USB device. In an attempt to understand the difference between DriverKit Extension and Kernel Extension latencies, I'm dispatching individual isochronous microframes that for this device each account for a duration 125µs, or 6 samples at 48kHz. I don't yet know what kind of latency I'm actually getting but I was surprised to see a high CPU usage of ~11% on a 512GB M1 mac mini running Big Sur 11.6. That's 8000 IsochIO() calls and 8000 completion callbacks per second. Instruments.app tells me that most of my time (60%) is being spent inside mach_msg, as part of a remote procedure call. Multiple questions occur to me: is this normal? should I expect lower CPU usage? isn't mach_msg blocking? shouldn't CPU usage be low? don't low latency audio folks avoid things like remote procedure calls? is seeking low latency throughput with USBDriverKit futile? does Monterey's AudioDriverKit enable lower latency, or is it a convenience API?
Replies
1
Boosts
0
Views
1.5k
Activity
Nov ’21
OSSystemExtensionErrorDomain error 9 while trying to run the SimpleAudioDriverExtension
Video: https://developer.apple.com/videos/play/wwdc2021/10190/ I'm trying to run the sample code from the SimpleAudioExtension workshop I get a validation error for OSSystemExtensionErrorDomain. Is there something that is missing from the instructions that is required to work around this error? If not, how would one work around this?
Replies
0
Boosts
0
Views
573
Activity
Nov ’21
Block multiple devices
Hello, I rewriting a audio driver that was created in IOKit to a new one based on AudioDriverKit. I would like to block possibility to connect multiple devices to the computer so that driver support just one device. In IOKit it was done by overriding IOAudioEngine::getLocalUniqueID() method and I cannot find anything similar in AudioDriverKit (IOUserAudioDevice). Do you know how to do it? Best Regards
Replies
2
Boosts
0
Views
956
Activity
Nov ’21
0.3 sec audio latency when using macOS M1 guest on macOS M1 host via Virtualization API
Hello! There are a few similar open-source projects that implement support for creating macOS M1 guest Virtual Machine on macOS M1 Host, for example: https://github.com/jspahrsummers/Microverse https://github.com/KhaosT/MacVM But both of them share a common problem: any audio from guest VM (system sounds or youtube videos in Safari or Firefox) is played late on host by approximately 0.3 seconds. Is there any way how we can remove this latency, so it is possible to hear real-time audio from guest VM? Regards, Eugene.
Replies
0
Boosts
1
Views
869
Activity
Nov ’21