Analysis and modification of sound wave using Matlab GUI Bryant Tober - [email protected] ABSTRACT The goal of the project was to provide an easy to use program that allowed the user to load a sound file and analyze it. Analysis was achieved by plotting both the original sound wave and a plot of the sound wave once it had been modified. To modify the sound wave, options for applying a low filter to suppress sound above a given frequency and applying a high filter to suppress sounds below a given frequency. The modified plot was plotted next to the original so that comparison could be done. There were also options to reverse both the plot and the audio of the sound wave, as well as adjusting the play back speed. Toolbar functions such as zoom in, zoom out and data cursor allowed the user to take a closer look at the data presented in the plot. The program allows user to begin to analyze sound waves and listen to modified sound in hopes that the user will be able to gain insight into the sound data they have recorded. PROBLEM DESCRIPTION There aren’t many computer programs out there, at least not free ones, which allow a user to analyze a clip of sound. This sound can come from a variety of sources. It could be from a particular species of animal or it could be from the heart of a new born child. Just as there are nearly infinite sources of sound, there are just as many reasons why a person would be interested in analyzing a sound. Often times listening to the sound file is not a problem due to mass market programs such as iTunes. Viewing a visual representation of the actual sound poses a problem, as does utilizing different filters to select for particular frequencies found in the sound. Looking at a graphical representation of a sound wave after it has been filtered and listening to that same sound wave can help researchers gain insight that would otherwise be lost in the noise. METHODS After deducing the interest of a study is, the next step is acquiring a sound file. This must be saved in a .wav extension format. The sound file can come from any source and is recorded using any of the modern day recording devices. After securing a valid sound file, the next step is to utilize the function, “SoundWave.” This functions contains all of the functions needed to set up the GUI, view plots of the sound wave, listen to the sound wave, and apply modifications to further study the sound wave. The GUI has been set up for optimal utilization by the user and is simply enough so that anyone can use the function without previous experience. The only area where users may need previous experience is setting the values for either the low or high filter. This is not necessary for a more casual user since after a short period of trial and error the user will figure out the frequency boundaries of the data. After the function has been opened, the first step is to load the .wav file. This can be done simply by clicking on the “Load File” button in the upper left corner of the GUI. This opens a separate window in which a user may select a file. Upon selecting a file, the program will automatically display a plot of the sound wave in the two existing plots. By default, the “Modified Wave” will display the same wave as the “Original Wave.” The play, pause, etc. functions for both plots will, initially, play the same thing since the same data is loaded into each. After the file is successfully loaded, there are many different routes the user may take. They may choose to listen to the file in order to grasp what the unmodified file sounds like. Another route is to use the zoom options, hand, and data cursor to further grasp the plot of the sound wave. Each of these plot functions can be found in the top left portion of the GUI and provide useful tools in perceiving the visual representation of the sound wave as well as comparing unmodified sound waves to their modified counterpart. Modifications that can be applied to the sound wave are found in the lower section of the GUI. This include two input box and corresponding buttons that allow the user to apply a low and high butterworth filter to the data, as well as an option to play and plot the sound wave backwards, and change the speed at which the sound wave is played. The keystone feature of the SoundWave program is the filters. The “Low” filter serves to suppress all frequencies that are higher than the value specified. An important side note, throughout the program frequencies are given in units of Hz. The “High” filter serves to suppress all frequencies lower than the specified value. To use these two buttons, the user simply has to enter a value into the corresponding box, found to the right of the button of interest, and click the corresponding button. Depending on the complexity and duration of the sound file, the program may take a few moments, but within a short amount of a plot of the new sound wave will be presented in the plot under “Modified Wave.” The filter will also be applied to the audio component of the sound wave and can be heard by using the play, pause, etc. buttons under “Modified Wave.” Users may have certain frequencies in mind that they can adjust in the “Filters” panel. In the chance that they don’t, it is easy to play around with a few different numbers to obtain a range of values that work with their data. A good range to start is around 400 Hz for the low filter and 2200 Hz for the high filter. While the two options for filters are the basis of the SoundWave program, there are two other modifications that can be utilized. The first is the speed multiplier. This can be found in the popup menu. There are various options for the user to choose. These range from reducing the speed at which the sound file is played by 2.5 times and increasing it by 2 times. One thing to note is that changing the speed also changes the pitch. The corrections needed to compensate for this change are outside the scope of this program and leaves a great angle for future work. The final modification is a simple one. This can be found under the “Speed Multiplier” popup box and is titled “Backwards?.” This check box enables the user to view and play the sound file in reverse. While not clearly important in a biological aspect, there may be unique cases when this simply option may prove useful, even in cases of seeing if a popular classic rock song really does contain satanic words if played backwards. From here, users can choose to repeat the various steps listed above to do further analysis of the sound wave or load another file to perform these modifications again. RESULTS The program, SoundWave does not do extensive analysis of the data. It more so allows the user to filter the data and have more control over the analysis themselves. There are two plots in the program that allow the user to analyze a visual representation of the sound wave. The first, plots an unaltered sound wave and the second plots the sound wave after various modifications have been applied. The first figure represents an example of a simple unaltered sound wave. The second figure shown represents an example of a modified sound wave. To demonstrate the modifications possible through the use of the program, a low filter set to a value of 600 Hz has been applied, as well as the backwards option. The same source sound file is plotted in both; just the filters have been applied to the second. The third figure shows an example of how the user can use the zoom function and the data cursor button in the toolbar to better analyze the graphical sound wave. In this example, the zoom in function was use to yield a magnification of 4 times. CONCLUSION The SoundWave program provides a simple way for users to have sound wave analysis at their fingertips and all contained in one easy to use interface. Before this, there were not many easily accessible programs that allowed the user to do basic analysis of sound waves. The application of filters to sound waves has also been made more accessible to the user as well. While the SoundWave program gives users some tools to perform analysis on sound waves, it is merely a stepping stone. There are many other ways in which it could be improved to provide users with an extremely powerful and extremely useful tool in their quest to better understand a particular sound file. For starters, the addition of filter that allows the user to select a lower and upper boundary for frequencies so that middle frequencies could be more clearly studied. This would give the user a more complete set of filters and further enhance sound wave analysis. Another addition to add that deals with the modifications would be to adjust the speed multiplier so that it does not affect the pitch as much. This may be very difficult to set up so that it works with each sound file and possibly an issue that is in general unsolvable. If it was possible, it would create a more complete program. A third addition would be the option to compare the plots of multiple sound waves at a time. Currently the program only allows the user to deal with one sound file at a time and often times comparing multiple waves better fits the interest of the user. Something else that would prove extremely useful would be to track the wave plot in real time to the sound. Doing this would allow the user to match up a certain point in the plot with what is going on with the audio. Finally, two additions that would increase the functionality of the program would be to add a recording feature and the ability to clip a sound file. Incorporating a recording option would allow the program to become essentially an all-in-one system for sound analysis. The user could record the sound using the program and then be directly able to look at the sound wave and play the audio back. The addition of a clip feature would be useful in times when the user is only interested in a particular part of the sound file. APENDIX All of the functions that the SoundWave program uses are built into the GUI function. The following is a list of each function and a brief description of its importance to the program. Load_Callback – executes when the load file button is pressed. Loads the file into matlab and creates the data set. Plots the unaltered sound wave in each axes. Play_Callback – executes when play button under original wave is pressed. Plays the original sound wave and sets up an error box that pops up if the play button is pressed at the wrong time. Stop, pause, and resume do just what their title suggests as well as displaying error boxes similar to the one from play. Pushbutton7, 8, 9, and 10 are the same play, stop, pause, and resume processes as seen in the ones that corresponded to the original wave except these deal with the modified wave. Popupmenu1 – uses a switch to set up a series of options for the user to select. Selected number corresponds to the speed factor that increases or decreases play speed. The radiobutton functions were left over from a previous method of applying filters that did not work out. Lowb_Callback – sets up the low butterworth filter Highb_Callback – sets up the high butterworth filter Checkbox2_Callback – sets up the check box that allows the user to view and play the sound file backwards.
© Copyright 2026 Paperzz