Results 1 to 8 of 8

Thread: Playing multiple voices

  1. #1
    Junior Member
    Join Date
    Feb 2005
    Location
    Central CA
    Posts
    12

    Playing multiple voices

    I am trying to determine the correct mechanism for playing multiple sounds at the same time through OpenML.

    On the application side, I'm guessing that we need to open multiple paths with mlOpen().Would those specify the same pathID on input? (Or how far back in the chain do we need to have multiple instances for?)

    Internally in the ML audio devices, I'm also wondering how mixing is handled. I see references to dev/mixer in the Linux code base but don't have any experience with Linux and have not yet tried to follow how that device is being used. By comparison, there don't appear to be any references to mixing at all in the winaudio device. Is this assuming that any contemporary Windows audio solution supports multiple voices in hardware? What happens when running on a WinCE device that only supports a single voice? Is there an entry in the capabilities tree for how many voices the hardware supports?

  2. #2

    Re: Playing multiple voices

    <BLOCKQUOTE><font size="1" face="Arial, Verdana, Helvetica, sans-serif">quote:</font><HR>Originally posted by John Harris:
    On the application side, I'm guessing that we need to open multiple paths with mlOpen().
    <HR></BLOCKQUOTE>

    In my system, The ML module of my audio card has only one output jack and path. So i can only open one output path with mlOpen.But i believe that there's a soultion:
    As an example i have 2 sound files named 1.wav and 2.wav and 10 buffers .The capacity of each buffer is 512 bytes. Now i copy the first 512 bytes of the file 1.wav in the first buffer; the first 512 bytes of the file 2.wav in the second buffer; the second 512 bytes of the file 1.wav in the third buffer; the second 512 bytes of the file 2.wav in the fourth buffer and so on. But i don't know that if it produces a smooth result on the output?

    <BLOCKQUOTE><font size="1" face="Arial, Verdana, Helvetica, sans-serif">quote:</font><HR>Would those specify the same pathID on the input?
    <HR></BLOCKQUOTE>

    If your module has more than one output path, then each of them has it's own ID.Also input paths have their own ID.
    MLU has a utility function that can find the path ID:
    mluFindPathFromJack( MLint64 jackId, MLint64* pathId, MLint32* memAlignment )
    If you know the output-or input- jack ID, then this function finds the path ID of that jack.

    <BLOCKQUOTE><font size="1" face="Arial, Verdana, Helvetica, sans-serif">quote:</font><HR>Is there an entry in the capabilities tree for how many voices the hardware supports?
    <HR></BLOCKQUOTE>


    I can't understand the meaning of the *voice* in your sentence--The output audio path is probbaly the issue, i.e.
    First of all, you need to know that which module is the audio module.ML capabilities tree doesn't explicitly say that "It's an audio module".you should query the features of each module to find the audio module--If there's an audio moudle.Then you can query the number of the output paths of this module.

    I believe that this discussion is useful for you:
    Hi Fabrice
    IF we want to play the sound by OpenML, we must ensure that there's an module that can do this. As i have studied the source codes of the audioToFile and FileToAudio examples, the user should specify the name of the module to start the action.
    But In a real application, the application should find the appropriate module and start the action.
    My problem is that the module names aren't same for different cards(?)How can i understand that there's an OpenML module that can captures and transports the audio data?


    You can query the capabilities, and find out what supports audio paths. Start by querying the system, to get a list of devices, then query each device. Look at the code for mlquery (included in the SDK release) -- this is exactly how it lists all the devices present on your system.
    ...Fabrice

    Ehsan

    [ April 02, 2005: Message edited by: Ehsan Kamrani ]

  3. #3
    Junior Member
    Join Date
    Feb 2005
    Location
    Central CA
    Posts
    12

    Re: Playing multiple voices

    "Voice" is a term that refers to how many sounds you can play at the same time.

    Most audio hardware has the capability of playing multiple sounds, and audio APIs typically do one of two things:

    - The application allocates multiple instances of whatever entity is required to manage multiple concurrent sounds.

    - The API automatically allocates free voices when processing play commands.

    The queuing structure of OpenML already rules out the second alternative. Additional mlSendBuffers() get processed sequentially rather than mixed concurrently. The question, is whether some form of the first alternative exists in OpenML. So far, it doesn't seem to, which leaves me wondering how to play multiple concurrent sounds.

    The second part of the question, is that if the application wants to play more concurrent sounds than the hardware supports, some form of software mixing has to take place. (Multiple sound samples are merged into a single audio stream). The previously mentioned Linux device dev/mixer now looks like it has nothing to do with mixing multiple voices of PCM audio, but rather mixing different audio sources together. So perhaps no form of software mixing exists in the current OpenML implementation.

    So in summary, I need to find out how to play multiple concurrent sounds through the hardware's PCM mixing capability. I also need to be able to determine how many hardware voices exist, so that I know when I need to pre-mix samples in software. (Assuming there's no such capability somewhere in OpenML that I haven't spotted yet).

  4. #4

    Re: Playing multiple voices

    Hi Fabrice
    I should add another question to this topic:
    OpenML specification says:

    A single path can have more than one instance. Depending on the device, it is possible for several instances of a path to be open and in use concurrently.

    What does this mean?
    Ehsan

  5. #5
    Junior Member
    Join Date
    Feb 2005
    Location
    Central CA
    Posts
    12

    Re: Playing multiple voices

    <BLOCKQUOTE><font size="1" face="Arial, Verdana, Helvetica, sans-serif">quote:</font><HR> Depending on the device, it is possible for several instances of a path to be open and in use concurrently.<HR></BLOCKQUOTE>
    I have tried this and could not accomplish what I was after. The winaudio device accepted multiple mlOpen() calls without an error, however all of those calls returned the same value for hPath. So I didn't end up with multiple instances.

  6. #6
    Member
    Join Date
    Jul 2003
    Location
    Montreal
    Posts
    75

    Re: Playing multiple voices

    John,

    this is a good question. At first glance, it would seem that ML does not support multiple voices and hardware mixing (but I'm no audio expert, so I could be wrong). In this case, the application would have to do all its mixing in software... I'll see if I can find out more info.

    But perhaps the solution *could* be related to Ehsan's question (which you tried already): opening the same path multiple times. One could imaging that a device could support this by mixing the samples from each path... but this would have to be implemented in the ML module (not done in the current sample modules). And as you say, it would require a new capability to inform the application on the number of voices that can be used.

    Ehsan, to answer your question: I don't really know what is meant by that quote. I haven't yet seen a situation where multiple instances of a path are opened. For input paths, it could mean the application could receive two streams of buffers from the same source.

  7. #7

    Re: Playing multiple voices

    Hi Fabrice
    So can you contact with the authors of the ML specification and collect some information for us about this subject.It's a major problem If we can not open multiple instances of an output path. It means that we can not use the OpenML in the games, we cannot mix sounds, etc.
    Regards
    -Ehsan-

  8. #8
    Junior Member
    Join Date
    Feb 2005
    Location
    Central CA
    Posts
    12

    Re: Playing multiple voices

    Apparently, I was doing something wrong in my initial tests because ML does support opening multiple paths, and the winaudio device does play multiple concurrent sounds.

    Sorry for my earlier misinformation.

Similar Threads

  1. how to show semi-transparent object over playing video.
    By aditya.sen in forum OpenGL ES 2X - for programmable 3D graphics pipelines
    Replies: 1
    Last Post: 11-26-2009, 04:35 PM

Posting Permissions

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