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

Removing comments from sfz notes #3

Merged
merged 1 commit into from
May 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
removing comments from sfz notes
  • Loading branch information
sezanzeb committed Apr 7, 2023
commit 16ecee2e1f4b5d7e18e6550be7e7d4fe138db116
5 changes: 5 additions & 0 deletions sfz2bitwig.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,12 @@ def _read_riff_chunk(fid):
+ ((loops,) if readloops else ()) \
+ ((pitch,) if readpitch else ())

def remove_comment(self, line):
return re.sub(r"//.*?$", "", line)

def sfz_note_to_midi_key(self, sfz_note):
sfz_note = self.remove_comment(sfz_note).strip()

SFZ_NOTE_LETTER_OFFSET = {'a': 9, 'b': 11, 'c': 0, 'd': 2, 'e': 4, 'f': 5, 'g': 7}
letter = sfz_note[0].lower()
if letter not in SFZ_NOTE_LETTER_OFFSET.keys():
Expand Down