This code has been declared by its author to be Public Domain code.
Download source code | WAV Examiner by schilcote | 2010 |
| |
|
I wrote this to help me understand the WAV format. They're incredibly simple, in fact. All a .WAV file is is a long series of integers representing the amplitude (voltage running to speakers) of the wave at any given point. Simple, isn't it? |
file$=RequestFile$("Choose a WAV file","wav",False)
Graphics 800,600
fil=OpenFile(file$)
While Not Eof(fil)
num=ReadInt(fil)
Print num
oldy=y
y=num/10000000+200
Plot (x,y)
Line(x-1,oldy,x,y)
Flip
x=x+1
If x>800 Then
Cls
x=0
EndIf
Wend
WaitKey
End |
Comments |
That's not right. RIFF WAVE is an audio container format. (in a media container format) It is possible - although rarely done - to compress the audio data of a *.wav file. (It is also possible to use the "mp3 compression".) But even if your file is uncompressed your code doesn't work correctly, because most audio files use 8 or 16 bit per sample - you read 32 bits at once - and because every *.wav file has got a header. (You start reading at the first byte.)
|
|
Where is the check for quality etc, as has been said the header is the key to everything without it your just reading a binary file.
|
|
Well, I was reading from a random PCM .wav file that I had lying around. The basic idea is just to show how the PCM format was represented.
|
|
What does requestfile$ () do?
|
|
What does requestfile$ () do?
It's not used in blitz3d.
|
Code Archives Forum