Professional Web Applications Themes

Mixing Sounds - Mac Programming

I've made a simple program to play notes at various frequencies using the Sound Manager. I need to use the Sound Manager because I require my program to run on MacOS 9 still. I construct the sound wave myself as a sine wave (or Sawtooth, Triangle or Square, optionally). The sounds produced sound very good. However, I am also trying to make it play 'chords'. To do this, I am simply playing each sound through a separate sound channel and playing them simultaneously. When more than one note is played simultaneously, it sounds terrible. I was thinking that if I ...

  1. #1

    Default Mixing Sounds

    I've made a simple program to play notes at various frequencies using
    the Sound Manager.
    I need to use the Sound Manager because I require my program to run on
    MacOS 9 still.

    I construct the sound wave myself as a sine wave (or Sawtooth, Triangle
    or Square, optionally).

    The sounds produced sound very good.


    However, I am also trying to make it play 'chords'.
    To do this, I am simply playing each sound through a separate sound
    channel and playing them simultaneously.

    When more than one note is played simultaneously, it sounds terrible.

    I was thinking that if I mixed the sound myself and played it from a
    single sound channel that the quality might improve.

    Is there a correct method of mixing sounds together?
    I thought of simply averaging the samples, but I'm not sure if that's
    correct.

    Or, alternatively, is there some way to get my sounds to sound better
    while still playing them through separate sound channels?

    --
    net http://www.mts.net/~gbeggs1/
    Gerry Guest

  2. #2

    Default Re: Mixing Sounds

    In article <1ggtl6y.k7t9m4122l9u4N%net>, Gerry
    <net> wrote:
     

    That would do fine.
     

    Take a look at Quicktime Music Architecture. Gives you hundreds of
    real instrument sounds to play with. Runs on any Mac OS from system 7
    on. Lets you either play the individual notes yourself or assemble
    into tunes which you can submit to the player and just leave playing in
    the background while your program does other stuff. Tunes can be
    converted to midi, Quicktime movies or audio files.

    Phil Taylor
    Phil Guest

  3. #3

    Default Re: Mixing Sounds

    Phil Taylor <invalid> wrote:
     
    >
    > That would do fine.[/ref]

    Okay. I'll give it a try.
     
    >
    > Take a look at Quicktime Music Architecture. Gives you hundreds of
    > real instrument sounds to play with. Runs on any Mac OS from system 7
    > on. Lets you either play the individual notes yourself or assemble
    > into tunes which you can submit to the player and just leave playing in
    > the background while your program does other stuff. Tunes can be
    > converted to midi, Quicktime movies or audio files.[/ref]

    That was actually my original intention. But I need to specify the exact
    frequency of the notes in Hertz.
    I think QuickTime has a mechanism for doing this, but it has been broken
    since the beginning, so I was told, so I abandoned this idea and
    constructed the waveforms of the notes manually.

    --
    net http://www.mts.net/~gbeggs1/
    Gerry Guest

  4. #4

    Default Re: Mixing Sounds

    In article <1ggtugv.1fug2adx31c2qN%net>, Gerry
    <net> wrote:
     
    > >
    > > That would do fine.[/ref]
    >
    > Okay. I'll give it a try.

    > >
    > > Take a look at Quicktime Music Architecture. Gives you hundreds of
    > > real instrument sounds to play with. Runs on any Mac OS from system 7
    > > on. Lets you either play the individual notes yourself or assemble
    > > into tunes which you can submit to the player and just leave playing in
    > > the background while your program does other stuff. Tunes can be
    > > converted to midi, Quicktime movies or audio files.[/ref]
    >
    > That was actually my original intention. But I need to specify the exact
    > frequency of the notes in Hertz.
    > I think QuickTime has a mechanism for doing this, but it has been broken
    > since the beginning, so I was told, so I abandoned this idea and
    > constructed the waveforms of the notes manually.[/ref]

    You can do it in QTMA, but it's a bit roundabout. You specify the
    pitch using a midi code, and the amount of pitch bend (in 256ths of a
    semitone) using naSetController with kControllerPitchbend. If you want
    to hear this in action download my program BarFly from
    <http://www.barfly.dial.pipex.com>
    By default it plays music in equal temperament, but it can also use
    other temperaments (Highland Bagpipe, Pythagorean or Just Intonation),
    and it gets the notes "in the cracks" correct. There was a bug in QT
    5.x which stopped this from working, but older and newer versions seem
    OK.

    Phil Taylor
    Phil Guest

  5. #5

    Default Re: Mixing Sounds

    Gerry wrote:
     

    Maybe the combined signal is clipping.
    Try decreasing the amplitude / volume of each channel
    and see if that helps? (If that's possible?)
    Maybe easier than mixing them together yourself.

    Mike Guest

  6. #6

    Default Re: Mixing Sounds

    Phil Taylor <invalid> wrote:
     

    I'm doing this to satisfy the requirements of someone else who is very
    familiar with musical theory, but not knowlegable in programming.
    I am not at all knowlegable in musical theory.

    Anyways, he tells me that pitchbending doesn't provide high enough
    precision for his needs. He has a special type of tuning which is not
    very conventional.

    You can check out his site about it here:
    http://www.lucytune.com/

    --
    net http://www.mts.net/~gbeggs1/
    Gerry Guest

  7. #7

    Default Re: Mixing Sounds

    Mike Hall <enteract.com> wrote:
     

    That is a possibility. But it would seem strange for the MacOS to do
    this. I would think if both sounds are not clipped, then the mixed sound
    should not be clipped either.

    Anyways, I ended up mixing them myself, and the quality has improved
    quite a bit.

    But as I expected, mixing some frequencies by averaging the samples
    resulted in a quieter sound than the notes played individually. So I
    also had to normalized the sound.

    --
    net http://www.mts.net/~gbeggs1/
    Gerry Guest

  8. #8

    Default Re: Mixing Sounds

    In article <1ggvmze.hdscrj17wxs5cN%net>, Gerry
    <net> wrote:
     
    >
    > I'm doing this to satisfy the requirements of someone else who is very
    > familiar with musical theory, but not knowlegable in programming.
    > I am not at all knowlegable in musical theory.
    >
    > Anyways, he tells me that pitchbending doesn't provide high enough
    > precision for his needs. He has a special type of tuning which is not
    > very conventional.
    >
    > You can check out his site about it here:
    > http://www.lucytune.com/[/ref]

    Interesting. It's generally accepted that the smallest interval that
    the human ear can distinguish is one cent (1/100 of a semitone). The
    resolution of QTMA is 1/256 of a semitone, so it's about two and a half
    times more accurate than it needs to be. Having said that, you will
    only achieve this accuracy when playing via software; if you route the
    output via midi to an external synth the results are likely to be
    completely different, since the midi standard doesn't specify how pitch
    bend is to be interpreted, and synths all do it differently.

    Phil Taylor
    Phil Guest

  9. #9

    Default Re: Mixing Sounds

    in article 1ggvn42.1wg7eq710mgzhaN%net, Gerry at net
    wrote on 14/07/2004 04:31:
     
    >
    > That is a possibility. But it would seem strange for the MacOS to do
    > this. I would think if both sounds are not clipped, then the mixed sound
    > should not be clipped either.
    >
    > Anyways, I ended up mixing them myself, and the quality has improved
    > quite a bit.
    >
    > But as I expected, mixing some frequencies by averaging[/ref]

    Do you really mean averaging? Why? Just add them together.
     

    Prior to Sound Manager 3.0 Sound Manager lowered the amp of each
    sound when mixing them together. That sounded really dumb and
    "wrong", specifically when long sound was interrupted with short
    sound fragments. Starting from 3.0 they just add them allowing
    for overflow. What exactly happens on overflow I do not remember,
    perhaps the sound is just clipped to the maximum value (+32K for
    16-bit sounds). Anyway, it looks strange that sound manager in your
    case did such a poor job.

    --
    Mike Kluev
    PS. Remove "-DELETE-." part of my address to reply

    Mike Guest

  10. #10

    Default Re: Mixing Sounds

    Phil Taylor <invalid> wrote:
     

    Maybe that's why he said this.
    Maybe he didn't know how accurate the pitchbending was in QuickTime.

    --
    net http://www.mts.net/~gbeggs1/
    Gerry Guest

  11. #11

    Default Re: Mixing Sounds

    Mike Kluev <-DELETE-.org> wrote:
     
    >
    > Do you really mean averaging? Why? Just add them together.[/ref]

    The sounds I'm mixing are already at the maximum amplitude.
    Addind them together would result in an overflow.

    If I were to make them quieter, and just add them together, that would
    be the same result as averaging them.
     
    >
    > Prior to Sound Manager 3.0 Sound Manager lowered the amp of each
    > sound when mixing them together. That sounded really dumb and
    > "wrong", specifically when long sound was interrupted with short
    > sound fragments. Starting from 3.0 they just add them allowing
    > for overflow. What exactly happens on overflow I do not remember,
    > perhaps the sound is just clipped to the maximum value (+32K for
    > 16-bit sounds). Anyway, it looks strange that sound manager in your
    > case did such a poor job.[/ref]

    If I knew how to deal with an overflow which results in a proper
    sounding sound, I'd like to know.

    --
    net http://www.mts.net/~gbeggs1/
    Gerry Guest

Similar Threads

  1. Mixing CF and .net on same server
    By bansa in forum Coldfusion Server Administration
    Replies: 2
    Last Post: April 25th, 01:49 PM
  2. Audio Mixing
    By biodegradabl in forum Macromedia Flash Flashcom
    Replies: 0
    Last Post: March 11th, 08:49 PM
  3. Mixing languages
    By Viking2001 in forum Macromedia Contribute Connection Administrtion
    Replies: 0
    Last Post: June 6th, 07:15 PM
  4. sessions mixing
    By E. in forum PHP Development
    Replies: 9
    Last Post: February 10th, 02:17 AM
  5. mixing two w3d files
    By markus halbritter in forum Macromedia Director 3D
    Replies: 1
    Last Post: September 23rd, 11:48 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139