Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - lokki

Pages: 1 [2] 3 4 ... 14
PreenFM2 / Re: midi offset and EDIT: globaltune...
« on: January 06, 2018, 09:49:09 AM »

how do i check if i have global tune selected in the menu?

so that i don't call the Osc::tune function all the time when i am in the menu.

in other words i'm trying to do something like this:

Code: [Select]
if (selectedMenu == MIDICONFIG_GLOBAL_TUNE) {

i don't fully understand because the place you gave me in code (line 1029 in SynthState.cpp) is for encoder 3 (the one i am turning to adjust the value) how do i check the position of the first encoder? (since i assume this corresponds to MIDIONFIG_GLOBAL_TUNE) hmm...

EDIT: to clarify, a version without the if-statement works perfectly well, but i thought it is bad practice to call the function even when other settings are changed...

PreenFM2 / Re: custom extended firmware
« on: January 06, 2018, 08:27:26 AM »
hi stelpa,

what features were you hoping for?

global midi channel and hertz mode already are in 2.08.

program change mod would be easy to readd, EDIT: a quick try with usercc failed since xavier changed somethings in that regard...
USERCC is readded, easy enough :-)
that being said, i'm working on some new extensions, currently on the 8timbres branch. will be easy to remerge into the standard firmware.

features coming:

-global tune (tune the preenfm from 435 to 444 hertz)
-constant value for the matrix which enables you to transpose instruments by applying a constant to o*fq...
-program change mod is still there :-)

PreenFM2 / Re: waveforms
« on: January 03, 2018, 05:58:28 PM »
old thread i know...

so is the procedure the same with the newer firmware (i want to try to add more than 6 new waves)? do i add to waves.c?
waves2.c is not needed, right? i can compile the firmware even if i rename/move this file. also no need to edit, right?


EDIT: nevermind i figured it out. but i overflowed ram by adding all the tables i wanted :-) hehe.

PreenFM2 / Re: Reverb Algorithms
« on: January 03, 2018, 10:07:18 AM »
i think comb filters are what is used in the freeverb as well. one will not do, since it sounds metallic...freeverb uses 4 i think...

PreenFM2 / Re: midi offset
« on: January 02, 2018, 08:34:57 PM »
hi xavier,

i tried moving the usb initialization up before the osc init but it makes no difference. but also no freezes :-)

i then tried with your static void suggestion in osc.cpp and it works! (well partially)


Code: [Select]
void Osc::tune( int tuneconfig) {
float  tuneFactor[] = {435.0,435.5,436.0,436.5,437.0,437.5,438.0,438.5,439.0,439.5,440.0,440.5,441.0,441.5,442.0,442.5,443.0,443.5,444.0} ;
float frecAdjust = tuneFactor[tuneconfig] / 440.0f;

 for (int k=0; k<127; k++) {
midiNoteTunedFrequency[k]= frequency[k] * frecAdjust;
   // Set frequencyToUse  to frequency (no Scala scale defined)
        frequencyToUse = midiNoteTunedFrequency;

and the corresponding declaration in the public section in osc.h i have globaltune working after reboot! yehaa! i put a call to Osc::tune in preenFM.cpp at line 145 as you suggested.

i also tried to intercept when a new value is changed in synthstate.cpp like this:

Code: [Select]
   if (fullState.midiConfigValue[fullState.menuSelect] == MIDICONFIG_GLOBAL_TUNE) {

but i get no realtime change. maybe i am using the variable addressing wrongly? (this is the part where i am still confused,hehe) or line 1029 is not the right place?

EDIT: it is the right place, because tuning is actually changing once i am in the menu and adjust globaltune. the only problem is it is a fixed value it changes to, i'm guessing the array nr. that represents MIDICONFIG_GLOBAL_TUNE and not the actual value i am changing...

anyhow, this is already a huge step forward, so thanks heaps for your help!!

PreenFM2 / Re: modsource idea (SOLVED)
« on: December 29, 2017, 03:56:34 PM »
right  8)

PreenFM2 / Re: midi offset
« on: December 29, 2017, 03:55:55 PM »
thanks, i saw it. i'm abroad playing for a few days, will report back when i get a chance to try it out. cheers

PreenFM2 / Re: midi offset
« on: December 29, 2017, 10:33:43 AM »
On microcontroller, const are not moved to RAM, they stay on the flash memory, so they're slower. That's fine for your tuneFactor, but not for value used in the real time audio engine.

i see. i often use const on arduino, because i though it would speed up things :-) but arduino may be different...will do some benchmarks :-)

PreenFM2 / Re: midi offset
« on: December 28, 2017, 10:52:57 PM »
xavier, thanks for this indepth answer.

i implemented it as per your suggestion:

Code: [Select]
float  tuneFactor[] = {435.0,435.5,436.0,436.5,437.0,437.5,438.0,438.5,439.0,439.5,440.0,440.5,441.0,441.5,442.0,442.5,443.0,443.5,444.0} ;
float frecAdjust = tuneFactor[this->synthState->fullState.midiConfigValue[MIDICONFIG_GLOBAL_TUNE]] / 440.0f;
 for (int k=0; k<127; k++) {
midiNoteTunedFrequency[k]= frequency[k] * frecAdjust;
        // Set frequencyToUse  to frequency (no Scala scale defined)
        frequencyToUse = midiNoteTunedFrequency;

but the problem persists, no change in tuning even after a reboot.

i did not yet do the part in SynthState.cpp, but that would only be to have immediate change when i adjust the value, right? or is this the crucial step i'm missing and the reason why the tuning does not change  ??? EDIT: calling Osc Init from there?
(i do not fully get that part, would i have to do the same calculation in the brackets there as well? or do i leave just empty brackets? or have a propagateNewParamValue in there?)

also on a related note: is there any reason why the frequency array in waves2.c is not declared as a const? if a scala file is used that array is not manipulated i think. would that not be more efficient? (my tuneFactor should also be const :-))

PreenFM2 / modsource idea (SOLVED)
« on: December 27, 2017, 11:40:12 PM »
hi all,

what about a random modsource that gets updated only when a new note is played?


-add a very small amount to o*Fq to get slightly detuned notes for a more natural feeling
-filter cutoff variation on noteon
-pan randomly each note

or is this already possible and i'm missing how to do this?
EDIT: is lfo1 random set to frequency 0.00 the solution?
EDIT2: YES, that works, wohoo, nice!


PreenFM2 / Re: midi offset
« on: December 27, 2017, 09:50:24 PM »
ok,  i tried this in osc.cpp just before frequencyToUse = frequency:

Code: [Select]
float currentA = frequency[81];
 for (int k=0; k<127; k++) {
frequency[k] = frequency[k] * ((870.0 + this->synthState->fullState.midiConfigValue[MIDICONFIG_GLOBAL_TUNE])/currentA);

everything still works but changing the global_tune value has no effect :-(

even a reboot of the preenfm does not change the tuning.

as i said i don't know any further than this...sorry for all the questions.

PreenFM2 / Re: midi offset
« on: December 27, 2017, 04:53:41 PM »
thanks xavier,

yeah i see now, why it does not work :-) i was tired yesterday...
you make good points of course and most of them i though about as well, but:

unfortunately i don't know enough about the preenfm source to make this happen only at boot time or when the settings are changed...
also i remember trying to change the frequency array in osc.cpp in an earlier attempt but i will try again. i don't know enough about floats and their precision, but wouldn't manipulating the array back and forth (changing tuning from 438 to 442 repeatedly for example)  introduce errors over time?  would the value also be updated before i save the config? i ask because it is much easier to tune when you can play a note and immediately hear the change.

PreenFM2 / Re: midi offset
« on: December 26, 2017, 10:29:14 PM »
ok, globaltune is next :-)

i thought i could do it in the same place in osc.h where the matrix stuff is done and tried this:

(line 57)
Code: [Select]
oscState->mainFrequencyPlusMatrix +=  (oscState->mainFrequency  * (matrix->getDestination(destFreq) + matrix->getDestination(ALL_OSC_FREQ)) * .1f) * ((435.0 + (this->synthState->fullState.midiConfigValue[MIDICONFIG_GLOBAL_TUNE] / 2.0)) / 440.0);

this->synthState->fullState.midiConfigValue[MIDICONFIG_GLOBAL_TUNE] is a value i added in the global menu ranging from 435 to 444 in 0.5 steps. so this makes 19 possible values with 440.0 represented by value 10.

this is the code in menu.cpp

Code: [Select]
const char* tuneSteps[] = {"435.0", "435.5", "436.0", "436.5", "437.0", "437.5", "438.0", "438.5", "439.0", "439.5", "440.0", "440.5", "441.0", "441.5", "442.0","442.5", "443.0", "443.5", "444.0", };

the code compiles fine, modulating the pitch with the matrix still works as expected but adjusting the value in the global menu has no effect. do you see any obvious errors? why does  "this->synthState->fullState.midiConfigValue[MIDICONFIG_GLOBAL_TUNE] "  not get updated?

PreenFM2 / Re: midi offset
« on: December 23, 2017, 04:55:11 PM »
ok, i couldn't resist and had a spare two minutes :-)

it works very well with a value of 10.0. this gives me three octaves higher at 7.0 and at -8.0 :-) so yes negative values just get mirrored after -1.0... and one or two octaves lower are still possible with -0.5 and -0.75. three octaves lower is not precise anymore but that is ok for me. (i don't need it)

nice and thanks for your idea and support, really appreciated.

PreenFM2 / Re: midi offset
« on: December 23, 2017, 04:39:42 PM »
thanks for that. will try it after christmas :-)

i think 1 2 4 8 makes no sense, since you add 1 in the formula for the freq calc.
so better to just use 10.0 for example. gives a big range and some undocumented behaviour below -1.0 :) let's see what happens.

Pages: 1 [2] 3 4 ... 14