Skip to content
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

Segfaul when trying to init sound from a single-channel pink noise on the web #907

Open
DaniilAlpha opened this issue Nov 1, 2024 · 2 comments

Comments

@DaniilAlpha
Copy link

DaniilAlpha commented Nov 1, 2024

The default miniaudio has two critical bugs for me, although they are fixed in dev and dev-12.0, so I use the dev-12.0 version.

After compiling for the web (with audio worklet) with some debugging options, I got a segmentation fault (line 66345) reported by emscripten when trying to use pink noise as data source in ma_sound_init_from_data_source. Tried both f32 and u8 formats at 44100 Hz, still the same. Other noise types worked fine.

The problem was with the number of channels (the playback device has 2 channels). There was a single channel set, but after I set it to 2, it started working.

Here is some device info:
Default Playback Device (Playback)
INFO: Format: 32-bit IEEE Floating Point -> 32-bit IEEE Floating Point
INFO: Channels: 2 -> 2
INFO: Sample Rate: 48000 -> 48000
INFO: Buffer Size: 128*1 (128)
INFO: Conversion:
INFO: Pre Format Conversion: NO
INFO: Post Format Conversion: NO
INFO: Channel Routing: NO
INFO: Resampling: NO
INFO: Passthrough: YES
INFO: Channel Map In: {CHANNEL_FRONT_LEFT CHANNEL_FRONT_RIGHT}
INFO: Channel Map Out: {CHANNEL_FRONT_LEFT CHANNEL_FRONT_RIGHT}

Perhaps non-native parameters are not allowed for generated sounds? If so, it would be better if this was an assertion.

@mackron
Copy link
Owner

mackron commented Nov 15, 2024

Are you ensuring the channel count and format of the ma_noise object matches with the device. If not, you need to.

@DaniilAlpha
Copy link
Author

DaniilAlpha commented Nov 16, 2024

Understand. But as i said, it would be better if possible to assert that, instead of just leaving it to the sanitizers, as there is no ways of knowing this other than intuition. Also it worked on previous versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants