Trying to play/export formula to audio file tia sal2

Discussion in 'Maple' started by sal2, Jun 13, 2006.

  1. sal2

    sal2 Guest

    Greetings All

    I'm try to export/play this formula to a wave file I looked at the signal
    generation example and didn't find a place to insert this formula to be
    played.

    animate(plot, [sin(x)+2*sin(2*x)+4*sin(4*x)+8*sin(8*x)+7*sin(7*x)+5*sin(5
    *x), x = 0 .. t], t = 0 .. 2*Pi)

    PS: I'm using maple 10.

    tia sal2
     
    sal2, Jun 13, 2006
    #1
    1. Advertisements

  2. Ummm, what did you want the resulting signal to be?

    What sampling frequency do you want to use?

    The plot has a warped-triangle shape because your x runs only to t;
    how did you want to convert that aspect into audio?

    Your plot has a range of about +/- 22 rather than 0..1: what
    scaling function do you want to use to normalize the data?
     
    Walter Roberson, Jun 13, 2006
    #2
    1. Advertisements

  3. sal2

    temp Guest

    -cnrc.gc.ca (Walter Roberson) wrote in
    Sorry I didn't know I was missing information. I was trying to replicate
    this mathematica command
    Play[Sin[x] + 2Sin[2x] + 4Sin[4x] + 8Sin[8x] + 7Sin[7x] + 5Sin[5x], {x,
    0, 2Pi}];

    I prefer to use maple because I like it alot better.

    The formula I'm using is sin(x)+2*sin(2*x)+4*sin(4*x)+8*sin(8*x)+7*sin(7
    *x)+5*sin(5*x);

    16bit mono
    44100
    run for 5 sec

    I just need a small example of how to use an equation to create an audio
    file I'll be able to adjust it.

    Tia
     
    temp, Jun 13, 2006
    #3
  4. I think you want something like this:
    A:= Create(duration=5.0);
    G:= proc(freq,A)
    local i,x,w;
    w:= 2*Pi*freq/44100;
    for i from 1 to 220500 do
    x:= i*w;
    A:= sin(x)+2*sin(2*x)+4*sin(4*x)+8*sin(8*x)
    +7*sin(7*x)+5*sin(5*x);
    end do;
    Normalize(A)
    end proc:
    evalhf(G(440,A)):
    Write("myfile.wav",Normalize(A)):

    Robert Israel
    Department of Mathematics http://www.math.ubc.ca/~israel
    University of British Columbia Vancouver, BC, Canada
     
    Robert Israel, Jun 13, 2006
    #4
  5. In that 5 seconds, do you want it to complete exactly 1 period?
    You have t = 2*Pi as your maximum; if you were to use the
    "natural" mapping of t as seconds, then the maximum would be about
    6 1/4 seconds instead of 5 seconds. But the human ear is only
    sensitive down to about 20 Hz, and none of your multipliers
    gets as high as 20*5, so all you would be able to hear would
    be the harmonics.
     
    Walter Roberson, Jun 14, 2006
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.