Open navinreddy23 opened 1 month ago
Looks like there are some devices listed here that are not capture devices.
Capture Devices
ID: [0]: 616c73615f6f75747075742e7063692d303030305f30305f31662e332e616e616c6f672d73746572656f2e6d6f6e69746f72, Monitor of Built-in Audio Analog Stereo, [ok], formats: [{Format:4 Channels:2 SampleRate:48000 Flags:0}]
ID: [1]: 616c73615f696e7075742e7063692d303030305f30305f31662e332e616e616c6f672d73746572656f, Built-in Audio Analog Stereo, [ok], formats: [{Format:4 Channels:2 SampleRate:48000 Flags:0}]
ID: [2]: 616c73615f6f75747075742e7063692d303030305f30315f30302e312e68646d692d73746572656f2d6578747261312e6d6f6e69746f72, Monitor of GP107GL High Definition Audio Controller Digital Stereo (HDMI 2), [ok], formats: [{Format:4 Channels:2 SampleRate:48000 Flags:0}]
ID: [3]: 626c75657a5f696e7075742e36305f46445f41365f30425f34375f33442e30, miPods, [ok], formats: [{Format:2 Channels:1 SampleRate:16000 Flags:0}]
ID: [4]: 626c75657a5f6f75747075742e36305f46445f41365f30425f34375f33442e312e6d6f6e69746f72, Monitor of miPods, [ok], formats: [{Format:2 Channels:1 SampleRate:16000 Flags:0}]
Choose an ID from the list above:
ID's 0
, 2
and 4
are not Capture devices, yet they show up here.
infos, err := context.Devices(malgo.Capture)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Println("Capture Devices")
for i, info := range infos {
e := "ok"
full, err := context.DeviceInfo(malgo.Capture, info.ID, malgo.Shared)
if err != nil {
e = err.Error()
}
fmt.Printf(" ID: [%d]: %v, %s, [%s], formats: %+v\n",
i, info.ID, info.Name(), e, full.Formats)
}
But it is not the case for Playback devices.
Playback Devices
0: 616c73615f6f75747075742e7063692d303030305f30305f31662e332e616e616c6f672d73746572656f, Built-in Audio Analog Stereo, [ok], formats: [{Format:4 Channels:2 SampleRate:48000 Flags:0}]
1: 616c73615f6f75747075742e7063692d303030305f30315f30302e312e68646d692d73746572656f2d657874726131, GP107GL High Definition Audio Controller Digital Stereo (HDMI 2), [ok], formats: [{Format:4 Channels:2 SampleRate:48000 Flags:0}]
2: 626c75657a5f6f75747075742e36305f46445f41365f30425f34375f33442e31, miPods, [ok], formats: [{Format:2 Channels:1 SampleRate:16000 Flags:0}]
Choose an ID from the list above:
In playback devices, Capture devices are not to be seen.
I don't see an issue, or perhaps I didn't understand you. What do you get from aplay -l
and arecord -l
, you should get the same list. Depending on the sound card you get a list of all possible devices, i.e. I get 5 playback devices but only one I can use, similar to capture devices, they are not playback but there are monitors and whatnot devices, pick the correct one based on channels, format, skip monitor
devices, etc.
The point of enumeration is that you get a list of possible devices, and you pick and choose one, I don't think there is any guarantee here, anyway, these are bindings, and even if there is an issue it will not be solved here.
Hi @gen2brain,
I think the code is too much in the previous comment.
The Issue I faced initially:
If it helps anyone, I will attach captureToFile.txt the modified capture.go file to store in in a wav file.
Hi,
I am unable to capture from a specific device, but I am able to play back. The code structure remains the same and is derived from the examples.
If I comment
deviceConfig.Capture.DeviceID = infos[id].ID.Pointer()
, then I get audio captured from the default stream.When this line is enabled, the callback is triggered and I received 640 bytes of zeroes. No data is received. Am I missing something here?