by the way, the [else/rescale] object actually allows for inputs greater than its designated values - which actually happens in [else/brown], where you sometimes will get values over 1 after adding the step to [fold]’s output.
my patch does this as well since it didn’t seem to matter, but it could easily be remedied with a [clip] object.
ATTAC506, inspired by the ADDAC506
FatJak not my idea it's been done before..
https://forum.pdpatchrepo.info/topic/9887/save-presets-to-textfile/12
all the way at the bottom is a vanilla patch where settings of parameters are stored in a .txt file.
i found the [text] object a bit weird to wrap my head around, but it's actually quite easy..
best start by taking a closer look at its help file.
you [define] a text in RAM, write to it w/[text set], ideally a single line of text per parameter.
you can recall each line individually w/[text get], and you can store the full list to a .txt file on disk for later use.
the actual text can just be lists of numbers for your calculations etc.
is there any reason why [savestate] wouldn't work on Bela?
Remork is there any reason why [savestate] wouldn't work on Bela?
Not that I know of. Does it work?
FatJak because of the ctrl+s command from the keyboard missing, you mean?
i think you can just send [savestate] a list of the data you want to save.
giuliomoro
do you know of the incoming adc~values drifting over time, or with different power supplies etc?
aka: is there truly a need for such a function?
i mean, i check and calibrate my pepper patches in the IDE, pulling adc~ values up to "true" 0 - 1 ranges. and then i consider them done and never think about them again. hasn't hurt so far, in practice, but it's an interesting question nonetheless?
- Edited
Remork because of the ctrl+s command from the keyboard missing, you mean?
i think you can just send [savestate] a list of the data you want to save.
The [savestate]
works on my computer because I can do a ctrl+s with the keyboard but not when the Pepper is alone on the rack.
Sorry, my english is perhaps not good enough to be well understood.
- Edited
@giuliomoro
Because of different output voltages from the potentiometers (measured with multimeter and viewable via the bela_scope), can you confirm that we have to consider that we could have for exemple 0.15-0.85 ranges in Pd instead of a 0-1 ?
In this case, what's your advice to calibrate them the simplest way ?
Does Bela already do the range conversion ?
I'm working on something but I would like to know if it's a lost of time...
Edit: It seems that the values on Bela_scope and the measured ones are not the same. Could it be possible ?
Measures with getting_started Pure Data patch:
Potx: measured min-max volt./ approx. displayed volt. with bela_scope / approx. ratio
Pot1: 0.09-4.52 / 0-5.43 / 1.201
Pot2: 0.09-4.45 / 0-5.38 / 1.209
Pot3: 0.05-4.52 / 0-5.43 / 1.201
Pot4: 0.09-4.53 / 0-5.43 / 1.199
Pot5: 0.08-4.64 / 0-5.58 / 1.203
Pot6: 0.05-4.49 / 0-5.4 / 1.203
Pot7: 0.05-4.52 / 0-5.43 / 1.201
Pot8: 0.07-4.19 / 0-5.05 / 1.205
Wich one is converted by Pure Data ?
- Edited
FatJak n you confirm that we have to consider that we could have for example 0.15-0.85 ranges in Pd
It depends on the tolerance of the passives used in the input stage, where an internal 10V reference (or an external CV) are divided down with a voltage divider: the potentiometer probably has a 10% tolerance and the resistor a 5% tolerance.
Potentiometer readings should then be between 0 and 0.98, with a ±15% tolerance on the upper value, clipped at 1. So, depending on the actual resistor values of these components, you may read values slightly above or below 0.98, namely between 0.83 and 1, but most likely closer to 0.98.
There is not much that would explain the bottom of the range to be at 0.15 (or 0.09) instead of 0, so if you get 0.15 or 0.09 when the potentiometer is at a minimum, I'd start looking for issues ... is that on all the channels? Do you get any crosstalk between channels? I am wondering whether the connection between the Bela cape and the Pepper PCB is tight enough on the analog in headers... did you use long enough pins there? Can you try squeezing the boards tighter together?
- Edited
giuliomoro It depends on the tolerance of the passives used in the input stage, where an internal 10V reference (or an external CV) are divided down with a voltage divider: the potentiometer probably has a 10% tolerance and the resistor a 5% tolerance.
Potentiometer readings should then be between 0 and 0.98, with a ±15% tolerance on the upper value, clipped at 1. So, depending on the actual resistor values of these components, you may read values slightly above or below 0.98, namely between 0.83 and 1, but most likely closer to 0.98.
Thanks for these informations.
Because the 1 is sometimes useful with Pd (as in this ATTAC506 patch) and because I don't want to use only the half range of the pot putting too much multiplication to reach it or overtake it, I have these questions :
Wich value is converted for Pure Data : the one viewable on the bela_scope (which seems to be upper than 5V (??)) or the one which could be measured with a voltmeter at the CV OUT ? (which seems to be lower than 5V). Knowing this, I could use a more precise multiplication to reach a 0-1 and use the full range of the pot.
What is the formula involved in Bela to convert these voltages to Pd 0-1 ?
giuliomoro There is not much that would explain the bottom of the range to be at 0.15 (or 0.09) instead of 0, so if you get 0.15 or 0.09 when the potentiometer is at a minimum, I'd start looking for issues ...
(Note: Measures have been done with both eurorack external power and USB plugged)
The Pd 0.15 was just an example, as the Pd 0.85, it was just to try to understand why I can't reach 1 (and perhaps 0).
giuliomoro is that on all the channels?
The non zero minimum is on all the channels, as measured by voltmeter in CV OUT.
On the bela_scope, the zero seems to be fine (by eye...)
Potx: real measure min-max volt. on CV OUT / approx. displayed volt. with bela_scope / approx. ratio
Pot1: 0.09-4.52 / 0-5.43 / 1.201
Pot2: 0.09-4.45 / 0-5.38 / 1.209
Pot3: 0.05-4.52 / 0-5.43 / 1.201
Pot4: 0.09-4.53 / 0-5.43 / 1.199
Pot5: 0.08-4.64 / 0-5.58 / 1.203
Pot6: 0.05-4.49 / 0-5.4 / 1.203
Pot7: 0.05-4.52 / 0-5.43 / 1.201
Pot8: 0.07-4.19 / 0-5.05 / 1.205
giuliomoro Do you get any crosstalk between channels?
(I will try monday.)
giuliomoro I am wondering whether the connection between the Bela cape and the Pepper PCB is tight enough on the analog in headers... did you use long enough pins there? Can you try squeezing the boards tighter together?
This point seems to be alright.
- Edited
I have these questions :
Wich value is converted for Pure Data : the one viewable on the bela_scope (which seems to be upper than 5V (??) > so, for example, 5,43/5≠1) or the one which could be measured with a voltmeter at the CV OUT ? (which seems to be lower than 5V. > so, for example, 4,52/5≠1).
What is the formula involved in Bela to convert these voltages to Pd 0-1 ? As simple as theoretical voltage / 5 ? Or something more complex ?
Knowing this, we could use a formula to reach and overtake 0-1 and use almost the full range of the pot, like this:
f(x)=c+(d-c/b-a)*(x-a)
with: a=minimum voltage + 5% ; b=maximum voltage - 5% ; c=minimum Pd value (0) ; d=maximum Pd value (1)
The percentage is here to be sure to overtake an improbable perfectly stable voltage, it could perhaps be reevaluated.
With a [clip 0 1]
object after this formula, it coult be easy to have a full 0-1 in Pd and a straight 0 in full anti-clockwise pot and a straight 1 in full clockwise pot.
- Am I totally wrong with this quest ? @bela_robert @giuliomoro Thanks
- Edited
FatJak the one viewable on the bela_scope (which seems to be upper than 5V (??))
The Bela scope will show whatever you send to it, so its relation to real-world voltages (if any) is determined by what signals you connect to it.
One thing to keep in mind, is that these are the nominal I/O voltage ranges for Pepper Rev1 and Rev2 when configured in the default way, which expects you to run it from ±12V, using the 5V regulator (J14 set to "12V with regulator") and use the on-board 10V voltage reference (i.e.: J16 set to "10V to pots from rack") and set to use the NE5532 for the audio outputs (i.e.: J21 and J22 set to "Amplified audio w/ rack 12V"):
- 2 audio in (AC-coupled, 10V pk-to-pk, 44.1kHz, 16bit)
- 2 audio out (DC-coupled, -5 to -5V, 44.1kHz, 16bit)
- 8x CV in (DC-coupled, 0-10V with pots attenuating, 22.05kHz, 16bit, 12V safe). Optionally, up to 4x of the CV in sockets can be swapped for trigger ins, leaving the pots connected directly to Bela's analog inputs.
- 8x CV out (DC-coupled, 0-5V, 22.05kHz, 16bit)
This means that if you write a full-scale (0 to 1) output to a CV out (0V to 5V) and loop it back to the CV in, this will correspond to a half-scale reading on the analog input (0 to 0.5). On top of this you need to add the considerations about tolerance mentioned above. That's expected behaviour although it may appear confusing. The rationale behind it is that 0V to 5V is the maximum available voltage at the output without additional amplification and that it was easy enough to get a 0V to 10V input range with just passives. Btw, a different selection of resistors can give different (unipolar) input ranges, see here. Also consider the 5V rail tends to be quite noisy so the useful (less noisy) CV out range is often constrained to something like 0V to 4.8V.
For calibration, I'd read the value with the pot at a minimum (again, I'd be surprised if this is more than 0.01 away from 0) and then again with the pot at the max, then this should work:
[adc~ 3]
|
[-~ $1]
|
[*~ $2]
|
[clip~ 0 1]
where $1 = minReading
and $2 = 1 / (maxReading - minReading)
.
FatJak The non zero minimum is on all the channels, as measured by voltmeter in CV OUT.
I am not sure I understand this. To test if there is any offset at CV OUT, you should have a patch like this:
[sig~ 0]
|
[dac~ 3]
and read the output at CV out 0. I expect that to be very close to 0V. According to the AD5688 datasheet https://www.analog.com/media/en/technical-documentation/data-sheets/AD5628_5648_5668.pdf, figure 28, it should be under 2mV. Then try again with [sig~ 0.96]
which should give a nominal out of 4.8V.
FatJak Potx: real measure min-max volt. on CV OUT / approx. displayed volt. with bela_scope / approx. ratio
It seems that you are conflating a few things here: are you testing with something like this?
[adc~ 3]
| \
| [dac~ 27] // scope
|
[dac~ 3] // out
As you see there:
- the scope does not display a voltage, but rather a value between 0 and 1, so what's your "approx displayed volt"?
- any errors in the ADC range will translate to an offset and scale error on the DAC
FatJak we could use a formula to reach and overtake 0-1 and use almost the full range of the pot
well, i'm not forcing you to use the calibration patch i linked earlier
is that patch not precise enough for your purposes? i mean, when used correctly, you shouldn't have any noticeable dead spots on the ends of your pot movement - and you most certainly do not need to sacrifice half of your pot rotation.
for calibration, it's a bit tedious going back and forth between Pd and the IDE, but once it's done it just works. for me, at least. but if you come up with a better or easier way, i would be most interested, actually!
- Edited
giuliomoro The Bela scope will show whatever you send to it, so its relation to real-world voltages (if any) is determined by what signals you connect to it.
Yes, sorry, I forgot to tell that it was just [dac~ x]- - - -[bela_scope]
, so just reading the pot value by moving it, with nothing connected to the CV IN.
giuliomoro FatJak The non zero minimum is on all the channels, as measured by voltmeter in CV OUT.
I am not sure I understand this.
For the "real" voltage measurement, I just done it by moving the pot and reading the value with a cable plugged in CV OUT and connected to the voltmeter.
giuliomoro the scope does not display a voltage, but rather a value between 0 and 1, so what's your "approx displayed volt"?
The "approximative displayed voltage" was what I thought to be the out voltage graphically viewable by moving the pot, which I believed was from 0 to max voltage. With this simple patch [dac~ x]- - - -[bela_scope]
. So, yes, I was in total conflation.
giuliomoro any errors in the ADC range will translate to an offset and scale error on the DAC
I’ll try this patch and see what will be output.
Thanks again @giuliomoro for all this attention.
All this object is a piece of cake of confusion for me (computer to analog and back to data with Pd, hardware settings, IDE settings… Even if all the informations are available). So, sorry if I ask too much questions, if I share confusing experiencies told with approximative english, and if I can't fully understand the given answers.
- Edited
Remork well, i'm not forcing you to use the calibration patch i linked earlier
Well said ! I think I just could find a harder way to do it.
Perhaps I didn't understood where to find the right values (individuals min and max voltage depending of the pots) to take as references to do the individual calculations:
- Are they the output voltages which could be measured by a voltmeter plugged in the CV OUT ?
- Or are they the ones viewable with the bela_scope ? How to determine it with the scope ?
- Edited
FatJak I think I just could find a harder way to do it.
for clarity's sake: the patch i linked to only calibrates the incoming voltages, so the [adc~]
reading from the input jacks, and therefore the pots when nothing is plugged into the jacks.
Pd expects a true 0-10v and will map this to [0-1]
automatically. but if the voltage falls a bit short, you'll never reach [1]
, as you noticed. so the idea is to correct for a slightly low incoming voltage (not quite reaching the 'ideal' 10v) in software.
i mostly just use the onboard pots of Pepper for calibration, because you need some sort of reference point to start from.. so i use the internally provided "not-quite-10v". if you're working with other modules that don't quite reach 10v, the same method applies, but i feel you lose consistency over different patches with different modules.
so.
maybe a bit redundant, but let me explain what the patch does.
feel free to skip.
looking at the patch, the top left inlet is where you hook up your [adc~], aka the pot/input you're after.
samplerate is just that: how often you want the pot value to be read. hook up a [metro] there.
the [lop~] should smooth out the readings enough so you get something that doesn't bounce around too much after the third decimal. so if you're getting, for example, 0.124756547 bouncing up and down, at least up to the 0.124 it should be relatively steady.
the idea is to multiply that 0.124756547 by 1000, and the remove the decimals by running the result through an [ i ].
so now you have 0.124756547 * 1000 = 124.756547, through [ i ] = 124.
this number gets clipped if needed, then divided by 1000 again.. = 0.124.
which is the same steady part we got to begin with. boring
now, for calibration: what i do is run a [print] object somewhere in this path to monitor Pd's values in the IDE.
say you have the pot cranked, so you're expecting a 1 at the [snapshot~] output. however, you're seeing 0.987.
now 1 / 0.987 = 1.013 approx. (ratio of ideal to actual number, if you like.)
meaning: if i multiply the incoming reading by 1013 instead of by 1000 (or better yet: a bit more, say 1015) , that's 0.987 * 1015 = 1001.805.
run that through the [ i ] and you get 1001. that gets clipped to 1000, which gives you a clean 1 at the output.
the bit that gets clipped is so small (1/1000) i don't expect you to notice that on your pot rotation.
in practice, you can actually get away with larger offsets for safety.
you can set that offset - the difference between 1000 and 1015 - at the inlet on the right.
just send it the number 15, it will replace the default 1000 with 1015 and you're good to go.
or set the multiplier manually if you prefer, of course.
there might be easier ways to do this, but this was meant to be universally applicable.
there might also be harder ways to do it
- Edited
Remork
Thanks a lot for this reminder !
I discover that a problem could be that I don't knew that it could be possible to had informations from the IDE like you done :
Remork what i do is run a [print] object somewhere in this path to monitor Pd's values in the IDE.
Allow me to ask the question : how do you monitor a value in the IDE ?
if you have something like
[adc~ 3]
|
| [loadbang]
| |
| [metro 100]
|/
[snapshot~]
|
[print]
this will print the value in the console