uiua-lang / uiua

A stack-based array programming language
https://www.uiua.org
MIT License
1.51k stars 106 forks source link

Make un&ae automatically resample audio, some changes to soothe clippy::pedantic #528

Closed yanqui-uxo closed 1 month ago

yanqui-uxo commented 1 month ago

See #526

kaikalii commented 1 month ago

Like I said here, I don't think this should be done automatically. I'd prefer &ae/un &ae to take/return a sample rate. You could then take the ratio of that sample rate to &asr, and use keep to resample. This would also allow the user to encode audio at different sample rates.

yanqui-uxo commented 1 month ago

My concern is that resampling with keep is non-trivial if the new sample rate is not an integer multiple of the old one, unless there's an elegant method I'm missing. Would you be willing to have a dedicated audio resampling function?

kaikalii commented 1 month ago

Some new keep functionality allows non-integer scalar counts, for scaling arrays. Example pad

yanqui-uxo commented 1 month ago

I see! Alright, I'll work on your suggestion. Thanks!

kaikalii commented 1 month ago

If you do, I think the argument order for &ae should be Format SampleRate SampleData