Wednesday, December 31, 2014

Sound Mixture

                                                      Sound Mixture


The first program is related to basic signal processing. It has three different sound files like drum.wav, guitar.wav and bass.wav. In this project, first we will listen all three files in its originality. Then we will take the part of these sound files (from 10th seconds upto 20th second). I tried to incorporate two features here, first i tried to combine all the individual files into single and play all drum, guitar and bass together. Second, I tried to increase and decrease the level of individual file (like i want to increase the bass level and to decrease guitar level and want to keep drum level as it is) and then combined all modified files and then played it. Following is the step by step process to do.


Step 1: First we will read the sound files into Matlab (Sound files are of more than 1 minute)


[Bass, bass_Fs] = wavread ('G:\Second Semester\Pattern Recognition\sound\bass.wav');
[Guit, guit_Fs] = wavread ('G:\Second Semester\Pattern Recognition\sound\ guitar.wav');
[Drums, drums_Fs] = wavread ('G:\Second Semester\Pattern Recognition\sound \ drums.wav');
       
                                                      
Bass.wav

Guitar.wav


Drum.wav


Click below links to download Original Sound files

                                                                1-Bass
                                                                2-Guitar
                                                                3-Drum


Step 2 : I will create 1 frame(of 10 seconds) for each of these sound files and create it .wav file.

drum_seg = drums(drums_Fs*10 : drums_Fs*20);
wavwrite(drum_seg,drums_Fs,16,'drums_frame');

guit_seg = guit(guit_Fs*10 : guit_Fs*20);
wavwrite(guit_seg,guit_Fs,16,'guit_frame');

bass_seg = bass(bass_Fs*10 : bass_Fs*20);
wavwrite(bass_seg,bass_Fs,16,'bass_frame');

Fs = bass_seg = guit_seg = bass_seg;

Step 3 : Play Individual frame files by asking choice from the user.

prompt = 'what to play? Press '1' for drum, '2' for guitar, '3' for bass press '0' to end';
result = input(prompt);
while(result ~= 0)
if(result == 1)
      
        sound(drum_seg,drums_Fs);
  
elseif (result == 2)
      
        sound(guit_seg,guit_Fs);
  
elseif (result == 3)
      
        sound(bass_seg,bass_Fs);
end
prompt = 'what to play? 1 for drum, 2 for guitar, 3 for bass press 0 to end';
result = input(prompt);

end
Click below links to listen download generated 10 second frame.

1-Brass_frame
2-Guitar_frame
3-Drum_frame


Step 4 : Play all three sound frames ( drum, guitar, bass) together) is my first feature.

prompt = 'want to play all together? 1 for yes, 2 for no';
result = input(prompt);
if(result == 1)
    comp = drum_seg + guit_seg + bass_seg;
    sound(comp, Fs);
elseif (result == 2)
    disp(' ok no problem ');

end


Combined_Sound_Mixture


Click below links listen sound frames combined together.
Listen : Combine_sound_Mixture


Step 5 :  Increase or Decrease the level of sound files and play all together to feel different effect is my second feature.

prompt = 'want to increase bass or drum or guitar ? 1 for drum , 2 for guitar, 3 for bass';
result = input(prompt);
if(result == 1)
        prompt = 'howmuch to increase? enter x meanse x times';
        inc = input(prompt);
        drum_seg = drum_seg*inc;
elseif(result == 2)
        prompt = 'howmuch to increase? enter x meanse x times';
        inc = input(prompt);
        guit_seg = guit_seg*inc;
  
elseif (result == 3)
       prompt = 'howmuch to increase? enter x meanse x times';
       inc = input(prompt);
       bass_seg = bass_seg*inc;
end

prompt = 'want to decrease bass or drum or guitar ? 1 for drum , 2 for guitar, 3 for bass';
result = input(prompt);
if(result == 1)
        prompt = 'howmuch to increase? enter x meanse x times';
        dec = input(prompt);
        drum_seg = drum_seg*dec;
elseif(result == 2)
        prompt = 'howmuch to increase? enter x meanse x times';
        dec = input(prompt);
        guit_seg = guit_seg*dec;
  
elseif (result == 3)
       prompt = 'howmuch to increase? enter x meanse x times';
       dec = input(prompt);
       bass_seg = bass_seg*dec;

end

comp = drum_seg + guit_seg + bass_seg;
plot(comp);
sound(comp, Fs);

Click below to listen Sound_Mixture file in which bass level is increased 5 times and guitar level is decreased by 0.3 times.

1-Sound_Mixture_Effect












No comments: