A strange way to analyze sound using a quantum computer .

Andrei
Transilvania Quantum
5 min readFeb 10, 2020

Quantum computing “ is one of the most hyped subjects in the last period of time, especially since Google proclaimed “Quantum supremacy “ . But Quantum computing really is an amazing and not very well known realm and as curious creatures, it is our duty to study these and embrace a new way of thinking and thanks to IBM Quantum Experience we can do it, so I began to read more and more about it. Some of the most interesting articles I have encountered were related to “Quantum image processing” [I’ll link them bellow ]… . One day I was wondering about how Quantum sound works, unfortunately I didn’t find so many articles but still I have found some well done and very. Interesting paper [I’ll link them bellow] . After that I asked myself:

“How Flexible Representation of Quantum images (FRQI) will work in the case of sound ? Is this an efficient method ?” .

Firs of all ,I am going to succinctly present the classical method of working with sound on classical devices . After this I will present a possible alternative in quantum computing(To put it simply I will apply the FRQI described in the articles linked in references, but on a sound)

Classical :

Classically sound can be stored as a string of amplitudes. .We must also know the number of time samples/second.

In a lot of cases, sound recognition for example, it is favorable to work in frequency domain in our algorithm . We can do these by applying Fourier transform on initial data.

One of these algorithms is the Shazam algorithm for music recognition. For curiosity and better understanding see Cameron Macleod — Implementing a Sound Identifier in Python.

Quantum option:

I-need to construct a quantum state which can represent my sound. For these I need to have a state for every point in time (example for three time points i need |00> |01> |10> ,2 qubits). Every samples (point in time) will correspond to a possible state and the probability to find my system in the state represents the amplitude of sound.

Because state vectors must be normalized by dividing each amplitude to the sum over all amplitude square at the power of (1/2).

The State vector for 1 second look like these :

Now we need to initialize our state and this is not a trivial thing but fortunately Qiskit already has a function for these .

Now is the time to extract our signal. After we make a huge number of measurements we can rebuild the state vector and after these we can extract the amplitude. This is not an efficient method at all because of the huge number of measurements that we have to do.

1024 shots
1024 shots, 10240 shots ,102000 shots

But when we work with sound we are often interested in sound frequency which can be obtained by playing Fourier transform to initial data.Quantum Fourier transform is more efficient then classical Fourier transform .

The result will look like:

100 shots 400 shots

Now we can take a little interval of time and apply the algorithm described above. For each moment in time we have some frequency but for the moment we are interested just in max frequency because we want to reduce our 3D map to a 2D one. After we generate these we can use our output in whatever machine learning program we want.

frequency amplitude in first time interval

Advantages:

  • Quantum Fourier transform is more efficient than the classical one
  • If you work in frequency domain the number of measurements can be low in especially when you are only interested in the large frequency spike .

Disadvantages:

  • To extract direct sound amplitude you need a lot of measurements.
  • Quantum errors can corrupt your data

Conclusions:

In coclusion this is a useful way of representing sound in a quantic calculator if the frequencies of the sound waves interest us.

Future plan:

I intend to implement a proper program for max frequency identification and then try to create a complete quantum program for songs or diverse sound recognition inspired from Shazam algorithm.

Code can be found here.

If you have some interesting idea , questions or useful advice, share it with me.cPlease give me feedback to improve myself.

Thanks for your time! Stay curious.

References:

I want to thank Sorin Bolos for taking the time to help me !

Flexible Representation of Quantum Images and Its Computational Complexity Analysis

Quantum Image Processing and Its Application to Edge Detection:Theory and Experiment

Quantum Image Edge Detection Algorithm

Flexible Representation and Manipulation of Audio Signals on QuantumComputers

Experiments in Sound and Music Quantum Computing

--

--