Closed cswank closed 4 years ago
Can you try with C capture example https://github.com/dr-soft/miniaudio ? If it works there I can work on updating the library here.
Yes, I was able to run the c capture example, it seems to work fine.
Can you try whether v0.10.4 fixes things https://github.com/gen2brain/malgo/pull/19?
Unfortunately it looks like the same problem, but a different line number in miniaudi.sh:
➜ capture git:(fixes) ✗ go run . Recording... Press Enter to stop recording... Assertion failed: (pLPF->format == ma_format_f32), function ma_lpf_process_pcm_frame_f32, file /Users/craig/Projects/malgo/miniaudio.h, line 31279. signal: abort trap
Pushed an additional fix.
PR is merged, but I see now same error on the same line with playback example. When commenting that assert check on line 31279 it just works.
I suspect that the audio would be slowed down by some amount.
I think the reason is that the device uses sample rate that's defined in the file, rather what the device supports. It does seem to have resampling support and I think the playback example should use that instead.
Although there does seem to be some internal resampling available:
The `config.playback.channels` member sets the number of channels to use with the device. The channel count cannot exceed MA_MAX_CHANNELS. The
`config.sampleRate` member sets the sample rate (which must be the same for both playback and capture in full-duplex configurations). This is usually set to
44100 or 48000, but can be set to anything. It's recommended to keep this between 8000 and 384000, however.
Note that leaving the format, channel count and/or sample rate at their default values will result in the internal device's native configuration being used
which is useful if you want to avoid the overhead of miniaudio's automatic data conversion.
No clue why it would fail though.
Now master is working for me.
Managed to reproduce it directly in miniaudio. The difference is that currently the package is using empty DeviceConfig, however, the miniaudio examples use ma_device_config_init
, which also sets deviceConfig.resampling.linear.lpfOrder
.
Hello, when I run the capture example on my Mac-mini (2018, Catalina 10.15.3) it exits early with this error:
Assertion failed: (tNext <= framesReadFromClient+1), function ma_src_read_deinterleaved__linear, file /Users/craig/go/pkg/mod/github.com/gen2brain/malgo@v0.0.0-20200417130222-7f137bb8be68/miniaudio.h, line 30529
The Mac mini doesn't have a microphone, but I have a guitar usb interface that is considered the default input device in sound preferences. Also, I'm running it in iterm, which does have access to the input device in the privacy settings. Would you expect this setup to work?