home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / sox1217s.zip / soxexam.txt < prev   
Text File  |  2000-11-19  |  17KB  |  595 lines

  1.  
  2.  
  3.  
  4. SoX(1)                               SoX(1)
  5.  
  6.  
  7. NAME
  8.        soxexam - SoX Examples (CHEAT SHEET)
  9.  
  10. CONVERSIONS
  11.        Introduction
  12.  
  13.        In  general,  sox will attempt to take an input sound file
  14.        format and convert it to a new file format using a similar
  15.        data  type  and sample rate.  For instance, "sox monkey.au
  16.        monkey.wav" would try and convert the  mono  8000Hz  u-law
  17.        sample .au file that comes with sox to a 8000Hz u-law .wav
  18.        file.
  19.  
  20.        If an output format doesn't support the same data type  as
  21.        the  input  file     then sox will generally select a default
  22.        data type to save it in.     You  can  override  the  default
  23.        data  type  selection by using command line options.  This
  24.        is also useful for producing a output file with higher  or
  25.        lower precision data and/or sample rate.
  26.  
  27.        Most  file  formats that contain headers can automatically
  28.        be read in.  When working  with    headerless  file  formats
  29.        then  a user must manually tell sox the data type and sam¡
  30.        ple rate using command line options.
  31.  
  32.        When working with headerless files (raw    files),     you  may
  33.        take advantage of they pseudo-file types of .ub, .uw, .sb,
  34.        .sw, .ul, and .sl.  By  using  these  extensions     on  your
  35.        filenames  you  will not have to specify the corrisponding
  36.        options on the command line.
  37.  
  38.        Precision
  39.  
  40.        The following data types and formats can be represented by
  41.        their  total  uncompressed bit precision.  When converting
  42.        from one data type to another care must be taken to insure
  43.        it  has    an  equal  or greater precision.  If not then the
  44.        audio quality will be degraded.    This is not always a  bad
  45.        thing  when  your  working with things such as voice audio
  46.        and are concerned about disk space  or  bandwidth  of  the
  47.        audio data.
  48.  
  49.            Data Format    Precision
  50.            ___________    _________
  51.            unsigned byte    8-bit
  52.            signed byte    8-bit
  53.            u-law           12-bit
  54.            a-law           12-bit
  55.            unsigned word   16-bit
  56.            signed word     16-bit
  57.            ADPCM           16-bit
  58.            GSM           16-bit
  59.            unsigned long   32-bit
  60.            signed long     32-bit
  61.  
  62.  
  63.  
  64.             December 10, 1999            1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. SoX(1)                               SoX(1)
  71.  
  72.  
  73.            ___________    _________
  74.  
  75.        Examples
  76.  
  77.        Use  the     '-V' option on all your command lines.     It makes
  78.        SoX print out its idea of what is going on.  '-V' is  your
  79.        friend.
  80.  
  81.        To  convert from unsigned bytes at 8000 Hz to signed words
  82.        at 8000 Hz:
  83.  
  84.      sox -r 8000 -c 1 filename.ub newfile.sw
  85.  
  86.        To convert from Apple's AIFF  format  to     Microsoft's  WAV
  87.        format:
  88.  
  89.      sox filename.aiff filename.wav
  90.  
  91.        To  convert  from mono raw 8000 Hz 8-bit unsigned PCM data
  92.        to a WAV file:
  93.  
  94.      sox -r 8000 -u -b -c 1 filename.raw filename.wav
  95.  
  96.        SoX is great to use along with other command line programs
  97.        by passing data between the programs using pipelines.  The
  98.        most common example is to use mpg123 to convert mp3  files
  99.        in to wav files.     The following command line will do this:
  100.  
  101.      mpg123 -b 10000 -s filename.mp3 | sox -t raw -r 44100 -s
  102.        -w -c 2 - filename.wav
  103.  
  104.        When  working  with  totally  unknown  audio data then the
  105.        "auto" file format may be of use.  It  attempts    to  guess
  106.        what  the  file    type  is and then you may save it in to a
  107.        known audio format.
  108.  
  109.      sox -V -t auto filename.snd filename.wav
  110.  
  111.        It is important to understand how  the  internals  of  SoX
  112.        work  with compressed audio including u-law, a-law, ADPCM,
  113.        or GSM.    SoX takes ALL input data types and converts  them
  114.        to  uncompressed 32-bit signed data.  It will then convert
  115.        this internal version into the  requested  output  format.
  116.        This  means  unneeded  noise can be introduced from decom¡
  117.        pressing data and then recompressing.  If applying  multi¡
  118.        ple  effects to audio data it is best to save the interme¡
  119.        diate data as PCM data.    After the final     effect     is  per¡
  120.        formed then you can specify it as a compressed output for¡
  121.        mat.  This will keep noise introduction to a minimum.
  122.  
  123.        The following example is to apply various  effects  to  an
  124.        8000  Hz     ADPCM    input file and then end up with the final
  125.        file as 44100 Hz ADPCM.
  126.  
  127.  
  128.  
  129.  
  130.             December 10, 1999            2
  131.  
  132.  
  133.  
  134.  
  135.  
  136. SoX(1)                               SoX(1)
  137.  
  138.  
  139.      sox firstfile.wav -r 44100 -s -w secondfile.wav
  140.      sox secondfile.wav thirdfile.wav swap
  141.      sox thirdfile.wav -a -b finalfile.wav mask
  142.  
  143.        Under a DOS shell, you can convert several audio files  to
  144.        an  new    output format using something similar to the fol¡
  145.        lowing command line:
  146.  
  147.      FOR %X IN (*.RAW) DO sox -r 11025 -w -s -t raw $X $X.wav
  148.  
  149. EFFECTS
  150.        Special       thanks     goes     to     Juergen      Mueller
  151.        (jmeuller@uia.au.ac.be) for this write up on effects.
  152.  
  153.        Introduction:
  154.  
  155.        The core problem is that you need some experience in using
  156.        effects    in  order  to say "that any old sound file sounds
  157.        with effects absolutely hip". There isn't  any  rule-based
  158.        system  which  tell  you     the  correct  setting of all the
  159.        parameters for every effect.  But after some time you will
  160.        become an expert in using effects.
  161.  
  162.        Here  are  some    examples which can be used with any music
  163.        sample.    (For a sample where only a single  instrument  is
  164.        playing,     extreme  parameter  setting  may make well-known
  165.        "typically" or "classical" sounds.  Likewise,  for  drums,
  166.        vocals or guitars.)
  167.  
  168.        Single  effects will be explained and some given parameter
  169.        settings that can be used to  understand     the  theorie  by
  170.        listening to the sound file with the added effect.
  171.  
  172.        Using multiple effects in parallel or in sequel can result
  173.        either in very perfect sound or ( mostly ) in  a     dramatic
  174.        overloading in variations of sounds such that your ear may
  175.        follow the sound but you will feel unsatisfied. Hence, for
  176.        the  first  time using effects try to compose them as less
  177.        as possible. We don't regard the composition of effects in
  178.        the examples because to many combinations are possible and
  179.        you really need a very fast maschine and a lot  of  memory
  180.        to play them in real-time.
  181.  
  182.        And real-time playing of sounds will speed up learning the
  183.        parameter setting.
  184.  
  185.        Basically, we will use the "play" front-end of  SOX  since
  186.        it is easier to listen sounds coming out of the speaker or
  187.        earphone instead of looking at  cryptical  data    in  sound
  188.        files.
  189.  
  190.        For easy listening of file.xxx ( "xxx" is any sound format
  191.        ):
  192.  
  193.  
  194.  
  195.  
  196.             December 10, 1999            3
  197.  
  198.  
  199.  
  200.  
  201.  
  202. SoX(1)                               SoX(1)
  203.  
  204.  
  205.          play file.xxx effect-name effect-parameters
  206.  
  207.        Or more SOX-like ( for "dsp" output ):
  208.  
  209.          sox file.xxx -t ossdsp -w    -s  /dev/dsp  effect-name
  210.        effect-parameters
  211.  
  212.        or ( for "au" output ):
  213.  
  214.           sox  file.xxx -t sunau -w -s /dev/audio effect-name
  215.        effect-parameters
  216.  
  217.        And for date freaks:
  218.  
  219.          sox file.xxx file.yyy effect-name effect-parameters
  220.  
  221.        Additional options can be used. However, in this case, for
  222.        real-time playing you'll need a very fast machine.
  223.  
  224.        Notes:
  225.  
  226.        I  played  all examples in real-time on a Pentium 100 with
  227.        32 Mb and Linux 2.0.30 using a self-recorded sample ( 3:15
  228.        min  long  in  "wav"  format with 44.1 kHz sample rate and
  229.        stereo 16 bit ).     The sample should not contain any of the
  230.        effects.     However,  if  you  take any recording of a sound
  231.        track from radio or tape or cd, and it sounds like a  live
  232.        concert    or  ten     people     are playing the same rhythm with
  233.        their drums or funky-groves, then take any  other  sample.
  234.        (Typically,  less  then    four  different intruments and no
  235.        synthesizer in the sample is suitable. Likewise, the  com¡
  236.        bination vocal, drums, bass and guitar.)
  237.  
  238.        Effects:
  239.  
  240.        Echo
  241.  
  242.        An  echo     effect     can be naturally found in the mountains,
  243.        standing somewhere on a moutain and shouting a single word
  244.        will  result  in     one or more repetitions of the word ( if
  245.        not, turn a bit around ant try next, or climb to the  next
  246.        mountain ).
  247.  
  248.        However,     the time difference between shouting and repeat¡
  249.        ing is the delay (time), its loudness is the decay. Multi¡
  250.        ple echos can have different delays and decays.
  251.  
  252.        Very  popular  is  using     echos to play an instrument with
  253.        itself together, like some guitar players ( Brain May from
  254.        Queen ) or vocalists are doing.    For music samples of more
  255.        than one instrument, echo can be used to add a second sam¡
  256.        ple shortly after the original one.
  257.  
  258.        This  will  sound  as  doubling    the number of instruments
  259.  
  260.  
  261.  
  262.             December 10, 1999            4
  263.  
  264.  
  265.  
  266.  
  267.  
  268. SoX(1)                               SoX(1)
  269.  
  270.  
  271.        playing the same sample:
  272.  
  273.          play file.xxx echo 0.8 0.88 60.0 0.4
  274.  
  275.        If the delay is very short then it sound like a (metallic)
  276.        roboter playing music:
  277.  
  278.          play file.xxx echo 0.8 0.88 6.0 0.4
  279.  
  280.        Longer  delay  will  sound  like a open air concert in the
  281.        mountains:
  282.  
  283.          play file.xxx echo 0.8 0.9 1000.0 0.3
  284.  
  285.        One mountain more, and:
  286.  
  287.          play file.xxx echo 0.8 0.9 1000.0 0.3 1800.0 0.25
  288.  
  289.        Echos
  290.  
  291.        Like the echo effect, echos stand for  "ECHO  in     Sequel",
  292.        that  is     the  first echos takes the input, the second the
  293.        input and the first echos, the third  the  input     and  the
  294.        first and the second echos, ... and so on.  Care should be
  295.        taken using many echos (     see  introduction  );    a  single
  296.        echos has the same effect as a single echo.
  297.  
  298.        The sample will be bounced twice in symmetric echos:
  299.  
  300.          play file.xxx echos 0.8 0.7 700.0 0.25 700.0 0.3
  301.  
  302.        The sample will be bounced twice in asymmetric echos:
  303.  
  304.          play file.xxx echos 0.8 0.7 700.0 0.25 900.0 0.3
  305.  
  306.        The sample will sound as played in a garage:
  307.  
  308.          play file.xxx echos 0.8 0.7 40.0 0.25 63.0 0.3
  309.  
  310.        Chorus
  311.  
  312.        The  chorus  effect  has its name because it will often be
  313.        used to make a single vocal sound like a     chorus.  But  it
  314.        can be applied to other instrument samples too.
  315.  
  316.        It  works like the echo effect with a short delay, but the
  317.        delay isn't constant.  The delay is varied  using  a  sin¡
  318.        odial  or  triangular  modulation.  The    modulation  depth
  319.        defines the range the modulated delay is played before  or
  320.        after the delay. Hence the delayed sound will sound slower
  321.        or faster, that is the  delayed    sound  tuned  around  the
  322.        original     one, like in a chorus where some vocal are a bit
  323.        out of tune.
  324.  
  325.  
  326.  
  327.  
  328.             December 10, 1999            5
  329.  
  330.  
  331.  
  332.  
  333.  
  334. SoX(1)                               SoX(1)
  335.  
  336.  
  337.        The typical delay is around 40ms to 60ms, the speed of the
  338.        modualtion  is  best  near 0.25Hz and the modulation depth
  339.        around 2ms.
  340.  
  341.        A single delay will make the sample more overloaded:
  342.  
  343.          play file.xxx chorus 0.7 0.9 55.0 0.4 0.25 2.0 -t
  344.  
  345.        Two delays of the original samples sound like this:
  346.  
  347.          play file.xxx chorus 0.6 0.9 50.0 0.4  0.25  2.0  -t
  348.        60.0 0.32 0.4 1.3 -s
  349.  
  350.        A  big  chorus of the sample is ( three additional samples
  351.        ):
  352.  
  353.          play file.xxx chorus 0.5 0.9 50.0 0.4  0.25  2.0  -t
  354.        60.0 0.32 0.4 2.3 -t       40.0 0.3 0.3 1.3 -s
  355.  
  356.        Flanger
  357.  
  358.        The  flanger  effect  is     like  the chorus effect, but the
  359.        delay varies between 0ms and maximal 5ms.  It  sound  like
  360.        wind blowing, sometimes faster or slower including changes
  361.        of the speed.
  362.  
  363.        The flanger effect is widely used in funk and soul  music,
  364.        where  the  guitar  sound  varies frequently slow or a bit
  365.        faster.
  366.  
  367.        The typical delay is around 3ms to 5ms, the speed  of  the
  368.        modulation is best near 0.5Hz.
  369.  
  370.        Now, let's groove the sample:
  371.  
  372.          play file.xxx flanger 0.6 0.87 3.0 0.9 0.5 -s
  373.  
  374.        listen  carefully  between  the difference of sinodial and
  375.        triangular modulation:
  376.  
  377.          play file.xxx flanger 0.6 0.87 3.0 0.9 0.5 -t
  378.  
  379.        If the decay is a bit lower, than the effect  sounds  more
  380.        popular:
  381.  
  382.          play file.xxx flanger 0.8 0.88 3.0 0.4 0.5 -t
  383.  
  384.        The drunken loundspeaker system:
  385.  
  386.          play file.xxx flanger 0.9 0.9 4.0 0.23 1.3 -s
  387.  
  388.        Reverb
  389.  
  390.        The reverb effect is often used in audience hall which are
  391.  
  392.  
  393.  
  394.             December 10, 1999            6
  395.  
  396.  
  397.  
  398.  
  399.  
  400. SoX(1)                               SoX(1)
  401.  
  402.  
  403.        to small or to many visitors  disturb  the  reflection  of
  404.        sound  at the walls to make the sound played more monumen¡
  405.        tal. You can try the reverb effect  in  your  bathroom  or
  406.        garage  or sport halls by shouting loud some words. You'll
  407.        hear the words reflected from the walls.
  408.  
  409.        The biggest problem in using the reverb effect is the cor¡
  410.        rect  setting  of the (wall) delays such that the sound is
  411.        relistic an doesn't sound like music playing in a  tin  or
  412.        overloaded feedback distroys any illusion of any big hall.
  413.        To help you for much realisitc reverb effects, you  should
  414.        decide  first, how long the reverb should take place until
  415.        it is not loud enough to be registered by your ears.  This
  416.        is be done by the reverb time "t", in small halls 200ms in
  417.        bigger one 1000ms, if you like. Clearly, the walls of such
  418.        a  hall    aren't far away, so you should define its setting
  419.        be given every wall its delay time.  However, if the  wall
  420.        is  to  far  eway  for the reverb time, you won't hear the
  421.        reverb, so the nearest wall will be best "t/4"  delay  and
  422.        the  farest  "t/2".   You can try other distances as well,
  423.        but it won't sound very realistic.   The     walls    shouldn't
  424.        stand  to  close     to  each  other  and  not  in a multiple
  425.        interger distance to each other    (  so  avoid  wall  like:
  426.        200.0 and 202.0, or something like 100.0 and 200.0 ).
  427.  
  428.        Since audience halls do have a lot of walls, we will start
  429.        designing one beginning with one wall:
  430.  
  431.          play file.xxx reverb 1.0 600.0 180.0
  432.  
  433.        One wall more:
  434.  
  435.          play file.xxx reverb 1.0 600.0 180.0 200.0
  436.  
  437.        Next two walls:
  438.  
  439.          play file.xxx reverb 1.0  600.0  180.0  200.0  220.0
  440.        240.0
  441.  
  442.        Now, why not a futuristic hall with six walls:
  443.  
  444.           play  file.xxx  reverb  1.0 600.0 180.0 200.0 220.0
  445.        240.0 280.0 300.0
  446.  
  447.        If you run out of machine power or memory,  then     stop  as
  448.        much  applications  as possible ( every interupt will con¡
  449.        sume a lot of cpu time which for     bigger     halls    is  abso¡
  450.        lutely neccessary ).
  451.  
  452.        Phaser
  453.  
  454.        The  phaser effect is like the flanger effect, but it uses
  455.        a reverb instead of  an    echo  and  does     phase    shifting.
  456.        You'll  hear the difference in the examples comparing both
  457.  
  458.  
  459.  
  460.             December 10, 1999            7
  461.  
  462.  
  463.  
  464.  
  465.  
  466. SoX(1)                               SoX(1)
  467.  
  468.  
  469.        effects ( simply change the effect name ).  The delay mod¡
  470.        ulation    can be done sinodial or triangular, preferable is
  471.        the later one for multiple instruments playing. For single
  472.        instrument  sounds  the sinodial phaser effect will give a
  473.        sharper phasing effect.    The decay shouln't be to close to
  474.        1.0  which  will cause dramatic feedback.  A good range is
  475.        about 0.5 to 0.1 for the decay.
  476.  
  477.        We will take a parameter setting as for the flanger before
  478.        (  gain-out  is    lower since feedback can raise the output
  479.        dramatically ):
  480.  
  481.          play file.xxx phaser 0.8 0.74 3.0 0.4 0.5 -t
  482.  
  483.        The drunken loundspeaker system ( now less alkohol ):
  484.  
  485.          play file.xxx phaser 0.9 0.85 4.0 0.23 1.3 -s
  486.  
  487.        A popular sound of the sample is as follows:
  488.  
  489.          play file.xxx phaser 0.89 0.85 1.0 0.24 2.0 -t
  490.  
  491.        The sample sounds if ten springs are in your ears:
  492.  
  493.          play file.xxx phaser 0.6 0.66 3.0 0.6 2.0 -t
  494.  
  495.        Other effects ( copy, rate, avg, stat, vibro, lowp, highp,
  496.        band, reverb )
  497.  
  498.        The  other effects are simply to use. However, an "easy to
  499.        use manual" should be given here.
  500.  
  501.        More effects ( to do ! )
  502.  
  503.        There are a lot of effects around like noise  gates,  com¡
  504.        pressors,  waw-waw,  stereo effects and so on. They should
  505.        be implemented making SOX to be more useful in sound  mix¡
  506.        ing  technics  coming together with a great varity of dif¡
  507.        ferent sound effects.
  508.  
  509.        Combining effects be using then in parallel or  sequel  on
  510.        different  channels  needs  some     easy  mechanism which is
  511.        real-time stable.
  512.  
  513.        Really missing, is the changing of the parameters,  start¡
  514.        ing  and stoping of effects while playing samples in real-
  515.        time!
  516.  
  517.        Good luck and have fun with all the effects!
  518.  
  519.         Juergen Mueller         (jmueller@uia.ua.ac.be)
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.             December 10, 1999            8
  527.  
  528.  
  529.  
  530.  
  531.  
  532. SoX(1)                               SoX(1)
  533.  
  534.  
  535. SEE ALSO
  536.        sox(1), play(1), rec(1)
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.             December 10, 1999            9
  593.  
  594.  
  595.