Click here to Skip to main content
15,891,902 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi

I have two signals first is input signal and others is noise signal I mixed two signals and got a signal, now I want play this signal with sound() function and I need frequency of it to play, how can I get the frequency of last signal that is a mixed signal?

as more information my code is like below:

[mainsigal, fs]=wavread('mainsignal.wav');
[noisesignal, fs1]=wavread('noisesignal.wav');%traffic signal
s=mainsignal(:,1);
n=noisesignal(:,1);
l_s=length(s);
for I=1:l_s
h(I)=s(I)+n(I);
end
sound(h,?????);
now I need compute fs for h signal.




thanks
Posted
Updated 23-Jan-15 4:59am
v3

1 solution

Quote:
how can I get the frequency of last signal that is a mixed signal?
You just need the sampling frequency of the original signal.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 22-Jan-15 12:11pm    
Why sampling? Why original? Both signals equally contribute. The problem is not about sampling frequency at all.
Please see my answer.
—SA
CPallini 22-Jan-15 12:29pm    
Because the OP has a signal of known frequency?
If you mix a sampled signal with white noise then you already know the 'sampling frequency' (that is the parameter requested by the sound function).
That has almost nothing to do with signal frequency (and hence with spectral analysis).
Sergey Alexandrovich Kryukov 22-Jan-15 12:48pm    
Right, but the sampling frequency is not the only frequency involved. From the context of the question, it is even pretty much irrelevant. If you generate 440Hz la as a musical tone, the frequency of interest is that 440Hz, not much higher sampling.
—SA
CPallini 22-Jan-15 12:57pm    
Well, if you want to play the signal using the sound function (like the OP asked), you have to provide the sampling frequency.
Sergey Alexandrovich Kryukov 22-Jan-15 14:10pm    
So what? Consider this problem is already solved and address to the real problem. I already told you that I answered.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900