Skip to content

Commit

Permalink
added an audio file transform function
Browse files Browse the repository at this point in the history
  • Loading branch information
bydariogamer committed Apr 27, 2021
1 parent cab4e41 commit 332cc32
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
10 changes: 10 additions & 0 deletions main.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ from level import Level
import colors
import config
from config import DISP_WID, DISP_HEI, BASE_FPS
from pydub import AudioSegment


# INITIALIZE PYGAME
Expand Down Expand Up @@ -65,6 +66,15 @@ def pager(length, cut):
return [slice(i, min(i + cut, length)) for i in range(0, length, cut)]


def transform(path, new_format, replace=False):
audio = AudioSegment.from_file(path)
name = os.path.basename(path).split('.')[0] + '.' + new_format
new_path = os.path.join(os.path.dirname(path), name)
audio.export(new_path, new_format)
if replace:
os.remove(path)


# GAME LOOP
state = 'start'
while state != 'close':
Expand Down
11 changes: 0 additions & 11 deletions utils/sound_transform.py

This file was deleted.

0 comments on commit 332cc32

Please sign in to comment.