Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize tune description format #28

Closed
4 of 6 tasks
fulldecent opened this issue Oct 4, 2016 · 14 comments
Closed
4 of 6 tasks

Standardize tune description format #28

fulldecent opened this issue Oct 4, 2016 · 14 comments

Comments

@fulldecent
Copy link
Owner

fulldecent commented Oct 4, 2016

We should have a common format for describing tunes (series of beeps) across the different implementations in this repository. Extensive searching was done, a simple widespread standard was not found.

Following is proposed:

  1. Simple text file
  2. Each line represents a beep or a pause
    1. Column one is a positive integer number of milliseconds
    2. Column two is a positive integer frequency in Hz, or 0 which represents silence
    3. Columns are separated by a space
  3. Line ending is unix format (\n, but \r\n should not cause an error when reading file)
  4. File extension is .tune
  5. Consider adding a silence at the end so that looped playback sounds good :-)

Example for mary_had_a_little_lamb.tune:

400 2673
400 2349
400 2093
400 2349
400 2673
400 2673
790 2673
400 2349
400 2349
790 2349
400 2673
400 3136
790 3136
400 2673
400 2349
400 2093
400 2349
400 2673
400 2673
400 2673
400 2673
400 2349
400 2349
400 2673
400 2349
790 2093
400 0    

Work plan:

  • Convert existing tunes into this format, save to tunes/ folder
  • Update each implementation to accept a .tune file on the command line / stdin or however else
    • Using _mm_stream_si128
    • Using counter and threads
    • In Javascript
  • Update run instructions so users know to supply the song file

Related: #1

@rocketinventor
Copy link
Contributor

@fulldecent, what was wrong with the human-readable ".song" format described in #1 & #24?

@fulldecent
Copy link
Owner Author

@rocketinventor Nothing is wrong with those ideas. For the "standardized" format, the simplest one is preferred.

Going forward I think we will also have a few parsers to bring, say, morse code or midi into this format.

@rocketinventor
Copy link
Contributor

@fulldecent It would probably be a good idea to have start, stop, and end of line symbols. While these are not 100% necessary, they would still be useful to improve the resiliency of the parser against poorly formed files, and code. In addition, start and end tokens would allow for arbitrary text to be added before, and after the actual song data.

Making 0 0 or 000 0 the official end token would be trivial to implement (in the example it is 400 0) and does not violate any of the current (proposed) specs.

@fulldecent
Copy link
Owner Author

Right now the 400 0 is just a pause so that the tune can be repeated with the correct pause between plays.

@rocketinventor
Copy link
Contributor

Oh. That should probably be mentioned in the specs, then.

rocketinventor added a commit to rocketinventor/system-bus-radio that referenced this issue Oct 26, 2016
Changed over the song parser and accompanying code to be inline with the new, as suggested in issue fulldecent#28.
@rocketinventor
Copy link
Contributor

@fulldecent Please update the proposal message to indicate that the JS port has been updated to use this new spec.

@fulldecent
Copy link
Owner Author

@rocketinventor Thank you, one check for the good guys

@fulldecent
Copy link
Owner Author

Just added this documentation to the tunes/ folder and added two sample tunes.

87dbedb
797e8ec

@fulldecent
Copy link
Owner Author

Tune format now working for c implementation with 0090934

@thegoldenprawn
Copy link

I am new to this project and wanting to help, has any scripts been written to convert the sound to this format.

@fulldecent
Copy link
Owner Author

None yet. I have manually converted some other files into .tune format. But if you could write something took text and turned it a tune as morse code, that would be pretty cool.

If you can do it as a web page then we could host it at https://fulldecent.github.io/system-bus-radio/

@YoshiRulz
Copy link

YoshiRulz commented Dec 24, 2022

It should be noted that this format is distinct from GRUB_INIT_TUNE.

edit: Adding to the below comment: pitch and duration are in the reverse order as well.

@fulldecent
Copy link
Owner Author

This is equivalent to the GRUB_INIT_TUNE when using a TEMPO of 60,000 (bpm)

@fulldecent fulldecent self-assigned this Mar 13, 2024
@Q0AL
Copy link
Contributor

Q0AL commented Jul 9, 2024

make one for rickrolling people

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

5 participants