Plotting the wav file
-
Hi, I am trying to plot the wavform of wav file.In my case the wavfile consists of 6112 samples and having 8 bits per sample.byterate is 4395 bytes /s.Roughly it is equal to about 1.39 seconds of sample data.I want to plot this giving time on x axis and the sample amplitude on y axis. I am not able to normalize such that 6112 samples can be represented on the scale of 0 to 1.39 seconds.Any hints or suggestions are welcome. Regards, Mayank
-
Hi, I am trying to plot the wavform of wav file.In my case the wavfile consists of 6112 samples and having 8 bits per sample.byterate is 4395 bytes /s.Roughly it is equal to about 1.39 seconds of sample data.I want to plot this giving time on x axis and the sample amplitude on y axis. I am not able to normalize such that 6112 samples can be represented on the scale of 0 to 1.39 seconds.Any hints or suggestions are welcome. Regards, Mayank
What exactly is your problem? To calculate the X (-time) axis of the spectrum from the sample rate and the sample number? time = samplerate * sampleno
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
George Orwell, "Keep the Aspidistra Flying", Opening words -
Hi, I am trying to plot the wavform of wav file.In my case the wavfile consists of 6112 samples and having 8 bits per sample.byterate is 4395 bytes /s.Roughly it is equal to about 1.39 seconds of sample data.I want to plot this giving time on x axis and the sample amplitude on y axis. I am not able to normalize such that 6112 samples can be represented on the scale of 0 to 1.39 seconds.Any hints or suggestions are welcome. Regards, Mayank
To plot this properly you need to establish the range of values represented by each x-axis pixel and then plot a vertical line. Unless the plot area allows more than one pixel per sample. struct Plot { int y_min; int y_max; } samples_per_xaxis_pixels = number_of_samples / display_width; Plot * plot_array = new Plot[ display_width / number_of_samples ]; for(int x=0,i=0;xplot_array[i].y_max?samples_array[x]:plot_array[i].y_max; } } And then plot it !
-
To plot this properly you need to establish the range of values represented by each x-axis pixel and then plot a vertical line. Unless the plot area allows more than one pixel per sample. struct Plot { int y_min; int y_max; } samples_per_xaxis_pixels = number_of_samples / display_width; Plot * plot_array = new Plot[ display_width / number_of_samples ]; for(int x=0,i=0;xplot_array[i].y_max?samples_array[x]:plot_array[i].y_max; } } And then plot it !
Hi, Thanks for your reply.Actually in my case the samples=6112(with wach sample amplitude value between 0 and 255) and on x axis i have to represent these 6112 samples in a total of 1.39 seconds.Roughly if i divide x axis into parts of 100 ms then there are 13 such parts in which i have to divide 6112 samples,so if the display_width in the above case comes out to be 13 . Thanks and Regards, Mayank