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:
HELP needed !!!

Subject: HELP needed !!!

From: Samar

Date: 10 Dec, 2008 16:09:03

Message: 1 of 2

Guys, I'm trying to work on the following, and I seriously need some help.. I don't even know if this is the place to ask for help .. any help is greatly appreciated ..

A wave editor that must allow the user to:
1) Input two sound files “wav” format files,
2) Play the two sound files in full independently,
3) Allow the user to select a user chosen section from either of the two files and play that section only,
4) Allow the user to join sections together to make a new sound,
5) Play the new sound,
6) Save the new edited sound to disk in “wav” format.

The problem is simple and very easy to implement in other platforms(Flash AS2 etc.)
but I'm really stuck due to my complete lack for the syntax. :(
I need it in GUI mode but I haven't even been able to do it in console mode.

All I was able to do so far is :

 [y,Fs,bits] = wavread('e:\rev.wav');
 A = audioplayer(y,Fs);
 play(A);
 pause(A);
 play(A);
 pause(A);
 resume(A);
 stop(A);
Happy that I could hardly manage to play/pause/stop

Cut a specific length of wav from ONLY beginning of the file.

in_dir = 'c:\matlab7\work\practice\';

contents = dir(in_dir);

for i = 1:length(contents)
  in_file = contents(i).name;

    if (strfind(in_file, '.wav'))

      fprintf(1, 'Trimming %s\n', in_file);

      % Read data
      [y Fs n_bits] = wavread(fullfile(in_dir, in_file));

      % Work out how many samples in 5 seconds
      n_samples = round(10*Fs);

      % Write back out to dile, with TRIMMED_ pre-pended
      wavwrite(y(1:n_samples), Fs, n_bits, fullfile(in_dir, sprintf('TRIMMED_%s', in_file)));

    end
end



and a browse and save file ..


[filename, pathname, filterindex] = uigetfile('*.m', 'Open a file');
[FileName,PathName,FilterIndex] = uiputfile('*.wav', 'Save');

Subject: HELP needed !!!

From: Dave Brackett

Date: 15 Dec, 2008 13:12:01

Message: 2 of 2

"Samar " <xtatic_uforia@hotmail.com> wrote in message <ghopiv$akn$1@fred.mathworks.com>...
> Guys, I'm trying to work on the following, and I seriously need some help.. I don't even know if this is the place to ask for help .. any help is greatly appreciated ..
>
> A wave editor that must allow the user to:
> 1) Input two sound files “wav” format files,
> 2) Play the two sound files in full independently,
> 3) Allow the user to select a user chosen section from either of the two files and play that section only,
> 4) Allow the user to join sections together to make a new sound,
> 5) Play the new sound,
> 6) Save the new edited sound to disk in “wav” format.
>
> The problem is simple and very easy to implement in other platforms(Flash AS2 etc.)
> but I'm really stuck due to my complete lack for the syntax. :(
> I need it in GUI mode but I haven't even been able to do it in console mode.
>
> All I was able to do so far is :
>
> [y,Fs,bits] = wavread('e:\rev.wav');
> A = audioplayer(y,Fs);
> play(A);
> pause(A);
> play(A);
> pause(A);
> resume(A);
> stop(A);
> Happy that I could hardly manage to play/pause/stop
>
> Cut a specific length of wav from ONLY beginning of the file.
>
> in_dir = 'c:\matlab7\work\practice\';
>
> contents = dir(in_dir);
>
> for i = 1:length(contents)
> in_file = contents(i).name;
>
> if (strfind(in_file, '.wav'))
>
> fprintf(1, 'Trimming %s\n', in_file);
>
> % Read data
> [y Fs n_bits] = wavread(fullfile(in_dir, in_file));
>
> % Work out how many samples in 5 seconds
> n_samples = round(10*Fs);
>
> % Write back out to dile, with TRIMMED_ pre-pended
> wavwrite(y(1:n_samples), Fs, n_bits, fullfile(in_dir, sprintf('TRIMMED_%s', in_file)));
>
> end
> end
>
>
>
> and a browse and save file ..
>
>
> [filename, pathname, filterindex] = uigetfile('*.m', 'Open a file');
> [FileName,PathName,FilterIndex] = uiputfile('*.wav', 'Save');

Maybe this code on the file exchange can help you as it claims to do a similar thing:
http://www.mathworks.com/matlabcentral/fileexchange/22082

Tags for this Thread

No tags are associated with 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