|
Forum Index : Microcontroller and PC projects : Extracting information from a .WAV file
| Author | Message | ||||
| OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 1013 |
Does anyone have an idea on how I could extract the Artist name and other info from a WAV file before it is played on a mite. I noticed that the information is apparent on the first line when you open the file with NOTEPAD but not sure how I would extract it. OA47 |
||||
| Amnesie Guru Joined: 30/06/2020 Location: GermanyPosts: 719 |
This is a really good question and it would be interesting to exctract them somehow for some kind of audioplayer application. |
||||
| OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 1013 |
I was wondering if I read the file in for the first 100 odd bytes and gather the text. It seems that the initial string is "RIFFžQÖWAVELISTÐ INFOIART" Artist name is followed by "INAM" which is followed by Track title proceeds "IRPD" which is the Album name and "IGNR" followed by the Genres. OA47 |
||||
| jirsoft Guru Joined: 18/09/2020 Location: Czech RepublicPosts: 533 |
WAV wiki Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
| OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 1013 |
Amnesie, if you are interesred here is what I cam up with: 'Program to extract .wav file info and play Option EXPLICIT Dim I,PNTR1,PNTR2,PNTR3,PNTR4,PNTR5 Dim INFO$ LENGTH 140 Dim A$ LENGTH 1 Dim DLIM$, ARTIST$, TRACK$, ALBUM$, GENRES$, FILENAME$ Input "ENTER THE WAV FILE PATH AND NAME";FILENAME$ Open FILENAME$ For INPUT As #1 INFO$= Input$(140, #1) Close #1 For I= 1 To Len(INFO$) DLIM$=Mid$(INFO$,I,3) If DLIM$="INF" Then PNTR1=I 'FOUND FIRST POINTER IN STRING If DLIM$="INA" Then '2ND POINTER FOLLOWS ARTIST NAME PNTR2=I ARTIST$=Mid$(INFO$,PNTR1+8,PNTR2-PNTR1-8) Print "ARTIST ";ARTIST$ EndIf If DLIM$="IPR" Then '3RD POINTER FOLLOWS TRACK NAME PNTR3=I TRACK$=Mid$(INFO$,PNTR2+4,PNTR3-PNTR2-4) Print "TRACK ";TRACK$ EndIf If DLIM$="IGN" Then '4TH POINTER FOLLOWS ALBUM NAME PNTR4=I ALBUM$=Mid$(INFO$,PNTR3+5,PNTR4-PNTR3-5) Print "ALBUM ";ALBUM$ EndIf If DLIM$="ITO" Then '5TH POINTER FOLLOWS GENRES TYPE PNTR5=I GENRES$=Mid$(INFO$,PNTR4+4,PNTR5-PNTR4-4) Print "GENRES ";GENRES$ EndIf Next I Play WAV FILENAME$ OA47 |
||||
| Amnesie Guru Joined: 30/06/2020 Location: GermanyPosts: 719 |
This is really amazing! I definitly have use for this, thank you! |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |