R_OpenLib update - FIR Oversamping

Post Reply
User avatar
ChR_is
Posts: 107
Joined: Wed Sep 22, 2021 5:48 pm

R_OpenLib update - FIR Oversamping

Post by ChR_is »

The R_Ware open source DSP library has received a long awaited update: Linear-Phase FIR Oversampling!

Check it out here: https://github.com/NeverKnewTheName/R_OpenLib

It's been a long while and this update was long overdue. Finding time to add to this project becomes increasingly difficult unfortunately :/

Anyways, here's an implementation of a polyphase FIR oversampler (upsampler + downsampler).

I have updated the Hardclipper example to showcase how to use the oversampler. There's also a new fir oversampler oscillator that shows how to just use the downsampler.

There's a long debate to be had when it comes to FIR vs IIR oversampling. In my experience/opinion, IIR oversampling is a lot more suited in the modular context. FIR oversampling (in this case) is linear phase, which is nice, but inevitably introduces latency. This breaks feedback loops and parallel patches. VM cannot compensate this latency. To be clear: this is not a bug! just a tradeoff..

You can implement and add your own FIR filter coefficients. calculating coefficients can be done with math software like GNU Octave or websites like http://t-filter.engineerjs.com/ or https://fiiir.com/ . The coefficients given in R_OpenLib are calculated with Octave by applying a Kaiser window to a sinc. it's been a long try-and-error process until the filtering was good enough yet also efficient enough. feel free to share your coefficients if you can come up with great FIR filters :)

Have fun creating amazing modules!
User avatar
utdgrant
Posts: 541
Joined: Wed Apr 07, 2021 8:58 am
Location: Scotland
Contact:

Re: R_OpenLib update - FIR Oversamping

Post by utdgrant »

Awesome, Chris. Thanks again for all your hard work and generosity in bringing this to the community. It's very much appreciated.
______________________
Dome Music Technologies
User avatar
ChR_is
Posts: 107
Joined: Wed Sep 22, 2021 5:48 pm

Re: R_OpenLib update - FIR Oversamping

Post by ChR_is »

Thanks for your kind words Grant!

i'd love to expand R_OpenLib a lot more, but unfortunately i can't find enough time.
Next on my list to add are oscillators... soon-ish :D
borkman
Posts: 51
Joined: Tue May 09, 2023 7:26 pm

Re: R_OpenLib update - FIR Oversamping

Post by borkman »

Thank you so much! Besides being quite easy to add to a project, working code is a wonderful resource for learning.

P.S. Adding oscillators would be fantastic if you ever find time. ;)
User avatar
ChR_is
Posts: 107
Joined: Wed Sep 22, 2021 5:48 pm

Re: R_OpenLib update - FIR Oversamping

Post by ChR_is »

borkman wrote: Sat Dec 16, 2023 6:59 pm Thank you so much! Besides being quite easy to add to a project, working code is a wonderful resource for learning.
you are very much welcome! :)
the code is MIT licensed, so feel free to use in your personal and commercial projects.
borkman wrote: Sat Dec 16, 2023 6:59 pm P.S. Adding oscillators would be fantastic if you ever find time. ;)
i am fascinated by oscillators. i think there's so much more to do with oscillators than what we currently have in the audio world. the basics are pretty simple tbh. most oscillators are phasor based. a phasor is a ramp-up whose wave-cycle is relative to the frequency. in essence sth like:

Code: Select all

void setFreq( double freq )
{
	//calculate the distance the phase needs to travel per sample
	m_phi = freq / sampleRate;
}
double advance()
{
	//increment phase
	m_phasor += m_phi;
	//handle wrap around at 1 (this won't work for negative frequencies)
	m_phasor -= (int)m_phasor;

	return Math.sin( 2 * Math.PI * m_phasor );
}
double m_phasor;
double m_phi;
please note this is a very barebones and inefficient example, but it should get you started. ;)

for R_OpenLib i need to come up with a flexible and extensible design that's easy to use and allows for a multitude of use cases. that takes careful consideration.... and of course time
UrbanCyborg
Posts: 599
Joined: Mon Nov 15, 2021 9:23 pm

Re: R_OpenLib update - FIR Oversamping

Post by UrbanCyborg »

Thanks, Chris. We all appreciate your time and the quality of your work! :D

Reid
Cyberwerks Heavy Industries -- viewforum.php?f=76
Post Reply

Return to “Module Designer”