Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 20:30 20 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Extracting information from a .WAV file

Author Message
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 1013
Posted: 07:27am 11 Apr 2022
Copy link to clipboard 
Print this post

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: Germany
Posts: 719
Posted: 09:13am 11 Apr 2022
Copy link to clipboard 
Print this post

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: Australia
Posts: 1013
Posted: 09:37am 11 Apr 2022
Copy link to clipboard 
Print this post

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 Republic
Posts: 533
Posted: 09:51am 11 Apr 2022
Copy link to clipboard 
Print this post

WAV wiki
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 1013
Posted: 05:09am 12 Apr 2022
Copy link to clipboard 
Print this post

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
Print
Print
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: Germany
Posts: 719
Posted: 08:01pm 12 Apr 2022
Copy link to clipboard 
Print this post

  OA47 said  Amnesie, if you are interesred here is what I cam up with:


This is really amazing! I definitly have use for this, thank you!
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025