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

Quick initialize Note and Notes use note name. #160

Closed
NeroBlackstone opened this issue Jan 27, 2023 · 4 comments
Closed

Quick initialize Note and Notes use note name. #160

NeroBlackstone opened this issue Jan 27, 2023 · 4 comments

Comments

@NeroBlackstone
Copy link
Member

NeroBlackstone commented Jan 27, 2023

I want to add these Note and Notes constructors.

# Sometimes we don't care where the note is. Just do some pitch calculations.
Note(pitch; position = 0, velocity = 100, duration = 960, channel = 0)
# Usage
Note(80)

# Use note name to initialize a note and ignore positions
# (name_to_pitch function name is too long!
Note(pitch_name::String; position = 0, velocity = 100, duration = 960, channel = 0)
# Usage
Note("C4")

# Use note name and position to initialize.
# Usage
Note("C4", position = 100)

# Initialize notes in the same position by string (and the other note field is the default). 
# (Like initialize a chord at some position!
Notes(notes_name::String, position = 0, tpq::Int = 960)
# Usage, slice by space. 
Notes("C4 E4 G4", 100)
# Initialize notes by a string and ignore the position 
# Usage
Notes("C4 E4 G4")

What do you think about it?
Tell me your thought, thanks. I'm ready to implement these constructors

@Datseris
Copy link
Member

For the Note constructor, you can't add Note(80) because why would pitch be the quantity specified here? It could be position velocity or anything else. Specifying by string is okay though. The Notes constructor is also okay but without the position argument, because, again, why would 100 mean position instead of velocity.

@NeroBlackstone
Copy link
Member Author

NeroBlackstone commented Jan 28, 2023

For the Note constructor, you can't add Note(80) because why would pitch be the quantity specified here? It could be position velocity or anything else.

I'll remove this.

Specifying by string is okay though. The Notes constructor is also okay but without the position argument, because, again, why would 100 mean position instead of velocity.

Because a similar note constructor Note(pitch, position; velocity = 100, duration = 960, channel = 0) exist in docs , so I add position argument here to maintain consistency. Like: "Okay, let's initialize a chord at that position"


Conclude:

Add Note constructor:

Note(pitch_name::String; position = 0, velocity = 100, duration = 960, channel = 0)
# Usage
Note("C4")

But for Notes:

# Shall we implement this?
Notes(notes_name::String, position = 0, tpq::Int = 960)  
# Or remove position?
Notes(notes_name::String, tpq::Int = 960) 

@Datseris
Copy link
Member

I'd say we don't use position in Notes. translate can be used later if one wants different positions.

@NeroBlackstone
Copy link
Member Author

Close cause merged.

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