Difference in float and signal

Jun 8, 2010 at 5:13pm

Difference in float and signal

Hello Max/MSP forum!

I wonder whether someone could teach me here something?
What and why is there a difference between these two signals
if both have the same source (code below).

Explanation appreciated!
All the best
Krisztian

code:

– Pasted Max Patch, click to expand. –
#50800
Jun 8, 2010 at 5:27pm

well one is coming straight from a cosine wave oscilator, the other is just a the same osc resampled (at 50Hz, one sample each 20 ms), therefore it’s not continuous anymore.

#182314
Jun 8, 2010 at 5:41pm

Here is a little change i made to your example patch to help you visualize the difference—while Emmanuel was beating me to the answer ;)

I replaced your spectroscope~ objects with scope~ objects so you can kind of see the sample-and-hold situation EJ describes.

– Pasted Max Patch, click to expand. –
#182315
Jun 8, 2010 at 5:59pm

this is interesting… the [number~] object only does 20ms interval update.
Is there a way to resample into a continuous signal and if not why?

thank you for both!
K

#182316
Jun 8, 2010 at 6:21pm

If you want to resample, that probably means that you want to loose samples. Converting from the signal domain to the control domain will result in lost of precision, because you can’t get 44100 values per seconds (assuming 44.1kHz is your sample rate), that would be really inefficient. It’s hard to answer really because it’s unclear what you want to achieve though ;-)

#182317
Jun 8, 2010 at 6:49pm

sorry, my English teachers were not strict with me:)

Your reply was needed to give me an idea how to proceed in testing two different EEG analysis approaches, one that uses the ‘classic-vocoder example’ and another one with the [ffb~] object. I think I have to sit down and study DSP from the basic.
thanks again, and all the best, Krisztian

#182318
Jun 8, 2010 at 8:30pm

hello again,
It is quite crucial to understand the following. Please ‘pass or fail me’ on this DSP issue:

I receive 120 samples in a second from the serial port (EEG – 120hz).
Do I HAVE to make this ‘float’ (-0.0019859, -0.02141, ….) into a ‘signal’ in order to use (1) digital filters or (2) FFT?

If the answer is yes, what exactly does sig~ do? When it increases the sample rate (120hz to 44.1kHz) does it add 43.920 samples by connecting the original ones (120)?

Please let me know whether I am right or wrong. Apologies if this is really silly :)

all the best
K

#182319
Jun 9, 2010 at 7:35pm

Hello the Dude

It is only analysis of EEG, where I’d like to use the energy of certain bandwiths. With 120hz sampling rate the changes in the signal are not too gradual, but I guess for analysis it should be OK. As there is no intention to sonify, to make the signal audible, I assume we do not need interpolation.

“first cycle at 120Hz could input 42.3 and so the 400 samps(at 48k) will all be 42.3, then the next cycle…”

A float, I can imagine as being an array of numbers. The signal must be a bit more complex, although [number~] outputs a float like value. In the above line, what does it actually mean, when you say “first cycle inputs 42.3…” ?

I reckon it creates a sine wave of 42.3hz and this freq stays for an other 400 samples (at 48k). Is this close to the truth?

Thank you, this helps a lot.
all the best
Krisztian

#182321
Jun 9, 2010 at 9:21pm

aha! I think I am getting it:

If I use [cycle~ 440], it outputs a float from -1.0 to 1.0, 440 times in a second ! I assume, as the software is digital, the sine wave or ANY SIGNAL is digital too, and therefore it is “an array of samples storing floats”. The main difference between the float and a signal is that signal has a higher sample rate.

I think your technical English is pretty helpful :)

#182323
Jun 10, 2010 at 4:37pm

“The more you know, the less you understand.” Tao Le Ching

Though it makes more sense now, and I understand what I was initially after… there is much to learn yet.
The wiki and alike pages were useful, however I seem to be motivated by one to one teachings :)

Appreciate your time and help, all the best, Krisztian

#182325

You must be logged in to reply to this topic.