Informations about Fourier Transform for a Python project (sound manipulation)












0












$begingroup$


I have a project in Python with a friend where we want to manipulate music sound, and we'll need Fourier Transforms, so I made research online and wanted to know if I understand correctly the concepts.

Here is what I think I understand so far:



(the module numpy is noted np)



For a temporal signal x(t) made to an array x, sampled at a constant interval dt with N samples, sampled at a sampling rate sr:




  • the Fourier transform decompose a signal x(t) in an infinite sum: $x(t)= A_{1}e^{iw_1t} + A_{2}e^{iw_2t}+A_{3}e^{iw_3t}+...+ A_{n}e^{iw_nt} \$
    where $A_n = r_ne^{ip_n}$, and $w_n$ is a frequency

  • amplitude at the given frequency $w_n$: $r_n = np.abs(A_n) = sqrt{real(A_n)^2 + complex(A_n)^2}$

  • phase at the given frequency $w_n$: $p_n = np.angle(A)$

  • np.fft.fftfreq(N, 1/sr): returns all the frequencies $w$ present in the wave as an array: $[w_1, w_2, w_3, ..., w_n]$

  • np.fft.fft(array x): returns a 2D array with complex values which correspond to $[A_1, A_2, ..., A_n]$

  • period of the signal: $T = dt times N$

  • fundamental frequency (Hz): $df = 1/T$

  • fundamental frequency (rad/sec): $dw = 2π/T$

  • fundamental frequency (adimensional): $f = np.fft.fftfreq(N)times N times df$ ?

  • fundamental frequency (adimensional): $w = np.fft.fftfreq(N) times N times dw$ ?

  • duration = number of frames (length of my array) $div$ sample rate ?


I had some questions too:




  • In order to plot/make a spectrogram, I need to have the duration of my wave, the frequencies ($w_1, w_2, ..., w_n$) in it, and the amplitudes for each frequencies ($A_1, A_2, ..., A_n$). For each value of t of my wave duration, I have the frequencies. I then calculate the amplitude of all the frequencies since its a function of time (e.g: $A_1e^{iw_1t}$) ?

  • If I want to generate a more complex sound that just one frequency, I need to generate many frequencies which amplitudes vary over time ? I want to be able to generate samples (i.e: those kind of sound : link)


Thank you very much for your attention!










share|cite|improve this question









$endgroup$

















    0












    $begingroup$


    I have a project in Python with a friend where we want to manipulate music sound, and we'll need Fourier Transforms, so I made research online and wanted to know if I understand correctly the concepts.

    Here is what I think I understand so far:



    (the module numpy is noted np)



    For a temporal signal x(t) made to an array x, sampled at a constant interval dt with N samples, sampled at a sampling rate sr:




    • the Fourier transform decompose a signal x(t) in an infinite sum: $x(t)= A_{1}e^{iw_1t} + A_{2}e^{iw_2t}+A_{3}e^{iw_3t}+...+ A_{n}e^{iw_nt} \$
      where $A_n = r_ne^{ip_n}$, and $w_n$ is a frequency

    • amplitude at the given frequency $w_n$: $r_n = np.abs(A_n) = sqrt{real(A_n)^2 + complex(A_n)^2}$

    • phase at the given frequency $w_n$: $p_n = np.angle(A)$

    • np.fft.fftfreq(N, 1/sr): returns all the frequencies $w$ present in the wave as an array: $[w_1, w_2, w_3, ..., w_n]$

    • np.fft.fft(array x): returns a 2D array with complex values which correspond to $[A_1, A_2, ..., A_n]$

    • period of the signal: $T = dt times N$

    • fundamental frequency (Hz): $df = 1/T$

    • fundamental frequency (rad/sec): $dw = 2π/T$

    • fundamental frequency (adimensional): $f = np.fft.fftfreq(N)times N times df$ ?

    • fundamental frequency (adimensional): $w = np.fft.fftfreq(N) times N times dw$ ?

    • duration = number of frames (length of my array) $div$ sample rate ?


    I had some questions too:




    • In order to plot/make a spectrogram, I need to have the duration of my wave, the frequencies ($w_1, w_2, ..., w_n$) in it, and the amplitudes for each frequencies ($A_1, A_2, ..., A_n$). For each value of t of my wave duration, I have the frequencies. I then calculate the amplitude of all the frequencies since its a function of time (e.g: $A_1e^{iw_1t}$) ?

    • If I want to generate a more complex sound that just one frequency, I need to generate many frequencies which amplitudes vary over time ? I want to be able to generate samples (i.e: those kind of sound : link)


    Thank you very much for your attention!










    share|cite|improve this question









    $endgroup$















      0












      0








      0





      $begingroup$


      I have a project in Python with a friend where we want to manipulate music sound, and we'll need Fourier Transforms, so I made research online and wanted to know if I understand correctly the concepts.

      Here is what I think I understand so far:



      (the module numpy is noted np)



      For a temporal signal x(t) made to an array x, sampled at a constant interval dt with N samples, sampled at a sampling rate sr:




      • the Fourier transform decompose a signal x(t) in an infinite sum: $x(t)= A_{1}e^{iw_1t} + A_{2}e^{iw_2t}+A_{3}e^{iw_3t}+...+ A_{n}e^{iw_nt} \$
        where $A_n = r_ne^{ip_n}$, and $w_n$ is a frequency

      • amplitude at the given frequency $w_n$: $r_n = np.abs(A_n) = sqrt{real(A_n)^2 + complex(A_n)^2}$

      • phase at the given frequency $w_n$: $p_n = np.angle(A)$

      • np.fft.fftfreq(N, 1/sr): returns all the frequencies $w$ present in the wave as an array: $[w_1, w_2, w_3, ..., w_n]$

      • np.fft.fft(array x): returns a 2D array with complex values which correspond to $[A_1, A_2, ..., A_n]$

      • period of the signal: $T = dt times N$

      • fundamental frequency (Hz): $df = 1/T$

      • fundamental frequency (rad/sec): $dw = 2π/T$

      • fundamental frequency (adimensional): $f = np.fft.fftfreq(N)times N times df$ ?

      • fundamental frequency (adimensional): $w = np.fft.fftfreq(N) times N times dw$ ?

      • duration = number of frames (length of my array) $div$ sample rate ?


      I had some questions too:




      • In order to plot/make a spectrogram, I need to have the duration of my wave, the frequencies ($w_1, w_2, ..., w_n$) in it, and the amplitudes for each frequencies ($A_1, A_2, ..., A_n$). For each value of t of my wave duration, I have the frequencies. I then calculate the amplitude of all the frequencies since its a function of time (e.g: $A_1e^{iw_1t}$) ?

      • If I want to generate a more complex sound that just one frequency, I need to generate many frequencies which amplitudes vary over time ? I want to be able to generate samples (i.e: those kind of sound : link)


      Thank you very much for your attention!










      share|cite|improve this question









      $endgroup$




      I have a project in Python with a friend where we want to manipulate music sound, and we'll need Fourier Transforms, so I made research online and wanted to know if I understand correctly the concepts.

      Here is what I think I understand so far:



      (the module numpy is noted np)



      For a temporal signal x(t) made to an array x, sampled at a constant interval dt with N samples, sampled at a sampling rate sr:




      • the Fourier transform decompose a signal x(t) in an infinite sum: $x(t)= A_{1}e^{iw_1t} + A_{2}e^{iw_2t}+A_{3}e^{iw_3t}+...+ A_{n}e^{iw_nt} \$
        where $A_n = r_ne^{ip_n}$, and $w_n$ is a frequency

      • amplitude at the given frequency $w_n$: $r_n = np.abs(A_n) = sqrt{real(A_n)^2 + complex(A_n)^2}$

      • phase at the given frequency $w_n$: $p_n = np.angle(A)$

      • np.fft.fftfreq(N, 1/sr): returns all the frequencies $w$ present in the wave as an array: $[w_1, w_2, w_3, ..., w_n]$

      • np.fft.fft(array x): returns a 2D array with complex values which correspond to $[A_1, A_2, ..., A_n]$

      • period of the signal: $T = dt times N$

      • fundamental frequency (Hz): $df = 1/T$

      • fundamental frequency (rad/sec): $dw = 2π/T$

      • fundamental frequency (adimensional): $f = np.fft.fftfreq(N)times N times df$ ?

      • fundamental frequency (adimensional): $w = np.fft.fftfreq(N) times N times dw$ ?

      • duration = number of frames (length of my array) $div$ sample rate ?


      I had some questions too:




      • In order to plot/make a spectrogram, I need to have the duration of my wave, the frequencies ($w_1, w_2, ..., w_n$) in it, and the amplitudes for each frequencies ($A_1, A_2, ..., A_n$). For each value of t of my wave duration, I have the frequencies. I then calculate the amplitude of all the frequencies since its a function of time (e.g: $A_1e^{iw_1t}$) ?

      • If I want to generate a more complex sound that just one frequency, I need to generate many frequencies which amplitudes vary over time ? I want to be able to generate samples (i.e: those kind of sound : link)


      Thank you very much for your attention!







      fourier-analysis fourier-transform python fast-fourier-transform music-theory






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Dec 6 '18 at 8:01









      LutinRoseLutinRose

      11




      11






















          0






          active

          oldest

          votes











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "69"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3028204%2finformations-about-fourier-transform-for-a-python-project-sound-manipulation%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Mathematics Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3028204%2finformations-about-fourier-transform-for-a-python-project-sound-manipulation%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

          How to change which sound is reproduced for terminal bell?

          Can I use Tabulator js library in my java Spring + Thymeleaf project?