Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
wavread and wavplay

Subject: wavread and wavplay

From: Ashwini Deshpande

Date: 4 Dec, 2008 07:50:22

Message: 1 of 5

Hi,

I have 2 sound files in .wav format. I need to run those two files.
When i am playing first sound file, if i want to stop it and want to play the second, what do i do??

Just have look at the following:
[y, Fs] = wavread('F:\sound_1.wav');
[y1, Fs1] = wavread('F:\sound_2.wav');
wavplay(y,Fs,'async') ;
wavplay(y1,Fs1,'async') ;

Here, 1st sound file which is running has to be stopped as soon i execute the 4th line code.

Any help would be greatly appreciated ..

Ashwini

Subject: wavread and wavplay

From: Denis

Date: 4 Dec, 2008 10:14:02

Message: 2 of 5

"Ashwini Deshpande" <vd.ashwini@mathworks.com> wrote in message <gh823u$fev$1@fred.mathworks.com>...
> Hi,
>
> I have 2 sound files in .wav format. I need to run those two files.
> When i am playing first sound file, if i want to stop it and want to play the second, what do i do??
>
> Just have look at the following:
> [y, Fs] = wavread('F:\sound_1.wav');
> [y1, Fs1] = wavread('F:\sound_2.wav');
> wavplay(y,Fs,'async') ;
> wavplay(y1,Fs1,'async') ;
>
> Here, 1st sound file which is running has to be stopped as soon i execute the 4th line code.
>
> Any help would be greatly appreciated ..
>
> Ashwini


The problem is that you put a whole block of data into y and y1.
Lets say it is a 2min Track then it need 2min till it will finished. To solve this problem, you have to write an m-file wich puts only small blocks into y and y1 and everytime time the data is done, refill/put again the y or y1.

Hope that helps a bit.

Subject: wavread and wavplay

From: Dave Brackett

Date: 4 Dec, 2008 10:19:02

Message: 3 of 5

"Ashwini Deshpande" <vd.ashwini@mathworks.com> wrote in message <gh823u$fev$1@fred.mathworks.com>...
> Hi,
>
> I have 2 sound files in .wav format. I need to run those two files.
> When i am playing first sound file, if i want to stop it and want to play the second, what do i do??
>
> Just have look at the following:
> [y, Fs] = wavread('F:\sound_1.wav');
> [y1, Fs1] = wavread('F:\sound_2.wav');
> wavplay(y,Fs,'async') ;
> wavplay(y1,Fs1,'async') ;
>
> Here, 1st sound file which is running has to be stopped as soon i execute the 4th line code.
>
> Any help would be greatly appreciated ..
>
> Ashwini


try slipping in a 'clear playsnd' statement before you want to play the second sound.

Subject: wavread and wavplay

From: Denis

Date: 4 Dec, 2008 10:20:16

Message: 4 of 5

see this thread for a possible solution:

http://www.mathworks.com/matlabcentral/newsreader/view_thread/240412

greetings
Denis

Subject: wavread and wavplay

From: Ashwini Deshpande

Date: 4 Dec, 2008 10:47:01

Message: 5 of 5

"Denis " <dzone@gmx.de> wrote in message <gh8at0$77s$1@fred.mathworks.com>...
> see this thread for a possible solution:
>
> http://www.mathworks.com/matlabcentral/newsreader/view_thread/240412
>
> greetings
> Denis


Thank u very much ....

Its working fine !!!!!!

Ashwini

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us