Skip to content

Support audio device for vz driver #1532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 11, 2023
Merged

Conversation

balajiv113
Copy link
Member

Fixes #1531

Had to do some setup to configure audio. Steps are as follows,

  • Install linux-image-extra-virtual to enable virtio-snd
  • Restart the VM
  • Run aplay -l to verify if device is shown
  • Install alsa-utils
  • Run usermod -a -G audio <user>
  • Restart the vm
  • Run `nano ~/.asoundrc and add the following
pcm.!default {
        type hw
        card 1
}

ctl.!default {
        type hw
        card 1
}
  • Run speaker-test -t wav and verify audio working

Note: These are the steps worked for me, there might be some simplified steps to configure as well.

Signed-off-by: Balaji Vijayakumar <[email protected]>
@AkihiroSuda AkihiroSuda added this to the v0.16.0 milestone May 11, 2023
@AkihiroSuda AkihiroSuda requested a review from afbjorklund May 11, 2023 06:04
@afbjorklund
Copy link
Member

Does vz also have a dummy driver, that presents an audio device but doesn't do any sound ?

If so, it could be connected to the "none" value

if err != nil {
return err
}
inputStream, err := vz.NewVirtioSoundDeviceHostInputStreamConfiguration()
Copy link
Member

@afbjorklund afbjorklund May 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't configure any input stream for qemu, but that is probably a good idea... maybe a boolean ? or not

Think it should be enough (for qemu) to swap hda-output for hda-duplex for the HDA Audio Codec

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be fine as QEMU directly has a device that support both. But i haven't tested microphone case.

I think it needs some permission (NSMicrophoneUsageDescription) in Info.plist. Checking on how to provide that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just verified Microphone as well, it is working without any extra Info.plist. Not sure how but working :D

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just verified Microphone as well, it is working without any extra Info.plist. Not sure how but working :D

I suspect you allowed your terminal to access the microphone, so all processes started from it will inherit this right. Just like when you give the terminal full disk access, all child processes have full access as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah this makes a lot of sense.
Thanks for the clarification 😃

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@balajiv113
Copy link
Member Author

Does vz also have a dummy driver, that presents an audio device but doesn't do any sound ?

If so, it could be connected to the "none" value

No vz doesn't have a dummy driver

@AkihiroSuda AkihiroSuda merged commit a4fdc5d into lima-vm:master May 11, 2023
@balajiv113 balajiv113 deleted the vz-audio branch May 11, 2023 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support audio device for vz driver
4 participants