7. Using OStim's Sound API to change OSA's sounds - Sairion350/OStim GitHub Wiki (2024)

Written by Sairion

Required reading: API Rundown: the basics

Unlike, say, the OStim Animation Porting guide, adding new sounds and changing existing ones in OStim will require knowledge of how papyrus works, and some creativity. It is definitely not for total beginners.

OStim now gives full access to OSA's sound. It doesn't add in any sort of format for making new voicetype packs or anything like that, it's lower level than that. The idea is that a developer can either use this api and build a sound overhaul of their own, or alternatively someone can use it to make a "voice pack manager" type program, think like Sexlab Animation Loader, except OStim VoiceType Loader. The possibilities are fairly open. In fact you might say this Sound API is more of just a sound hook. Here's how the current sound API is used

OSA sends out "sound command" events that contain 3 pieces of data:

  1. an actor
  2. a voice type ID (we will just call it a formlist ID or formID for short)
  3. a sound ID

First, OSA uses the voice type ID to pull up a formlist, then it uses that sound ID to pick a specific sound from there. Lastly, said sound is played on the actor. I have disabled OSAs processing of this sound command and moved it into OStim, and you can see that code by opening up OSexintegrationmain and scrolling down until you see SOUND in big blocky letters.

What OStim lets you do is mute these sounds, and then it lets you intercept these sound commands for yourself. This is how it's done in your own scripts:

First, let's mute OSA

ostim.muteOSA = true

Ok, OSA's sound processing is now completely off. Now, let's intercept those sound commands. The below event has code in it that automatically process a command into some variables for us. I made this and left it commented out in OStim's code as wellFor reference, a raw command looks something like: "dom,15,4"

 RegisterForModEvent("ostim_osasound", "OnOSASound") Event OnOSASound(string eventName, string args, float nothing, Form sender) string[] argz = new string[3] argz = StringUtil.Split(args, ",") actor char if argz[0] == "dom" char = ostim.getDomActor() elseif argz[0] == "sub" char = ostim.getsubactor() elseif argz[0] == "third" char = ostim.getThirdActor() EndIf int formID = argz[1] as Int int soundID = argz[2] as Int OsexIntegrationMain.console("Actor: " + char.GetDisplayName() + " FormID: " + formID + " SoundID: " + argz[2]) ;We now have char, formID, and soundID! endevent

Ok, now we've got 3 pieces of data to work with. To turn the formId into a formlist containing sounds, do this:

formlist soundlist = ostim.getSoundFormLists()[formID]

Let's look at the OSA formlist setup in more detail:

OSA Voice Types, and their formlistsYou might recall that sexlab has different voicetypes (i.e. breathy female, mature female). OSA does as well, but it only really has one per gender:

  1. OGuy - Male voice
  2. OGal - Female voice. Also called FEvenTone
  3. OBody - All body smacking sounds
  4. OSpank - spanking sounds

We can see these in: OSA - Skyrim Ascendancy Engine\Sound\fx\0SA\class

...and no, there is no build in system to add a new voice to the voice list like an Omaturegal or something like that. If such a system already existed, there would be no need for this sound api.

OGal and OGuy are subdivided up into a few subvoices:

  • 0Gal_ivo
  • 0Gal_ivos
  • 0guy_wvo
  • etc.

These just divide up the sounds a bit more. 0Gal_ivo are the standard voice noises, while OGal_ivos is sucking noises. There are more you can look into and figure out as well.What's important is that each of these subvoices represents a formlist

0Gal_vo's formlist Id is 25. OSpank's is 60. You can see all of them in BuildSoundFormlists()'s code

So to put it together, we have a formlist ID and a sound ID. We get the formlist from the Id with formlist soundlist = ostim.getSoundFormLists()[formID]. and then the soundId is used to get a sound from there, like soundlist.GetAt(soundID). After that we have a raw sound we can play.

Wait what how am I supposed to use all of this?
So by now you might be thinking that since all this does is mute OSA and feed you it's sound commands, you aren't sure how this is supposed to make sound packs. that's where you get creative.

From the formID you can tell if a voice is male or female, or a body smacking sound. The idea is that you can build your own voice types, and wait for OSA sound commands to know when and where to play them. For example say I make a Orc male soundpack mod. When Ostim starts, I can use the OStim api to tell if a male orc is in the scene, then mute the scene. After that I can intercept all male voice commands, and play my own sounds instead. It works like that; it's rather open ended.

Adding more soundsOSA doesn't have any kissing sound effects. In fact, a number of different animations have no sfx that could use them. Since OSA doesn't send sound commands for these, we can use the OStim API to figure out when they occur, and play our own sounds:

if odatabase.getfullname(ostim.getCurrentAnimationOID()) == "Kissing animation name" ; run some sound codeendif
7. Using OStim's Sound API to change OSA's sounds - Sairion350/OStim GitHub Wiki (2024)

References

Top Articles
Latest Posts
Article information

Author: Velia Krajcik

Last Updated:

Views: 6031

Rating: 4.3 / 5 (74 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Velia Krajcik

Birthday: 1996-07-27

Address: 520 Balistreri Mount, South Armand, OR 60528

Phone: +466880739437

Job: Future Retail Associate

Hobby: Polo, Scouting, Worldbuilding, Cosplaying, Photography, Rowing, Nordic skating

Introduction: My name is Velia Krajcik, I am a handsome, clean, lucky, gleaming, magnificent, proud, glorious person who loves writing and wants to share my knowledge and understanding with you.