PetitTournesol / Edgeware

Elsavirus inspired fetishware, built from the ground up to use interchangeable packages for better user experience.
MIT License
128 stars 94 forks source link

Audio from videos doesn't work #56

Open squcisse opened 11 months ago

squcisse commented 11 months ago

I installed the fix available here #47 and now the audio from videos doesn't work, no matter what volume I put them on with the config

polpokpol commented 11 months ago

i think it's the "to_soundarray()" of popup.pyw.

it always go to the except match whenever it executes the to_soundarray() skipping the print(self.audio_track) Making videos no volume.

squcisse commented 11 months ago

What should I do to fix it ?

polpokpol commented 11 months ago

im still trying to fix it. Still no sound but i hope I make a good progress. I only did basic python on college sorry. I will just report my findings here hoping the developer would notice. In the popup.pyw, class videolabel.

def load:

  1. Whenever it goes to the try: section it fails to read self.audio_track = self.audio.to_soundarray() then of course it will go to the except: section which will self.audio_track = None which will not play any videosound what so ever. What I did was edit self.audio_track = self.audio.to_soundarray() to self.audio_track = self.audio.to_soundarray(tt = 2, fps=44100, nbytes=32) which will not throw an error that forces the code to go in except: section.

  2. Still it is going to except: section because of another problem that is self.audio_track = [ [VIDEO_VOLUME*v[0], VIDEO_VOLUME*v[1] ] for v in self.audio_track] so I changed it to first line: self.audio_track[0] = self.audio_track[0] * (VIDEO_VOLUME + 30000), second line: self.audio_track[1] = self.audio_track[1] * (VIDEO_VOLUME + 30000).

After doing this, it allowed me to not get an exception error in the def load section, now we will go to def play section.

def play:

  1. In the try: section whenever sounddevice.play(self.audio_track, samplerate=len(self.audio_track) / self.duration, loop=True) is executed it will throw an error and of course go to the except: section. So I changed the code to sounddevice.play(self.audio_track, 64000, loop=True) just to see if it will throw an error and it does not.

My test results:

  1. If I use import playsound it will have a sound but it will not have a video.
  2. In the number 2 where I explaned the VIDEO_VOLUME adding 30000 mutes or stops the other music playing in the background in my case it is youtube, after I hit the panic button the youtube automatically resumes.
  3. What I am thinking right now is in number 3, the sounddevice.play is the only thing that is stopping me fixing this.
vin816 commented 10 months ago

Any updates on the the issue?