There have occasionally been questions by our customers whether it would be possible to add custom comments to Ogg Vorbis files. Our ICs don't currently have direct support for this, but attached to this message is a program called OggInsert, written in standard ANSI C, which reads an Ogg Vorbis file created by VLSI Solution, then inserts some additional user comments to the headers of that file.
The example program reads from / writes to a file, but it has been written in such a way that it would be easy to modify to a streaming system.
I have provided with example files called ShortSampOrig.ogg, and ShortSampleModified.ogg, as examples of an VS10xx encoded file before and after modification. OggInsert has some debug outputs so that it would be easier to debug your port to your favourite microcontroller flavour.
When run with the provided .ogg files, the output of OggInsert looks like this:
Code: Select all
% ./ogginsert ShortSampleOrig.ogg ShortSampleModified.ogg
Comment frame:
original pageLen 56
new comments 4
new commentLen 69
new pageLen 141
Vendor length 16
Original 1 user comment(s):
User comment 0 length 20
Adding 4 new user comment(s):
User comment 0 length 20: ARTIST=Senor Coconut
User comment 1 length 18: ALBUM=Yellow Fever
User comment 2 length 17: TITLE=Bonus Track
User comment 3 length 14: TRACKNUMBER=21
% ls -la ShortSampleOrig.ogg ShortSampleModified.ogg
-rw-rw-r-- 1 leopold users 6985 Apr 12 11:03 ShortSampleOrig.ogg
-rw-rw-r-- 1 leopold users 7070 Apr 12 12:58 ShortSampleModified.ogg
Code: Select all
Opened "ShortSampleOrig.ogg"
Frame 0 @ 0, 3a B, 1 pg, _F_, fCrc 844fa422, calc 844fa422 OK
Ogg type: Vorbis
Header frame type 1: IDENTIFICATION
Vorbis version: 0, Audio channels: 2, Samplerate: 44100
Bitrate max: 0, Bitrate nominal 148000, Bitrate min 0
Block sizes 256 2048, Framing bit OK
Serial Number 12345678
Frame 1 @ 3a, 54 B, 1 pg, ___, fCrc 0f939a07, calc 0f939a07 OK
Ogg type: Vorbis
Header frame type 3: COMMENT
Vendor: "VLSI Solution Oy"
Comment 1/1: "ENCODER=VS1005 v2.00"
Frame 2 @ 8e, 4eb B, 5 pg, ___, fCrc 59cba111, calc 59cba111 OK
Ogg type: Vorbis
Header frame type 5: SETUP
Frame 3 @ 579, 1002 B, 27 pg, ___, fCrc c40c8e73, calc c40c8e73 OK
Frame 4 @ 157b, 5ce B, 2a pg, C_L, fCrc 895520bb, calc 895520bb OK
End of file
Code: Select all
Opened "ShortSampleModified.ogg"
Frame 0 @ 0, 3a B, 1 pg, _F_, fCrc 844fa422, calc 844fa422 OK
Ogg type: Vorbis
Header frame type 1: IDENTIFICATION
Vorbis version: 0, Audio channels: 2, Samplerate: 44100
Bitrate max: 0, Bitrate nominal 148000, Bitrate min 0
Block sizes 256 2048, Framing bit OK
Serial Number 12345678
Frame 1 @ 3a, a9 B, 1 pg, ___, fCrc 58d1b3b7, calc 58d1b3b7 OK
Ogg type: Vorbis
Header frame type 3: COMMENT
Vendor: "VLSI Solution Oy"
Comment 1/5: "ENCODER=VS1005 v2.00"
Comment 2/5: "ARTIST=Senor Coconut"
Comment 3/5: "ALBUM=Yellow Fever"
Comment 4/5: "TITLE=Bonus Track"
Comment 5/5: "TRACKNUMBER=21"
Frame 2 @ e3, 4eb B, 5 pg, ___, fCrc 59cba111, calc 59cba111 OK
Ogg type: Vorbis
Header frame type 5: SETUP
Frame 3 @ 5ce, 1002 B, 27 pg, ___, fCrc c40c8e73, calc c40c8e73 OK
Frame 4 @ 15d0, 5ce B, 2a pg, C_L, fCrc 895520bb, calc 895520bb OK
End of file
Kind regards,
- Henrik