# Bohmian Up-Sampling

To test the Bohmian Up-Sampling algorithm, a .wav file originally sampled at 11025hz was decimated by a factor of eight to yield a file with N = odd-length points (odd necessary), and a sampling frequency of 1378hz. We then passed this under-sampled file through the RUP algorithm with three sampling frequency doublings set (v=3), to yield a restoratively up-sampled file of the same sampling frequency as the original file (11025hz).

The original file, and both the under-sampled file and the restoratively up-sampled file are audible on buttons below for comparison. The algorithm outputs require minor scaling to be written as .wav files without clipping.

The BUP algorithm works best on pure, raw data without post-production volume level adjustments and the like. These adjustments throw kinks into the pre- and post-casting efforts of the algorithm.

And while BUP, in isolation, may amplify quantization error, there could be a maxima of certainty between quantization precision and a specified number of down-samplings that would allow the BUP algorithm to be used for data compression (by some type of down-sampling) with unpacking done using the BUP algorithm.

In conjunction with the noise reduction (QEAR) algorithm, BUP processing may have applications in the recording and re-mastering of music, as well as in cryptanalysis and blockchain computations, just to name a few, as yet relatively uncertain ideas.

A White Paper for the algorithm follows below. Smartphones don't typically play the .wav files, so you might try a computer...

What follows is all the MATLAB code we have written, for Bohmian up-sampling, subroutines included:

First, the master control program for the up-sampling {bup.m}, followed by three subroutines:

function A = bup(x,v)

A=(x);

for p = 1:v

Ns=size(A);

N=Ns(2:2);

F=fft(A);

zc=complex(0.0,0.0);

fcomp=F(2:N);

F=[zc,fcomp];

A_no_dc=ifft(F);

DT=postsr(A_no_dc);

DTRf=presr(A_no_dc);

A_end=(DT(1:((N)+((N-1)/2))));

A_beg=(DTRf(((N-1)-((N-1)/2)+1):(N-1)));

A_ok=[A_beg,A_end];

A=upsr(A_ok);

end

end

And a non-standalone subroutine for up-sampling: upsr.m

function A = upsr(x)

A_1=(x);

ANs=size(A_1);

AN=ANs(2:2);

ANH=(((AN-1)/2)+1);

zc=complex(0.0,0.0);

V1c=A_1(1:(ANH-1));

V2c=A_1((ANH):((2*ANH)-1));

Vc=[V2c,V1c];

J=ifft(Vc);

JNs=size(J);

JN=JNs(2:2);

JJ=[J,J];

d=downsample(JJ,2);

K=fft(d);

Kr=real(K);

KNs=size(Kr);

KN=KNs(2:2);

KNH=(((KN-1)/2)+1);

M1=Kr(1:(KNH));

M2=Kr((KNH+1):(KN));

M=([M2,M1]);

A=real(M);

end

Next, a potentially standalone subroutine for post-casting {postsr.m}:

function Post = postsr(x)

APo=(x);

NPos=size(APo);

NPo=NPos(2:2);

zc=complex(0.0,0.0);

FPo=fft(APo);

ZZ=zeros([1 (((NPo-1)/2))]);

ZZC=complex(ZZ,ZZ);

QN=(((NPo-1)/2)+1);

Qra=real(FPo);

Qia=imag(FPo);

Ur1a=Qra(1:(QN));

Ur2a=Qra((QN+1):((2*QN)-1));

Ura=[Ur2a,Ur1a];

Ui1a=Qia(1:(QN));

Ui2a=Qia((QN+1):((2*QN)-1));

Uia=[Ui2a,Ui1a];

G=(((2*NPo)-1)/(NPo));

Urz=G*([ZZC,Ura,ZZC]);

Uiz=G*([ZZC,Uia,ZZC]);

UNs=size(Urz);

UN=(UNs(2:2));

UNH=(((UN-1)/2)+1);

Ur1c=Urz(1:(UNH-1));

Ur2c=Urz((UNH):((2*UNH)-1));

Urc=[Ur2c,Ur1c];

Ui1c=Uiz(1:(UNH-1));

Ui2c=Uiz((UNH):((2*UNH)-1));

Uic=[Ui2c,Ui1c];

D0r=ifft(Urc);

D0i=ifft(Uic);

DNs=size(D0r);

DN=DNs(2:2);

D1r=[D0r,D0r];

D1i=[D0i,D0i];

D2r=(downsample(D1r,2));

D2i=(downsample(D1i,2));

D3r=(fft(D2r));

D3i=(fft(D2i));

D4r=real(D3r(1:DN));

D4i=real(D3i(1:DN));

D5=(D4r)+((1i)*(D4i));

D5Ns=size(D5);

D5N=D5Ns(2:2);

D5NZ=(((D5N-1)/2)+1);

D6=[zc,D5(2:(D5NZ)),zc,zc,(flip(conj(D5(2:(D5NZ)))))];

D6Ns=size(D6);

D6N=D6Ns(2:2);

D7=ifft(D6(1:(D6N)));

D8=real(D7);

Post=(D8);

end

And lastly, a potentially standalone subroutine for pre-casting {presr.m}:

function Pre = presr(x)

APr=(x);

NPrs=size(APr);

NPr=NPrs(2:2);

NNPr=(((NPr-1)/2)+1);

zc=complex(0.0,0.0);

APrF=flip(APr);

FPP=fft(APrF);

FPPr=[zc,(flip(FPP(2:NNPr))),(conj(FPP(2:NNPr)))];

APrn=ifft(FPPr);

APrnf=flip(APrn);

FPPnf=fft(APrnf);

ZZ=zeros([1 (((NPr-1)/2))]);

ZZC=complex(ZZ,ZZ);

Qra=real(FPPnf);

Qia=imag(FPPnf);

QN=(((NPr-1)/2)+1);

Ur1a=Qra(1:(QN));

Ur2a=Qra((QN+1):((2*QN)-1));

Ura=[Ur2a,Ur1a];

Ui1a=Qia(1:(QN));

Ui2a=Qia((QN+1):((2*QN)-1));

Uia=[Ui2a,Ui1a];

G=(((2*NPr)-1)/(NPr));

Urz=G*([ZZC,Ura,ZZC]);

Uiz=G*([ZZC,Uia,ZZC]);

UNs=size(Urz);

UN=(UNs(2:2));

UNH=(((UN-1)/2)+1);

Ur1c=Urz(1:(UNH-1));

Ur2c=Urz((UNH):((2*UNH)-1));

Urc=[Ur2c,Ur1c];

Ui1c=Uiz(1:(UNH-1));

Ui2c=Uiz((UNH):((2*UNH)-1));

Uic=[Ui2c,Ui1c];

D0r=ifft(Urc);

D0i=ifft(Uic);

D1r=[D0r,D0r];

D1i=[D0i,D0i];

D2r=(downsample(D1r,2));

D2i=(downsample(D1i,2));

D3r=(fft(D2r));

D3i=(fft(D2i));

D4r=real(D3r);

D4i=real(D3i);

D5=(D4r)+((1i)*(D4i));

D5Ns=size(D5);

D5N=D5Ns(2:2);

D5NZ=(((D5N-1)/2)+1);

D6=[zc,D5(2:(D5NZ)),zc,zc,(flip(conj(D5(2:(D5NZ)))))];

D6Ns=size(D6);

D6N=D6Ns(2:2);

D7=ifft(D6(1:(D6N)));

D8=real(D7);

Pre=(D8);

end