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

[FR] Add support for pitch bend #6

Closed
SpotlightKid opened this issue Nov 29, 2019 · 10 comments
Closed

[FR] Add support for pitch bend #6

SpotlightKid opened this issue Nov 29, 2019 · 10 comments
Assignees
Labels
new feature Feature additions and requests

Comments

@SpotlightKid
Copy link

Relevant opcodes:

@SpotlightKid
Copy link
Author

Once support is added to the engine, it can be easily supported in the LV2 plugin with:

diff --git a/lv2/sfizz.c b/lv2/sfizz.c
index 87c0923..2f30a92 100644
--- a/lv2/sfizz.c
+++ b/lv2/sfizz.c
@@ -434,6 +434,15 @@ sfizz_lv2_process_midi_event(sfizz_plugin_t *self, const LV2_Atom_Event *ev)
                       (int)msg[1],
                       msg[2]);
         break;
+    case LV2_MIDI_MSG_BENDER:
+        // lv2_log_note(&self->logger,
+        //              "[process_midi] Received pitch bend %d/%d at time %d\n", msg[0], msg[1], ev->time.frames);
+        sfizz_send_pitch_wheel(self->synth,
+                      (int)ev->time.frames,
+                      (int)MIDI_CHANNEL(msg[0]) + 1,
+                      (int)msg[1],
+                      (int)msg[2]);
+        break;
     default:
         break;
     }

@paulfd paulfd self-assigned this Dec 3, 2019
@paulfd
Copy link
Member

paulfd commented Dec 3, 2019

Thanks! I have this planned short term. I'll find a keyboard near my workdesk to test it out :D

@redtide redtide added the new feature Feature additions and requests label Dec 14, 2019
@paulfd
Copy link
Member

paulfd commented Dec 15, 2019

It's there now in the develop branch if you want to test it and tell me if the behavior looks fine on patches you know! I'm moving around alot and rarely have a keyboard with a pitch bend to test this kind of thing out...

@SpotlightKid
Copy link
Author

I tested this just now, and it works ok most of the time, but sometimes the pitch doesn't completely return to the center note, even though I can see that the last pitch bend message form the controller was 0. The pitch stays slightly sharp or flattened until I retrigger the note.

I'm using Sherlock MIDI Inspector to monitor the MIDI messages coming form my controller, connected to the same MIDI port as the sfizz lv2 plugin.

@paulfd
Copy link
Member

paulfd commented Dec 15, 2019

@alcomposer had a similar problem apparently. This happened on a simple *sine wave file or a sample based instrument? I will try to replicate it at home if I can but the pitch bend on my keyboard seems super verbose and sensitive :D Apparently I can also play with a virtual keyboard in Ardour for this so I will check that out too!

@SpotlightKid
Copy link
Author

It was a sample based SFZ, namely this one here: http://www.fiedler-audio.de/cc-sounds/mf-tin-whistle2-ogg.zip

@alcomposer
Copy link
Collaborator

I have been checking with many SFZ files from https://github.com/sgossner/VSCO-2-CE and also simple debug style Sine instruments:

Sine SFZ
<global>
bend_up=1200
bend_down=-1200

<group>
lovel=0
hivel=127

<region>
trigger=attack  
pitch_keycenter=60  
sample=*sine 
ampeg_attack=1 
ampeg_release=1

@paulfd
Copy link
Member

paulfd commented Dec 17, 2019

Is it better with 6c2f5b5?

@SpotlightKid
Copy link
Author

SpotlightKid commented Dec 26, 2019

Yes, now it seems to work perfectly. Tested it with several sample based SFZs and the Sine SFZ posted above (the latter with different bend ranges - +/-700, +/-1200, +200/-1200 ct).

Sorry, that it took a while to test, Happy Christmas!

@paulfd
Copy link
Member

paulfd commented Dec 26, 2019

No problem :) I will close this then!

Merry Christmas to you too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Feature additions and requests
Projects
None yet
Development

No branches or pull requests

4 participants