TodePond / DreamBerd

perfect programming language
https://dreamberd.computer
Other
11.46k stars 359 forks source link

NVPP: Human Friendly File Formats - DRAFT #153

Open labbo-lab opened 1 year ago

labbo-lab commented 1 year ago

Not Very Professional Proposal:

Human Friendly File Formats

While DreamBerd already supports files, along with file names within a single file, however as it stands, most non-text file formats commonly used would be an eyesore when used in this way:

a standard .png file as text ``` ======= w3c_home.png ======= �PNG  IHDRH0=���gAMA�� �a�IDATx��Z}lSU?1{�t3�b�(��n "a4iX��j��8 ���1Jg��8�Q�3tQ�(h ��C�K ^��R���B��M�&nC�no��hGX�_�ǹ�����s��W�G����=h&�?h& �,�'��,�"a``�d2�L�G�c,˚L&$oذ��8��`��Gmm���X~~~(���GG�!�����l64�3���p�o!��pN�"m*u�`��[<4��O:}��� !9���3����Ce�q\NN �V�eY�f�i�Z��؍`x���5���Σn���| [w���6���?�o� o�q\uuuKK �0EEEv�]�ѠS<� ���.8s� �q�W<��ڵ����N(��i3�S��u�>8[���2�~쑱��޾=VB8����ܖ��D"����r:��l]]��˗��� ˲,�644TVV*�X履�—��HNM�r��T��M�ޣ��g�����+Rfm��������W���_�9�����loo����f͊D"���F�QT-�<��fc9:2�j/Ϟ���P�F0,e�9P���^��a6��4���jjj"�\�~]J-F̠W��v��U��:�<4KD�`����Í+������U+H����]N����u:���ۭV�J�����}���x��A�CD_�"m�������!����?��ۋ)���/`95e ����������յcǎ�{�vvv���&HEE�B�5(b�C�{y�H�=# �m?���a�Ix��i*��̪���R(.� qc���B��1�p~�����^@�cÊ,�����x83=�����u��Y$�����0\.�N��wP�iSdƴ�S�#0%�u�|qG��ɶ�"y�O�y����8$��v)�].���@�m�X0��œh��4�^%��LO��fĔ�A�Z�����yq1w��]���B���Ȼ �ĨL�~��CQja �R����%r��� 4hhhd�]���ek3����J��;�db0d�^�����Wn�a�Q�V����O���tI�\��t�q:8�����.�|�QO`eE�h�R�FZB�#㇌4����������X��U��髤'�_�������W�Z�q��&4v��7�-\����3&c�|AFF�,x�3�M��/�7�B��|=8M/�T��iˆ�R �`�+���я\Ql�/b��w�1�e��r��l�^I� g�.E��РWV���~�Zw�"gitd��ĝU{b=F�lh����Fi�\���EGF�� �C%z��z�i�j�.G4�}�&NL�L#����xꧦL�k.i��� dI�N��R��f��xHn�&�܍7��`�/��LR�KӻYjb�����5�.v<;A�a�����L�H�:��sI~���HF�� �W�W�8��\Qb�K���.%L�6��p$s!��lN��!��� iP��'���yy��%�ܢ��x��h4VWW˘��p8|>���R��!�qIN����&�vL~�&7N�M��R���T��pNz�SEYYYj�Zt��q\MM �� z����K�}I��""7��z�B�cG��(�5��j�X,�1*�q���d�q3K�:�!�X�����h����
or for audio files: (truncated for brevity) ```----- sample-3s ----- ID3#TSSELavf57.83.100��PInfo|�B #&(*.0248:<>BDFHKOQSUY[]_ceginprtxz|~��������������������������������������������������Lavc57.10$@�B^P�X���d;#�0� ���Y���4�<�C`LG?��R�,YK�!�� �dɧv@�w��0� ��@�9 B ����X>���0}�� `�>���!���A�@�>���h $�����,�`"���x�������4(1���>����;��L�s�b�!䆠�"��hԓ�&�Gk���� P[�g'�/��d��*��W\�-/�+z�I[4���'��[�fh����8�7Ƶӌ���f,!*�l�vI�������\�[����Yq z�� G�����?�lE��m�����Z�wLÚI�����0������R �f&�a˹�e�I�jKs�K���� @D�� 0XhxA�Q�-I�J ]��Vb⢮���d ��`V�i ��_X�UH4��#l���J�F���AbŊ�������MSwKSj����|\F�4����w����|���R�cw, F+���2t[k0R�z��\���k՞��KR���µC���Ұ�4����7F�%������u�+���`�v�Δ.�Hb� �;g!{j�[w�v����$"x)�-�Z�E��~�x�^O��8\��FLT)T9b|ĥG�����>� �[!h�R�2��� UJo9=Q�8ב�e��5-��vB��ӟ�h� �fpC���bC����u&0��jfJut;QJl�u,`d@Pd ��]�R���E� E�~��+’�Ãt���Q��Xe�s�ʹ~@D���7Qr��������dc���B��)� mT-��4����5B)]�?�ٵ�1�b��[N���fв��b��̨��$�äR��ޅEi kW��A��yV�2e+�� �N �{͐� �1i^��+�WU�Tuh�pz���%P������p`D�?����ۥm��C��KhYu����fY�-��rR��r��x s��k)r�Co�xõK\�^�[��F:ϯ��U��-w�K���/yx��O���=&*r%���% -��eF}�Cm� ���F�A��5����{��f�[u&h`��[���r��_��;�����~�ww��s_�b�����JLAME3.100������������������NJ����N< ^q���!�X���K�8i����n0%$a�r�اT�g���‰�E��H �J_Lv���d��� AԳOB� @�X̰�4�k�'�Y�I��O7�S�~��`��ܾ����R�AH��:��N37y��� W����Ms�kZ�Ng�ƐmC�x��/-x�� )ַPAl�+ !�/�rni��E�'� a�q��j���do}ި�x�ä�q�5!a�i&`8y��r�Df��s%<���\��[�B���R� �{V$P� �� �(EiP�BQ� �#X;4�d��&dX�*k�C�,�g(�5Ҕ�-y�b�#Vr͵=Jp��i���Rc>LAME3.100�����a�ހM�P0 ƒ�Ȭh"J��Q#��0��$2&��EYC_Z��0J�hՔ ):Ȋ�� Mǵ�O�mK���O�V܊xkm��*R��9��$�"���������d��vER�l5� ��I-�@4����(ʺc���SW\�����Cl�'��$�w�u���]�T���UC�x�w����u����������9�z����� ���ȸ�щ��0��[0дr���x�&8 �I� r����q-V8@J�Q��P\��иY���8�2�k ��ve���D��7�i��8���+��i����L�_�}V�}�� 8B8�d��������2�K94�O�/�M�����J���&d3�[D���>Q��}��ǟULAME3.100UUU��s ���l@4D�*@a@�"�D��X PP��h�j ۨ�!�L#���8b�R��/��������!�u`P B7ULق�E$�'Pӊ�E,,Ckz�����!z���i�Yb�:���V��K�Q���d���gP l7 ��@ �^�4�ΖEM��O�o��Ū���z���]E���%��7K:�#� � �K�M���_߿��(N��n��q� X`���.3Bb��F% *+�f\��o��J�kY�'2�L�`�A��LtX�i (���u{�_�d �����2/ 3*ۡ�]��] 9dI�2,(�yo �IN���� ���ʱ�҃�@��x�+ ��\���E?4��d��tʰ_=��Vح�B����d����gP�oE� 1�<ao�4�=�9uQ\+��D�C �I*>� ˼t�(�O�*Y�q�E/�:��㲲��X��X͗V�^�~���ZF���0a��AB�'04�c�#�M�L�,�h�/p-�[� (:�cU�z! F�#5���f����g�2� $���� �f �;��ާ�.6�G�r��\��̦�\��E��J��kT�;ϰx� ]j%��wu=��^�2a��!�#j��5�~��q�хk�d�sC|.���^�����q���@���qO��`e���s�ԥL��~]���`�o� �X��E+Ih���W&����^vv㡁D6HE�f�'O�FZ�o� �J�:m�B������?2,�^N�p�U�Hx�H���d��bjP o=� �DL��H4�8�#3v�F����<����Xnx!S*)Xt5 U�DqP_M���w4��ȥe��'�}# �q��to�)ᷳ� Ċ�G8�|���G,�L���NԓfpĬm�дHS�o�,���A���I@�� ��pUyDdZP2L������*�jK��)p=�+�mZ&�WS�F� ```

TODO:

  • [x] Midi-like
    • [x] create a parser for midi-like
  • [x] Image
    • [ ] create a parser for images
  • [ ] audio - ascii-waveform variant (suggested by todepond)
    • [ ] create a parser for audio - ascii-waveform
  • [ ] audio - command variant
    • [ ] create a parser for audio - command variant
  • [ ] video
    • [ ] create a parser for video
labbo-lab commented 1 year ago

Ok, and?

My proposal is a set of file formats that are human readable, along with a way to manually edit each format with (some) ease

labbo-lab commented 1 year ago

I'll slowly be working out the details for some, the ones i currently want to focus on are:

labbo-lab commented 1 year ago

First off, MIDI-like, because that should hopefully be the most simple

Basic Info:

File Ext: .CHRP

We only need one instrument, chrip, as other instruments are a complicated relic of archaic music genres so that removes a decent amount of complexity (With MIDI having 127 unnecessary instruments)

File Structure:

NOTE (note text)

BPM (integer)

INST "Chirp" //There are no other instruments, this is just a formality for new compilers to make it easier for them

CMD start // Starts the melody (Future commands can be added)

CHIRP (Start), (End) (-/+) (Offset from Middle C)(Volume percentage)% // Can be overlapped, order in doesn't matter

CHIRP                          1,4-1 // Whitespace doesn't matter either, as long as you have at least 1 space

CMD end // Ends the melody

File Example:

NOTE  Settings

BPM   132
INST  "Chirp"

CMD   start

NOTE Main Melody!

CHIRP  0, 2    + 1  100%
CHIRP  2, 3    - 5  90%
CHIRP  4, 5.5  + 0  100%

NOTE Background Bass!

CHIRP  1, 6     - 10  65%

CMD    end
labbo-lab commented 1 year ago

First off, MIDI-like, because that should hopefully be the most simple

It in fact, was not simple. (Yet not too hard)

labbo-lab commented 1 year ago

Any feedback before i continue on to the next formats?

stohrendorf commented 1 year ago

Can't we just convert any graphics to colored ASCII art?

labbo-lab commented 1 year ago

Can't we just convert any graphics to colored ASCII art?

This would require a way to type with color (again, manual creation/editing is a big part of this proposal) , which should absolutely be a standard however most keyboards currently don't support that

stohrendorf commented 1 year ago

There's ANSI escape codes, allowing colored terminal output.

labbo-lab commented 1 year ago

There's ANSI escape codes, allowing colored terminal output.

This could work, however its not quite as fun ¯\_(ツ)_/¯

labbo-lab commented 1 year ago

next up, image format!

Basic Info:

File Ext: .BERD

BERD (Bitmap Ergonomic Raster Drawing1 ) is an image format for storing images efficiently (sometimes)

File Structure:

(assignment value, 1 character or more) (hex color with opacity) //can be repeated as many times as you want, creating a "palette"

(optional width value)x(optional height value)

(assignment value) // repeat along x or y axis, or if you defined a width and height you can write it all on one line if you want

File Example:

w ffffffff
b 000000ff

w w w w w
w b w b w
w w w w w
b w w w b
w b b b w

would give (upscaled for visibility) image

or you could do

w ffffffff
b 000000ff

5x5

w w w w w w b w b w w w w w w b w w w b w b b b w

Possible Improvements:

A better way to implement transparency could be useful, as antialiased edges would create a lot of unnecessary assignments

1 Make a better acronym

labbo-lab commented 1 year ago

Well, now I need to make audio... I am actually dreading this one a bit, although I do have a bit of an idea of what to do

stohrendorf commented 1 year ago

What about storing FFT values? This way, you can do frequency analysis for free.

labbo-lab commented 1 year ago

What about storing FFT values? This way, you can do frequency analysis for free.

That would be interesting, but looking into FTT (Fast Fourier Transform), it doesn't fit in the whole "Human editable and readable" part, and also I just don't really understand it enough myself to create a file format with it 😅

labbo-lab commented 1 year ago

Ok i got two audio formats to work on, one suggested by Lu (TodePond) thats basically ascii art for waveforms and my idea which is more like the .CHRP file format

(Im going to work on Lu's suggestion first because its more interesting)

labbo-lab commented 1 year ago

(Im going to work on Lu's suggestion first because its more interesting)

Now i could make it just

**   **
* *  * *
*  * *  *
*   **    *

but thats boring, so i think im going to do something like

|\  |\  |\
| \ | \ | \
|  \|  \|  \
labbo-lab commented 1 year ago

ok, so you can decide how much detail you want in the wave form, so if you want an easy square wave, just do detail 1

and then

#########

or a sine wave with lots of complexity

.     .*``*.
 '._.'      '

(Each character would have 2 values, a start height and an end height, for example / could be 0 and 1, and a*` would be 0.75 and 1 (just making guesses/examples, this probably isnt accurate at all)

stohrendorf commented 1 year ago

So it's not lossless?

labbo-lab commented 1 year ago

So it's not lossless?

Its only as lossless as you make it, with the detail feature i guess you could control it

labbo-lab commented 1 year ago

https://universeodon.com/@Jax_/110577633620604516

Set up a poll to figure out what monospace font people use the most

labbo-lab commented 1 year ago

working on a way to parse .CHRP files

image image

labbo-lab commented 1 year ago

:tada: Parser for .CHRP files has been finished! It currently just converts it to MIDI, however I will eventually make an actual way for it to play notes

https://replit.com/@LabboLab/CHRP-to-MIDI?v=1#song.chrp https://onlinesequencer.net/3474781

labbo-lab commented 1 year ago