# Imaginary numbers samples

What if audio samples were allowed to be imaginary/complex numbers? Like, if a square root effect was used on a sound it would make some samples imaginary numbers, how would a theoretical complex numbers speaker play such sounds and how would they sound?

There would be a new type of imaginary wave. Standard sinewave for time x is sin(x), but imaginary wave for time x is (-1)^x. How would that sound?

They’re not. Sample values have to comply with their defined format; that is, for integer audio formats they must be integers, and for float audio formats they must be floats. For an imaginary number to be valid, the audio format would have to support imaginary numbers, which as far as I’m aware, no such audio formats exist.

Then suppose an audio format supporting complex numbers artificially existed, and so did the speakers for it. What would happen?

Sound is an air-pressure wave or air pressure variations (superimposed on the ambient barometric pressure).

In general, real world sound is not a sine (or cosine) wave but it can be graphed or plotted or represented “mathematically”. And of course, you can generate a pure sine (or cosine) wave and reproduce it as sound.

A sine wave sounds identical to a cosine wave and inverting the sine or cosine wave doesn’t change the sound. …That’s assuming no “reference”. If you switch the polarity of one stereo speaker or invert one channel in Audacity, you’ll hear the effects.

You can convert an arbitrary mathematical expression to sound if the frequency in within the audible range, and if the amplitude is “reasonable” (not to quiet to be heard and not too loud to be practically reproduced).

A microphone converts sound waves to an (analog) electrical signal. A speaker converts electrical signals to sound.

Audio information can be recorded and stored in analog form mechanically (vinyl records) electro-magnetically (tape) or optically (on film), and probably in other ways I can’t think of at the moment.

When audio is digitized (sampled), the information is stored as a series of samples that represent positive or negative amplitude at one point in-time (a magnitude or scalar). The analog sound is reproduced by “connecting the dots” and “smoothing”. [u]Digital Audio Fundamentals[/u]

P.S.
If you want to “play around” with math/programming and sound, check out the [u]Nyquist[/u] programming language. Or [u]GoldWave[/u] (\$45 USD after free trial) has an Expression Evaluator that’s probably easier to get started with. GoldWave’s Expression Evaluator has a simple dialog box so you can quickly enter an expression (without any programming) and there are presets that you can use or modify.

I also know that a sample can be 0. But what if it could be any complex number? Clearly interpolation methods work perfectly fine with complex numbers!

They can’t. You would need to define a format that doesn’t exist. All sample formats that currently exist define sample values as either integers or floating point numbers.

Similar function available via this Audacity plugin … Expression Generator

Write the real part of the sample in one float, and the imaginary part of the sample in another float. That’s exactly what complex numbers calculators do. What’s the problem with generalizing this to sound?

So, for example, where on the timeline do you propose place the 10th sample value?

What do you mean by “10th sample value”? Doesn’t it depend on frequency?

a standard sine wave would go like this:

0, 0.707, 1, 0.707, 0, -0.707, -1, -0.707, …

an imaginary wave would go like this:

1, 0.707+0.707i, i, -0.707+0.707i, -1, -0.707-0.707i, -i, 0.707-0.707i, 1, …

Sound waveform only runs in one direction: forwards in time.
Could generate a sound spectrogram with imaginary numbers, but not a sound waveform.

These are my 2 cents

At best and very briefly, the imaginary number/part in an audio sample (perhaps its format will be decided on, someday in the future; likely after many centuries ) would denote the amplitude of an added sound whose instantanious harmonies (forming its complex signal) are shifted each by 90 degree.

Kerim

In case of complex numbers the amplitude of each sample would be 2-dimensional (as opposed to 1-dimensional with real numbers). Speakers that can amplitude sound 2-dimensionally are complex numbers speakers but only produce different results from regular speakers when given a complex numbers input.

Also the spectrograms in the video have nothing to do with complex numbers. The spectrogram images are made of real numbers pixels, and so is the resulting sound. This means that’s off-topic.

Considering that this is the Audacity forum, this whole thread is off-topic.

Yes, but FFT is used for interpreting the pixels as sound, and FFT makes use of real and imaginary pairs.

The problem with this statement is that “audio sample” has a precise definition. It is a time + value pair, where both time and value are real numbers, so by definition an “audio sample” cannot be imaginary / complex numbers. You may choose to define a “thing” as a time / value pair where one or both may be imaginary, but that “thing” is not an “audio sample” in the accepted sense of the concept.

Similarly, one could say: “What if a chair was allowed to have an imaginary/complex number of legs?” This statement is equally nonsensical - it wouldn’t be a “chair”, you couldn’t make it in real life, and you couldn’t sit on it.

The spectrograms in the video are fractals. Fractals are created using complex-numbers.
So fractal patterns as spectrograms are a way of using complex-numbers to generate sounds.

How can an entire topic be off-topic to itself?

That’s like saying “addition” has a precise definition as an operation on real numbers.

But it’s still irrelevant. This topic is about audio samples holding complex numbers amplitudes.

Not “off-topic to itself”, but “off-topic to this forum”.
Although this forum board (“Audio Processing”) is pretty general, the forum itself is the “Audacity” forum. Even in this general section, discussions are expected to be related to Audacity in some shape or form. This discussion has nothing at all to do with Audacity, so it is at the discretion of the forum moderators whether to allow it or not.