# Matlab Help, Digital Audio Watermarking

#### Ron_7

Joined Dec 18, 2006
8
Hello Guys

i'm am currently working on implementing Ricardo A. Garcia's algorithm for digital audio watermarking using a pyschoacoustic auditory model and spread spectrum for generating the watermark.

so far i have implement the auditory model and am now onto generating the watermark. however i have come to a issue wich i hope some one has the answer to.

i need to create a pseudorandom (PN) binary sequence of length 3000. Can anyone help me implement this please?

Ron

#### Dave

Joined Nov 17, 2003
6,970
i need to create a pseudorandom (PN) binary sequence of length 3000. Can anyone help me implement this please?
Can I be clear here?

Are you trying to generate a binary sequency 3000 bits long? Or are you trying to generate a number up to (from 1 to) 3000, which can then be converted to a binary representation (requires 12-bits)?

Dave

#### Ron_7

Joined Dec 18, 2006
8
hi

i'm trying to generate a binary sequence of 1s ands -1s upto length 3000.

#### Dave

Joined Nov 17, 2003
6,970
Seems strange that you are looking to generate a binary sequence of 1 and -1, should it be 1 and 0?

Either way you could look at the following method using the rand function and thresholding the answer:

Rich (BB code):
rand_arr = rand(3000,1);
rand_seq = ones(3000,1);

for n = 1:3000
t = rand_arr(n,1);
if t < 0.5
rand_seq(n,1) = -1;
end
end
This will generate a 3000x1 array of random digits that are either 1 or -1. You can change the thresholding which is currently 0.5. You can then look at manipulating the array as required.

Dave

#### mustafa_i

Joined May 9, 2007
2
u can use normrnd() function

#### Dave

Joined Nov 17, 2003
6,970
u can use normrnd() function
That requires the Statistics Toolbox.

Dave