How to implement an overall pitch transpose parameter?

After a longer break, I’m back to jamming with the Shruthi.
One idea came to my mind when mashing up different sequences and stuff:

For my kind of workflow / improvisation, I could be useful to control the overall pitch of the Shruthi (while running sequences in MIDI slave mode) to whatever key I’m currently doing.
I know this could be done via keyboard transpose, but I kinda prefer the knobby way (the Evolver has a similar parameter).

So my first shot was: change the “Oct” parameter on the Tuning page to a +/-24 semitone control, however, looking through the source code it didn’t seem the best way, as it seems to directly go to the Oscillators paramters.
Second though: extend the +/-1 semitone parameter of the Master Tuning page -> didn’t find it yet in the source code.
Third idea: could the ragas be “hijacked”, i.e. change the tables to have all notes affected by +/- x semitones ?

Any hints on what the best approach would be ?

Your first guess was the best one, I think the best option would be to repurpose “oct” to +/- 24 semitone.

Change the range of this param to +/- 24 here

It is applied to the oscillators pitch here and you’ll need to remove the multiplication by 12 since it’s no longer octaves. Done!

FYI the master tuning is applied a few lines down here

This is an “oscillator-level” transposition, ie the pitch will be transposed but the modulation matrix will still see the original MIDI note, so this might affect stuff like cutoff tracking or anything done in the mod matrix with “note”. If you want to do it earlier, at the MIDI note level, remove this line and directly tweak the note in ::NoteOn and ::NoteOff . I don’t recommend you to do so because you’ll have stuck notes if you change the transposition between a NoteOn and a NoteOff (NoteOn and NoteOff won’t be paired).

Middle ground: do it at the trigger level here

Life of a NoteOn:

  • Upon reception of data in the UART, the MIDI byte is put into a ring buffer
  • A task periodically pulls bytes from the buffer and feed them to the MIDI parser
  • The MIDI parser parses the MIDI protocol
  • The MIDI parser calls an event handler when a NoteOn is found
  • The note is processed with a different handler depending on the arp/sequencer mode. The different handlers are stored in this table. The simplest handler, which is the one used when the arp and seq are turned off, adds the note to a stack for handling note priority, and triggers the note.
  • The actual triggering of a note happens here. This resets the envelopes (or not) depending on the legato mode, resets the LFOs if necessary, recompute some entries in the mod matrix, and sets the pitch to which we’ll glide or jump depending on the portamento settings.

Thanks a lot Olivier, I’ll try my option 1 later tonight !

Implemeted successfully in v0.92 source code and works perfectly! Thanks!

However, I can’t get the v0.93 source code through. I got from the “firmware building problems” thread that I had to include the “avril” directory as “avrlib”, however the make is still missing the file “avrlib/devices/switch_array.h”. I’ve tried git, but could only get the main directory, not the dependencies (as far as I’ve understood that thing).

Anyway, works with the old firmware, gotta go look for the next mod I want to implement :slight_smile:

git submodule init and git submodule update to pull the dependencies.

Yeah, the second one (update) doesn’t work, but it looks like it’s a Win7 path problem, just need to check that.

Oh BTW, firmware build on Win7 with WINAVR and Python 2.5 works !

I think the problem is that you’re trying to build from the v0.93 branch (or earlier) using the latest version of avrlib.

Either you build the latest firmware version with the latest version of avrlib ; or you build branch v0.93 with the version of avrlib that was used at that time (and which should be correctly retrieved by git submodule update - this is why it is preferable than a manual download of the dependency).

So the real problem appears to be that you can’t get the submodule. I’ll look into that.

Hmm, is still get the “permission denied (publickey)” when doing the submodule update.

I also get it when I do git clone

I’ve tried to download the avril and tools via the github website, but the “switch_array.h” is not in the devices subfolder.

Ah I think I see what is the problem… the submodule uses a private R+W reference (git:// I have no idea how to solve it, but I will look into it…

Ahh, got it ! So with that (v0.93) version of avrlib you linked, it went through. Gotta remember that branch option on the github website.
Thanks a lot, you saved my day :slight_smile:

(already found my next firmware change thingy, but I will look into that some more …)