Instantly share code, notes, and snippets.

@hak7a3 /sound.pdf
Last active Dec 9, 2017

Embed
What would you like to do?
Merry X'mas
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
\documentclass{article}
\begin{document}
Merry X'mas
%% Embeded MIDI sound
\immediate \pdfobj stream {\pdfunescapehex{%
4D546864% header start
00000006% header size (currently, 6 only)
0001% format
0002% #track
01E0% delta time
%% track 1 (meta data)
4D54726B% track start
0000000B% size of data
00 FF 51 03 03 D0 90% delta time 0, tempo to 130
00FF2F00% delta time 0, end of track
%% track 2 (audio data)
4D54726B% track start
00000052% size of data 13 * 4 + 10 * 3 = 82
%-----------------------------------------------------
0090407F% delta time 0, channel 0 note on, 40 with volume 7f
83604000% delta time 30, channel 0 note off(ommited), 40
00407F%
83604000%
00407F%
87404000%
00407F%
83604000%
00407F%
83604000%
00407F%
87404000%
00407F%
83604000%
00437F%
83604300%
003C7F%
85503C00%
003E7F%
81703E00%
00407F%
96404000%
00FF2F00% delta time 0, end of track
}}%
%% add file attachment annotation
\pdfannot width 1em height 1.7ex depth 0.3ex {
/Subtype /FileAttachment
/FS <<
/EF << /F \the\pdflastobj\space 0 R >>
/F (attach.mid)
/Type /Filespec
>>
}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment