Mar-01-2017, 04:31 PM
Going back to a thread about .wav files (https://python-forum.io/Thread-From-theory-to-practice) it was brought up that some files contain additional information above that provided for in the original format. I thought I would try and account for the 'extras'. I thought I would start by checking the file for the word "data" and found this solution on SO which seems to work in determining if it exists or not.
The problem I can't seem to grasp is how to determine the offset (or where the text begins) in the file. For instance, I know in my test file, the word "data" begins at dec 36, hex 0x24.
I've searched the Google and can't seem to find anything. So I'm wondering if anyone has any suggestions as to where I might start looking.
Thanks
import mmap with open('SineWave_440HZ.wav', 'rb', 0) as file, \ mmap.mmap(file.fileno(), 0, access=mmap.ACCESS_READ) as s: if s.find(b'data') != -1: print('true')
I've searched the Google and can't seem to find anything. So I'm wondering if anyone has any suggestions as to where I might start looking.
Thanks