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

Implement breath and tie #1

Open
jcmk opened this issue Dec 11, 2021 · 7 comments
Open

Implement breath and tie #1

jcmk opened this issue Dec 11, 2021 · 7 comments

Comments

@jcmk
Copy link

jcmk commented Dec 11, 2021

Please implement breath into Melody instead of requiring users to manually implement it.
Please implement a new notation for tying notes together without breath.
ie. "C D E F" is C, breath, D, breath, E, breath, F.
but "C D E^F" is C, breath, D, breath, E, (no breath), F).

@dualB
Copy link
Owner

dualB commented Dec 13, 2021

Hello jcmk,
Breath concept is implemented in Musician Library, I tried to have avoid "interpretration stuff", like breathing, inside the Melody library. So, I need to think about it before implementing a new symbol. On the other hand, tying notes are probably a useful thing to have.
Thanks for your input, I'll check that soon!

@jcmk
Copy link
Author

jcmk commented Dec 14, 2021

Makes sense separating the functionality of the two. I'm using Melody directly as I was getting some glitches with Musician on my non-Arduino hardware and I didn't want to spend more time messing around to get it to work. Based on my understanding of the API in addition to parsing the new symbol, you'd need to add a getBreath method to Melody to tell Musician whether or not the note should be tied to the next one, as there'd be no way to detect that from Musician.

@dualB
Copy link
Owner

dualB commented Dec 14, 2021

The easiest way to implement it will be to set a breath in duration (like it's done with the Tempo value), then it will make notes shorter, and it will add rests after every note, except those who are followed by the modifying symbol "=", which is probably the best choice for meaning "tie". This will have the effect of doubling the apparent length of the melody. But, this will make Melody more consistent with his goal, which is to produce a sequence of "frequencies" or "silences", of precise durations and loudness.
I could also add a new information, like "full duration of the note interval" vs "playing duration of the note". This will change the interface, and the user will have to implements himself the logic to produce the right sound, which can lead to unexcepted timing issues.

Is breath should be in an absolute value (in milliseconds) or relative of the duration of the note (in %)?

@dualB
Copy link
Owner

dualB commented Dec 14, 2021

My trip in the subway gave me time to think... , in some way, breath and tie are the same boolean concept about having or not rest at the end of each note. So, it should be kept completety as a symbol, without any method like (setBreath) or whatsoever.
Breath should be implemented like duration, for example "a¦8" to add a breath equivalent to 1/8 of the duration.

@jcmk
Copy link
Author

jcmk commented Dec 15, 2021

I am not a musician, and in the song I was using there were only "ties" to the same note, which as you say is in effect just extending the note as far as my understanding goes. My solution was to incorporate a breath using a delay, and then just extend any of the notes that had ties by the appropriate ratio. That being said, I believe in music you can "tie" to a different note, where it shifts but in the same breath. For that to work you would need a symbol to specify to have no breath between the notes.

@dualB
Copy link
Owner

dualB commented Dec 15, 2021

My solution will probably converge to something like this :

  • Symbol '=' will be used to tie notes; by default, every notes are tied (breath of 0);
  • Symbol '!' followed by and integer or a ratio (not sure yet) will be used to specified the duration of the breath. For example, "c!8" could mean to have a C of 7/8 of duration followed by a rest of 1/8. "(cde)!16" could mean every note as a breath of 1/16 of duration.
  • The closet symbol between '!' and '=' have precedence over any other modifier. For example, in "(cd=efg)!8", the breath of 1/8 will affect every not EXCEPT d (it will be equivalent to "c!8d=e!8f!8g!8" ). In the same way, "(cde!8fg)=" will be the same as "c=d=e!8f=g=".

@dualB
Copy link
Owner

dualB commented Dec 15, 2021

It works!
You can access early version 1.2 directly in Github - it won't be accessible in Arduino Library Manager before I run more tests on it.
https://github.com/dualB/Melody/archive/refs/heads/version-1.2.zip

Here's how to use it:

"c!" will play a C of 15/16 and a rest of 1/16 ; By default, the breath is 1/16 of the duration of the note;
"c!4" will play a C of 3/4 and a rest of 1/4 ; The number after '!' represent de denominator of the breath;
"c!3:2" will play a C of (1-2/3) and a rest of (2/3) ;
"(c=def=g)!" will add a breath to every notes except C and F;

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

No branches or pull requests

2 participants