Audio Scrambler code to create unintelligent audio

The code i created is below
stars = audioread('stars.mp3');
Mono = (stars(:,1)+stars(:,2))/2;
fs = 44100;
frame_duration = 0.1;
frame_len = frame_duration*fs;
N = length(Mono);
num_frames = floor(N/frame_len);
frames = cell(num_frames,1);
for k = 1 : num_frames
frames{k} = Mono( (k-1)*frame_len + 1 : frame_len*k);
end
scramble = [(frames{4});(frames{6});(frames{5});(frames{1});(frames{3});(frames{2});(frames{7});(frames{8});(frames{9});(frames{10});
(frames{14});(frames{15});(frames{16});(frames{11});(frames{12});(frames{13});(frames{17});(frames{18});(frames{19});(frames{20});
(frames{24});(frames{25});(frames{26});(frames{21});(frames{22});(frames{23});(frames{27});(frames{28});(frames{29});(frames{30});
(frames{34});(frames{35});(frames{36});(frames{31});(frames{32});(frames{33});(frames{37});(frames{38});(frames{39});(frames{40});
(frames{44});(frames{45});(frames{46});(frames{41});(frames{42});(frames{43});(frames{47});(frames{48});(frames{49});(frames{50});
(frames{54});(frames{55});(frames{56});(frames{51});(frames{52});(frames{53});(frames{57});(frames{58});(frames{59});(frames{60});
(frames{64});(frames{65});(frames{66});(frames{61});(frames{62});(frames{63});(frames{67});(frames{68});(frames{69});(frames{70});
(frames{74});(frames{75});(frames{76});(frames{71});(frames{72});(frames{73});(frames{77});(frames{78});(frames{79});(frames{80});
(frames{84});(frames{85});(frames{86});(frames{81});(frames{82});(frames{83});(frames{87});(frames{88});(frames{89});(frames{90});
(frames{94});(frames{95});(frames{96});(frames{91});(frames{92});(frames{93});(frames{97});(frames{98});(frames{99});(frames{100});
(frames{104});(frames{105});(frames{106});(frames{101});(frames{102});(frames{103});(frames{107})];
sound(scramble,44100)
the code works fine but the thing is i want to give the frames an order to skip the typing of the order of the scramble, Do you think i can use a for loop or something to order it properly so that i can reorder it easily to get the original signal from my scramble audio?
Please help,
Thanks
Thanks.

Réponses (1)

order = [4, 6, 5, 1, 3, 2, 7, 8, 9, ....];
scamble = vertcat( frames{order} );

1 commentaire

Thanks a lot, If i want to use with the random generator how can i do that?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Code Generation and Deployment dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by