peakamp~ output is a little unexpected
Hello everyone, just a quick question regarding the output of peakamp~. I have been feeding the signal from a mic into it and watching the output but was a bit surprised when I saw the output exceed 1. I thought that any signal that exceeded 1 would be squared off, which, while giving the impression of being louder, actually still measures 1 in amplitude. This is obviously not right in relation to peakamp~ and I was wondering if anyone could give a little clarification? Many thanks! :)
The same thing happens with the "mxj buf.Op" "max" message, how can the content of a buffer~ have an amplitude value of more that 1? I am definitely missing something.
A floating point number (which is how signals are stored in max) can be but bigger than 1 - However, sound coming in and out of max should be expected to be between -1 and 1 - that's the range of the audio in terms of the hardware. It is possible that larger numbers come in without being clipped - but I wouldn't expect it (the driver should probably not allow that to happen if it's written properly).
The most likely explanation is that you are multiplying your signal somewhere and making it's range exceed -1. to 1. That's absolutely fine and allowable within MSP, although it's common to keep signals in this range so they can be easily monitored etc. Within the MSP world none of your signals will be clipped -1. to 1. NOr would you want them to be, as there is a lot of stuff which you might need to do with numbers outside that range (for instance dealing with values in dB etc.)
HTH
Alex
Yeah, that kind of echoes everything that I thought. I have looked at the patch and I am pretty sure that I am not multiplying my signal anywhere, I just can't work this out. I am using the built in mic on my macbook pro for testing. I've attached the patch, I'd really appreciate someone having a look to see if they can see what's up with it. The patch is really simple.
p.s How do I make max text files small and compact like everyone else for posting on here?! I've gone to "file/save as" but I don't get an option to save as a text file so I am having to use the "open as text" option which makes my text patches always look like this:
{
"patcher" : {
"fileversion" : 1,
"rect" : [ 25.0, 69.0, 331.0, 483.0 ],
"bglocked" : 0,
"defrect" : [ 25.0, 69.0, 331.0, 483.0 ],
"openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
"openinpresentation" : 0,
"default_fontsize" : 12.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 0,
"gridsize" : [ 10.0, 10.0 ],
"gridsnaponopen" : 0,
"toolbarvisible" : 1,
"boxanimatetime" : 200,
"imprint" : 0,
"enablehscroll" : 1,
"enablevscroll" : 1,
"devicewidth" : 0.0,
"boxes" : [ {
"box" : {
"maxclass" : "comment",
"text" : "< gate, if signal exceeds this limit it is measured by peakamp",
"linecount" : 3,
"numoutlets" : 0,
"fontname" : "Arial",
"fontsize" : 12.0,
"patching_rect" : [ 130.0, 230.0, 150.0, 48.0 ],
"numinlets" : 1,
"id" : "obj-3"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "loadmess 1",
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "" ],
"fontsize" : 12.0,
"patching_rect" : [ 70.0, 200.0, 72.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-1"
}
}
, {
"box" : {
"maxclass" : "ezadc~",
"numoutlets" : 2,
"outlettype" : [ "signal", "signal" ],
"patching_rect" : [ 110.0, 325.0, 34.0, 34.0 ],
"numinlets" : 1,
"id" : "obj-60"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "togedge",
"numoutlets" : 2,
"fontname" : "Arial",
"outlettype" : [ "bang", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 30.0, 285.0, 54.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-145"
}
}
, {
"box" : {
"maxclass" : "flonum",
"numoutlets" : 2,
"fontname" : "Arial",
"outlettype" : [ "float", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 75.0, 225.0, 50.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-147"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "> 0",
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 30.0, 255.0, 32.5, 20.0 ],
"numinlets" : 2,
"id" : "obj-149"
}
}
, {
"box" : {
"maxclass" : "flonum",
"numoutlets" : 2,
"fontname" : "Arial",
"outlettype" : [ "float", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 15.0, 225.0, 50.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-151"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "round",
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "" ],
"fontsize" : 11.595187,
"patching_rect" : [ 15.0, 195.0, 40.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-152"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "delay 22",
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 30.0, 315.0, 56.0, 20.0 ],
"numinlets" : 2,
"id" : "obj-153"
}
}
, {
"box" : {
"maxclass" : "flonum",
"numoutlets" : 2,
"fontname" : "Arial",
"outlettype" : [ "float", "bang" ],
"fontsize" : 11.595187,
"patching_rect" : [ 75.0, 410.0, 50.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-155"
}
}
, {
"box" : {
"maxclass" : "button",
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"patching_rect" : [ 30.0, 345.0, 20.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-157"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "peakamp~",
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "float" ],
"fontsize" : 11.595187,
"patching_rect" : [ 75.0, 380.0, 63.0, 20.0 ],
"numinlets" : 2,
"id" : "obj-158"
}
}
, {
"box" : {
"maxclass" : "flonum",
"numoutlets" : 2,
"fontname" : "Arial",
"outlettype" : [ "float", "bang" ],
"minimum" : 0.0,
"fontsize" : 12.0,
"maximum" : 127.0,
"patching_rect" : [ 15.0, 165.0, 50.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-159"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "scale 0. 1. 0 127",
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "" ],
"fontsize" : 12.0,
"patching_rect" : [ 15.0, 135.0, 99.0, 20.0 ],
"numinlets" : 6,
"id" : "obj-160"
}
}
, {
"box" : {
"maxclass" : "meter~",
"numoutlets" : 1,
"outlettype" : [ "float" ],
"patching_rect" : [ 30.0, 105.0, 58.0, 12.0 ],
"numinlets" : 1,
"id" : "obj-161"
}
}
, {
"box" : {
"maxclass" : "meter~",
"numoutlets" : 1,
"outlettype" : [ "float" ],
"patching_rect" : [ 15.0, 75.0, 58.0, 12.0 ],
"numinlets" : 1,
"id" : "obj-164"
}
}
, {
"box" : {
"maxclass" : "ezadc~",
"numoutlets" : 2,
"outlettype" : [ "signal", "signal" ],
"patching_rect" : [ 15.0, 15.0, 34.0, 34.0 ],
"numinlets" : 1,
"id" : "obj-165"
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-1", 0 ],
"destination" : [ "obj-147", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-60", 0 ],
"destination" : [ "obj-158", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-165", 0 ],
"destination" : [ "obj-164", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-165", 1 ],
"destination" : [ "obj-161", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-164", 0 ],
"destination" : [ "obj-160", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-161", 0 ],
"destination" : [ "obj-160", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-149", 0 ],
"destination" : [ "obj-145", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-151", 0 ],
"destination" : [ "obj-149", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-147", 0 ],
"destination" : [ "obj-149", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-152", 0 ],
"destination" : [ "obj-151", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-159", 0 ],
"destination" : [ "obj-152", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-158", 0 ],
"destination" : [ "obj-155", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-157", 0 ],
"destination" : [ "obj-158", 0 ],
"hidden" : 0,
"midpoints" : [ 39.5, 378.0, 84.5, 378.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-160", 0 ],
"destination" : [ "obj-159", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-145", 0 ],
"destination" : [ "obj-153", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-153", 0 ],
"destination" : [ "obj-157", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
]
}
}
It's because (as far as I know) msp signals are represented with 32-bit float precision, which means that the dynamic range from absolute 0 signal to digital clipping inside msp is massive. It's only when you send a signal out of the 32-bit float environment (like through the dac~) that it becomes fixed point and dynamic range becomes an issue, because it is reduced to approx 144dB.
It's the same in a DAW, you CAN (it's not good practice however) create a mix with loads of channels past clipping, and as long as your master output is below 0dBfs your mix will probably be unclipped. It's never a good idea to do this though, because if your plugins don't process internally at at least 32-bit float (most do, but it's hard to know for sure) you can clip inside the plugin, and you could also cause inter-sample peaks of greater than 0dBfs at your master output, even though your metering says you're peaking below that. You need a bit-meter or up-sampled sample peak-meter to be sure. Of course, it makes more sense to make sure you never exceed -6dB at the output, it's 24-bit so it makes no difference to the sound.
But enough about DAWs, I digress.....
I've not tried it, but I'm sure that the same applies to a buffer~. You should be able to store sample values waay past -1 and 1, you just won't be able to see them in waveform~ or the buffer~ window, and as long as you scale the values back into the -1. to 1. range before sending it out of max/msp.
-edit: I take too long to reply :)-
For sending patches, there is a "copy compressed" in the Edit menu, use that and paste. (I bet there is somewhere i big red sticky on the forum which explains it...)
There is nothing wrong in your patch, and I see the same (though you could use a [> 0.001] and get rid of the scale object).
It seems the internal driver of my MacBook microphone does have some valuable headroom - I don't mind... (my Quatafire clips at 0dB as expected..)
If its too much for you, adjust the input sensitivity in the sound panel...
Stefan
Thanks for your replies everyone, I've really got to the bottom of this now with your help!