Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions Inverse.sce
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//AU2040241 Priyanshu Pathak
clear;clc;
x = [1 2 3 4 5 6];
kx = 3;
element = x(kx);
N = length(x);
y = x;

for i=1:N
y(N-i+1) = x(i);
end
for i=1:N
if y(i)==element then
ky = i;
end,
end
printf("x(n): ");
disp(x);
printf("y(n): ");
disp(y);
printf("ky: ");
disp(ky);
//Output:

//x(n):
// 1. 2. 3. 4. 5. 6.
//y(n):
// 6. 5. 4. 3. 2. 1.
//ky:
// 4.

//x(n):
// 1. 2. 3. 4. 5. 6.
//y(n):
// 6. 5. 4. 3. 2. 1.
//ky:
// 4.
35 changes: 35 additions & 0 deletions Music-with-upsamling.sce
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// AU2040241 Priyanshu Pathak
clear; clc;
function [x, L]=Eq(x, L)
N = length(x);
y = zeros(1:L*N);
y([1:L:length(y)])= x;
endfunction
RN = 241;
fs = (RN/3) + 200; // fs = 280.333 hz
d = 0.4;
t = 0:1/11025:d;
t2 = 0:1/22050:d;
En = sin(%pi*t/d);
En2 = sin(%pi*t2/d);
fr = fs*2^(2/12);

fg = fs*2^(4/12);

Sa = En.*sin(2*%pi*fs*t);
Sa2 = En2.*sin(2*%pi*fs*t2);
Re = En.*sin(2*%pi*fr*t);
Re2 = En2.*sin(2*%pi*fr*t2);
Ga = En.*sin(2*%pi*fg*t);
Ga2 = En2.*sin(2*%pi*fg*t2);
x = [Sa Re Ga Re Sa];
z = [Sa2 Re2 Ga2 Re2 Sa2];
L = 2; //Upsampling factor
[x,L] = Eq(x,L);
sound(x);
analyze(x);
wavwrite(x, fs, 'first_wave.wav');
[x,L] = Eq(z,L);
sound(z);
analyze(z);
wavwrite(z, fs, 'second_wave.wav');