Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Test Subject
Original Poster
#1 Old 26th Jul 2020 at 10:33 PM
Default Getting access to TuningPlayAudio
Hey has anyone had any luck playing audio via play_tunable_audio function from the primitive.py file?
I have been trying to do that for a custom audio mod.

I tried to copy this into my script, but unfortunately I couldn't get the bills_paid_sfx to load because my script couldn't run the TunablePlayAudio constructor properly for some reason.
Code:
play_tunable_audio(self.AUDIO.bills_paid_sfx)



This is what the assignment for AUDIO looks like in the bills.py file (where I am trying to copy it from:
Code:
AUDIO = TunableTuple(description='Tuning for all the audio stings that will play as a part of bills.',
                                                  delinquency_warning_sfx=TunablePlayAudio(description='The sound to play when a delinquency warning is displayed. ')
...


Audio is a tuple that seems to contain other Objects.
So I tried to do something like:
Code:
play_tunable_audio(AUDIO.delinquency_warning_sfx)

after copying the code for AUDIO tuple initialization from bills.py but the code couldn't find delinquency_warning_sfx. I am guessing that it somehow gets injected dynamically based on some tuning file for that file (bills.py) but not for my mod.
Does anyone know where I can look at to figure this out?
Advertisement
Lab Assistant
#2 Old 7th Aug 2020 at 6:15 AM
AUDIO is an attribute of the Bills class.
You'll need to reference AUDIO like this: Bills.AUDIO
This code will play the sound.

Code:
from audio.primitive import play_tunable_audio
from sims.bills import Bills
play_tunable_audio(Bills.AUDIO.bills_paid_sfx)
Back to top