Play sine wave
-
Hi! AFAIK, our framework doesn't provide such low-level audio stuff.
-
Hi,
The sine wave generation is indeed out of Qt's scope, however you can use QAudioOutput to send the data to your sound card.
-
That's strange. Meanwhile I found this post but I'm not sure what happens there, there's too much maths. I'll take a deeper look though.
Thanks :)@cpper said in Play sine wave:
I found this post but I'm not sure what happens there, there's too much maths.
The maths is for calculating the values of different samples in a digital sine wave.
Let's say you take a single cycle of a sine wave, and split it into N samples. The simplest way to generate this wave is:
double samples[N]; for (int n = 0; n < N; ++n) samples[n] = sin( 2*PI * n/N );
For example, if you want to split your wave cycle into 1000 samples, then
N = 1000
andsamples[ 0] = sin( 2*PI * 0/1000 ); samples[ 1] = sin( 2*PI * 1/1000 ); samples[ 2] = sin( 2*PI * 2/1000 ); ... samples[997] = sin( 2*PI * 997/1000 ); samples[998] = sin( 2*PI * 998/1000 ); samples[999] = sin( 2*PI * 999/1000 );
That's it, you now have an array of samples that represents one cycle of a sine wave.
-
Hi @cpper
One original way can be to use QML and shadereffect (only if you have to use QML , and have knowledge in GPU programming)
http://doc.qt.io/qt-5/qml-qtquick-shadereffect.html
You can use this shader effect for example
http://glslsandbox.com/e#36864.2
You can have a look at this link :
http://stackoverflow.com/questions/27118049/qml-need-idea-how-to-animate-waves
and this link :
http://qmlbook.github.io/ch09/index.html
But for me shaders are not simple and intuitive ,
And i don't even know if what I propose is recommended...
-
Hi @cpper
One original way can be to use QML and shadereffect (only if you have to use QML , and have knowledge in GPU programming)
http://doc.qt.io/qt-5/qml-qtquick-shadereffect.html
You can use this shader effect for example
http://glslsandbox.com/e#36864.2
You can have a look at this link :
http://stackoverflow.com/questions/27118049/qml-need-idea-how-to-animate-waves
and this link :
http://qmlbook.github.io/ch09/index.html
But for me shaders are not simple and intuitive ,
And i don't even know if what I propose is recommended...
@mostefa said in Play sine wave:
Hi @cpper
One original way can be to use QML and shadereffect (only if you have to use QML , and have knowledge in GPU programming)
http://doc.qt.io/qt-5/qml-qtquick-shadereffect.html
You can use this shader effect for example
http://glslsandbox.com/e#36864.2
You can have a look at this link :
http://stackoverflow.com/questions/27118049/qml-need-idea-how-to-animate-waves
and this link :
http://qmlbook.github.io/ch09/index.html
But for me shaders are not simple and intuitive ,
And i don't even know if what I propose is recommended...
I believe @cpper is asking about sound waves, not graphical waves
-
@mostefa said in Play sine wave:
Hi @cpper
One original way can be to use QML and shadereffect (only if you have to use QML , and have knowledge in GPU programming)
http://doc.qt.io/qt-5/qml-qtquick-shadereffect.html
You can use this shader effect for example
http://glslsandbox.com/e#36864.2
You can have a look at this link :
http://stackoverflow.com/questions/27118049/qml-need-idea-how-to-animate-waves
and this link :
http://qmlbook.github.io/ch09/index.html
But for me shaders are not simple and intuitive ,
And i don't even know if what I propose is recommended...
I believe @cpper is asking about sound waves, not graphical waves
@JKSH said in Play sine wave:
@mostefa said in Play sine wave:
Hi @cpper
One original way can be to use QML and shadereffect (only if you have to use QML , and have knowledge in GPU programming)
http://doc.qt.io/qt-5/qml-qtquick-shadereffect.html
You can use this shader effect for example
http://glslsandbox.com/e#36864.2
You can have a look at this link :
http://stackoverflow.com/questions/27118049/qml-need-idea-how-to-animate-waves
and this link :
http://qmlbook.github.io/ch09/index.html
But for me shaders are not simple and intuitive ,
And i don't even know if what I propose is recommended...
I believe @cpper is asking about sound waves, not graphical waves
Ah , i think that you are right , sorry !