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

TODO: Test and fix application support for all midi files #20

Open
Yuleblinker opened this issue May 12, 2017 · 5 comments
Open

TODO: Test and fix application support for all midi files #20

Yuleblinker opened this issue May 12, 2017 · 5 comments
Labels

Comments

@Yuleblinker
Copy link
Member

Currently the application works with some MIDI files but not others. Certain MIDI files cause errors. I believe this is something to do with the midi parsing library being used. A fix is needed for this quickly - both for the current master demo and so those working on code can decide whether a change of midi parsing library is needed.

@NicTet
Copy link

NicTet commented May 12, 2017

Hi, a most heartfelt thank you to everyone involved with this great project. I just acquired a 30 notes musicbox to try and create paper strips of favorites songs (for a loved one). I'm an avid diy-er with access to a laser cutter so I'm quite excited with your project!

I'm struggling with the "app" correctly "loading" some midi files downloaded from the net, e.g. Bohemian Rhapsody (Bohemian Rhapsody). With this file the "Show Preview" doesn't seem to work and the saved file seems empty.

I have a different problem with other files I have generated. These seem to "compute" fine but the preview and exported file have unusually long horizontal spacing between notes (e.g. (Band of Horses) . Here's the output SVG with 2 mm x 1.5 mm holes (SVG file)

Perhaps this is helpful for this bug report in particular? Also, if you have specific workaround for me to still move forward using my self-generated file that would greatly appreciated.

@Yuleblinker
Copy link
Member Author

@NicTet This project is still in the very early stages and many aspects of it still need to be completed. We are aware of the app not loading certain files - an issue to do with the current midi parsing library in use. We are looking into that and considering different libraries.

When you mention 'unusually long horizontal spacing' this is likely to do with the midi track itself. The spacing on paper is controlled by the smallest time difference between notes of the same pitch. It has to be this way to allow all notes to play successfully. For example, if your MIDI track only uses quarter notes it may become 500mm long on paper. If you add a single eigth note to the same MIDI track then on paper it has to double in size e.g. 1000mm. So two songs of the same duration may appear on paper with vastly different lengths. This isn't a bug but just the way things have to be to accomodate the fact that music box mechanisms usually can't play the same note in rapid succession.

I know this is not ideal as a workaround unless you are a programmer but you are more than welcome to download the code and change it in any way. If you're not a programmer then please continue to follow the project and hopefully sometime soon we will have sorted out many of the issues. There is also another experimental app that might be of use. You can find it here: https://wintergatan.github.io/Midi-to-laser-cutter/experimental/musicboxeditor/dist/

@NicTet
Copy link

NicTet commented May 13, 2017

Thanks @Yuleblinker for taking the time to explain what is probably obvious to you! I think I get your point about smallest time différence but I was under the assumption that the "on" and "off" moments were time related, e.g. on 3:31, off 3:32, for one second pulse. Thus, if you have a song starting at 0:00 and finishing at 4:20, shouldn't it be possible to set the file end point = max strip length and then have a sample size dictated by the max note frequency of the musicbox?

In any case, I understand that this project is still young and I'd like to keep encouraging the development. I am not a developper myself, unfortunately. My comfort zone is on trying to fabricate a unique wooden cradle for the musicbox. So I'm discovering the music side of the project, I had imagined this workflow kind of workflow: MP3 of a great song -> midi file -> SVG strips -> lasercut strips . But I'm realising that everyone of these step is new for me so I'm learning slowly.

Thanks for referring the other experimental app, I'll check it out!

@Yuleblinker
Copy link
Member Author

Yuleblinker commented May 15, 2017

@NicTet Thanks for taking an interest in the project. What dictates the length of the strip is the physical characteristics of the music box mechanism. There is a minium physical distance that two note events of the same pitch can be spaced at.

mechanism

If you look at the picture you'll see i've marked the 'pluckers'. On this device they have a spacing of approx. 8mm. (the 3mm spacing is betwen slots) When one plucker engages the strip has to advance at least 8mm for the next note (of the same pitch) to play. So, the minium distance between two notes of the same pitch on the strip is 8mm.

If a track only uses quarter notes then the distance between two consecutive quarter notes of the same pitch is 8mm. If you add a single set of consecutive eigth notes of the same pitch to the track then those eigth notes require a spacing of 8mm. In this track quater notes would then be spaced at 16mm, thus doubling the overall length of the strip on paper.

The length of a printed strip will be determined by the closest pair of notes of the same pitch. The only other way to control the length of strip would be to have some way of varying the speed of the strip through the mechanism. A computer controlled muisc box could do this but I don't think most humans could very accurately.

@DrSkunk
Copy link
Member

DrSkunk commented Jul 14, 2017

Proposed solution is migrating to the Tonejs MidiConvert library, which also solves the licensing issue.
An example is written in https://wintergatan.github.io/Midi-to-laser-cutter/experimental/whitebird/
Library: https://github.com/Tonejs/MidiConvert

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

No branches or pull requests

3 participants