English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. General (https://eab.abime.net/forumdisplay.php?f=37)
-   -   Help: IFF 8SVX VHDR Format (https://eab.abime.net/showthread.php?t=78221)

SparkyNZ 18 May 2015 21:51

Help: IFF 8SVX VHDR Format
 
Hi. According to the docs I've found on the IFF sample format, a VHDR block should consist of the following:

Code:

ULONG oneShotHiSamples, /* # samples in the high octave 1-shot part */
          repeatHiSamples,  /* # samples in the high octave repeat part */
          samplesPerHiCycle;/* # samples/cycle in high octave, else 0  */ 
UWORD samplesPerSec;    /* data sampling rate                      */   
UBYTE ctOctave,        /* # octaves of waveforms                  */         
sCompression;    /* data compression technique used          */    Fixed
volume;

Below is a hexdump snippet of a sample I'm trying to decode.

Code:

0000(0000)  46 4f 52 4d 00 00 16 f6  38 53 56 58 56 48 44 52  FORM....8SVXVHDR
0016(0010)  00 00 00 14 00 00 16 b6  00 00 00 00 00 00 00 20  ...............
0032(0020)  20 ab 01 00 00 01 00 00  41 4e 4e 4f 00 00 00 10  .......ANNO....
0048(0030)  4f 63 74 61 4d 45 44 20  56 32 2e 31 30 00 00 00  OctaMED V2.10...
0064(0040)  42 4f 44 59 00 00 16 b6  fc f3 f4 ff 03 0d 0f 06  BODY............

When I first parsed the VHDR chunk, I got the following:
00 00 00 14 - oneshot
00 00 16 B6 - repeat
00 00 00 00 - samples/hi cycle
00 00 - ??? samples per sec (WRONG)
00 - ??? number of octaves (WRONG)
20 - ??? compression (WRONG)
20 AB 01 00 - ???? garbage (WRONG)
00 01 00 00 - Volume

The only way I could make the parsing work was to treat all values as being 32-bit aligned/packed:

00 00 00 14 - oneshot
00 00 16 B6 - repeat
00 00 00 00 - samples/hi cycle
00 00 00 20 - samples per sec (correct???)
20 AB 01 00 - 2 bytes packed into DWORD, 01=#octaves, 00=compression
00 01 00 00 - Volume

Is what I've done correct or are there other versions/formats of IFF 8SVX sample headers??

I don't think what I've done is correct - I suspect there is something missing from the documentation I have (http://amigadev.elowar.com/read/ADCD.../node02CD.html) because I cannot honestly see the samples per second being only 0x20 (32 samples per second).

Can somebody please assist? I have checked with another sample - one from the good old ST-xx disks and it had the same format header as I have shown above.

DrCinicus 18 May 2015 22:35

Hello Sparky,
the first long value after the chunk name is the chunk length.

00 00 16 b6 - oneShotHitSample
00 00 00 00 - repeat
00 00 00 20 - Sample per cycle
20 ab - samples per sec
01 - octave
00 - compression
00 01 00 00 - Volume

Bye
Fabio

SparkyNZ 18 May 2015 23:12

Quote:

Originally Posted by DrCinicus (Post 1020451)
Hello Sparky,
the first long value after the chunk name is the chunk length.

Aha! I must be getting tired. Thanks for that. I should have realised - I had the same problem with the BODY lastnight - it had the length before the data too. Excellent - may actually be able to hear one of these samples with my app now. :)


All times are GMT +2. The time now is 04:44.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.03982 seconds with 10 queries