how to make audio sound like continuous between each loop

in each loop i use sound(sig) , the length of sig is about o.5s, if i use pause in each loop, it may sound discontinuous ,if not pause , i think the sound may overlap, how to make it sound continuous and each sig completely played?

回答 (1 件)

Image Analyst
Image Analyst 2015 年 4 月 22 日

1 投票

Have a ramp for weights then replace the beginning and end of the signal with a weighted sum. So at the end of the signal, you have like the originalSignalAtEnd .* ramp + originalSignalAtBeginning .* (1-ramp). Then to the same to weight the beginning of the signal. I've left out the details so you can feel some pride and ownership of the code, but I think you can understand the concept. Let me know if you can't figure it out and I might help more tomorrow.

6 件のコメント

Roger
Roger 2015 年 4 月 22 日
thanks ,Image Analyst.If using pause(0.5) after sound(sig) , can it make sure the sig is played completely?
Image Analyst
Image Analyst 2015 年 4 月 22 日
Yes if the sound is 0.5 seconds long. Otherwise you might have to calculate the length of the sound and pause for that long.
By the way, I've attached my sound demo file (kind of fun).
Roger
Roger 2015 年 4 月 22 日
thanks again, i will chcek that.
Roger
Roger 2015 年 4 月 22 日
編集済み: Roger 2015 年 4 月 22 日
1 .i think it is not the signal's problem, but the pause(time) in each loop make it sound like discontinuous, cause i get each sound vector saved in one long sound vector , then i sound it not like that , it seems like continuous this time. If it is the 'pause' problem , do u know how to figure it out ?
2.The idean u showed to me ,in this loop ,the end of sound signal may be greatly different from the beginning of the signal in next loop, so we make them change gradually , like a slow slope , not a cliff, am i right ? if so , as i expressed above , taking my sound signal into consideration, they are not vary different.
Image Analyst
Image Analyst 2015 年 4 月 22 日
It seems like it's playing the sound asynchronously. If you can get the sound file to play synchronously then it won't go on to the next line of code until the sound is done and you won't need a pause. Unfortunately I don't see an option for that in soundsc(). Maybe there's a way though, that I don't know.
You're correct about #2.
Roger
Roger 2015 年 4 月 22 日
Anyway ,thanks.

サインインしてコメントする。

タグ

質問済み:

2015 年 4 月 22 日

コメント済み:

2015 年 4 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by