[LAU] samplerate conversion targetting number of samples
julien at mail.upb.de
Wed Nov 14 08:00:11 CET 2018
Nov 14 2018, Brent Busby has written:
> Anyone know some Linux CLI tools that would be good to batch convert a
> folder of 24/96 samples, mostly small waveform clips about two to four
> wavecycles long each, down to 8-bit...<drumroll>...and the nearest
> number of samples that's a multiple of 256 by stretching/squeezing, not
> by truncation (so as not to ruin looping)?
Hm, not in one go. But sndfile-convert will convert it down to 8-bit.
With sndfile-info you can obtain all kinds of info, including the length
in samples. If you know your way around CLI tools such as grep, awk
and/or sed you can extract the number of samples into a variable. With a
tool like bc you can do the necessary maths, depending on the desired
solution a modulo operation or floating point division.
Now the difficult bit. sndfile-resample offers the samplerate conversion
option -by amount, so you can give a factor. I guess it comes down to
which samplerates wav does support.
Another way could be to use soundstretch to change the speed by the
necessary factor. It works not by FFT, which is fine for small(er)
If you can spot a way, but have insurmountable challanges with the
scripting practicalities, let me know. I'd be happy to help.
Best wishes and good luck,
* Website: http://juliencoder.de - for summer is a state of sound
* SoundCloud: https://soundcloud.com/jeanette_c
* Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
* GitHub: https://github.com/jeanette-c
* Twitter: https://twitter.com/jeanette_c_s
I'm so curious, what do you think of me <3
More information about the Linux-audio-user