Embeddable Easy Voice in Custom Inspectors

Discussion in 'Easy Voice' started by majeric, Oct 30, 2015.

  1. majeric

    majeric
    Expand Collapse
    New Member

    Joined:
    Oct 30, 2015
    Messages:
    3
    Likes Received:
    0
    I think someone asked a similar question but it would be great to be able to call a function that allows the user to generate audio based on a string value and a voice option.

    I have a custom dialog system for my game and it would be nice to just generate audio as I build the dialog.

    At the moment, I'm hacking the Easy Voice code to create my own call but it's very much wrapped up in your editor.
     
  2. Alberto

    Alberto
    Expand Collapse
    Administrator
    Staff Member

    Joined:
    Feb 14, 2014
    Messages:
    10
    Likes Received:
    2
    @majeric, I misread this the first time as I thought you were asking about real time audio generation but it sounds like you want to generate the audio in the editor outside of the Easy Voice window? It's an interesting thought, although my first impression is it would decentralize the UI that lets you regenerate the voice files but maybe that is more convenient in your situation?
     
  3. majeric

    majeric
    Expand Collapse
    New Member

    Joined:
    Oct 30, 2015
    Messages:
    3
    Likes Received:
    0
    I have this dialog system where an encounter will trigger a conversation. It's a hierarchical set of objects that a pairs a string with an AudioClip. It would be nice to automatically generate that audio. As I build new conversations without having to go back to the Easy Voice interface to do it.

    Like if there was a Custom Inspector for an easy voice object that you could embed directly into your code

    Like a "EasyVoiceEntry" object that had a string, audio clip, voice enum.

    Then the Custom inspector had a button that when you pressed it in the interface, it just generated the audio clip based on the master settings.
     
  4. majeric

    majeric
    Expand Collapse
    New Member

    Joined:
    Oct 30, 2015
    Messages:
    3
    Likes Received:
    0
    This is the absolute minimum code you need to generate an AudioClip using your framework (on a mac):


    Code:
    string filePath = "/Audio/Voice/Test/test.aiff";
            EasyVoiceQuerier querier = new EasyVoiceQuerierMacOS();
            querier.AskToMakeFile(
                "This is a test!",
                "Alex",
                Application.dataPath + filePath,
                "AIFFLE");
          
            AssetDatabase.ImportAsset("Assets" + filePath, ImportAssetOptions.ForceSynchronousImport);
            AudioClip foundClip = (AudioClip)AssetDatabase.LoadAssetAtPath("Assets" + filePath, typeof(AudioClip));
            Debug.Assert(foundClip != null, "No Audio");
     
  5. Alberto

    Alberto
    Expand Collapse
    Administrator
    Staff Member

    Joined:
    Feb 14, 2014
    Messages:
    10
    Likes Received:
    2
    Thank you for explaining, that is interesting. I'll keep this suggestion in mind but don't have immediate plans to go in that direction. Since we include the source it looks like you are able to modify things for your use case but I understand it's not ideal.
     

Share This Page