Skip to content

Commit aa23c86

Browse files
committed
V3.0.4
1 parent dc0bdc6 commit aa23c86

21 files changed

+160
-82
lines changed

MISST/Assets/Bin/music-dl.exe

13.1 MB
Binary file not shown.

MISST/Assets/UIAssets/code.png

427 Bytes
Loading

MISST/Assets/UIAssets/reload.png

-452 Bytes
Binary file not shown.

MISST/Assets/silent/silence.flac

10.3 KB
Binary file not shown.

MISST/Assets/silent/silence.wav

-11 MB
Binary file not shown.

MISST/MISSTapp.py

+136-63
Large diffs are not rendered by default.

MISST/MISSThelpers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def MISSTlistdir(self, directory):
113113
os_list = os.listdir(directory)
114114
misst_list = []
115115
for _ in os_list:
116-
if os.path.isfile(f"{directory}/{_}/bass.wav") and os.path.isfile(f"{directory}/{_}/drums.wav") and os.path.isfile(f"{directory}/{_}/other.wav") and os.path.isfile(f"{directory}/{_}/vocals.wav"):
116+
if os.path.isfile(f"{directory}/{_}/bass.flac") and os.path.isfile(f"{directory}/{_}/drums.flac") and os.path.isfile(f"{directory}/{_}/other.flac") and os.path.isfile(f"{directory}/{_}/vocals.flac"):
117117
misst_list.append(_)
118118
return misst_list
119119
except:

MISST/MISSTplayer.py

+11-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from MISSTsettings import MISSTsettings
22
import pyaudio
3-
import wave
3+
import soundfile as sf
44
import threading
55
import numpy as np
66

@@ -21,13 +21,12 @@ def __init__(self, files, volumes):
2121
self.center_freqs = [62, 125, 250, 500, 1_000, 2_500, 4_000, 8_000, 16_000] # 62 Hz, 125 Hz, 250 Hz, 500 Hz, 1 KHz, 2.5 KHz, 4 KHz, 8 KHz, 16 KHz
2222

2323
for file in self.files:
24-
wf = wave.open(file, 'rb')
25-
self.frame_rate = wf.getframerate()
26-
self.duration = wf.getnframes() / self.frame_rate
27-
self.channels = wf.getnchannels()
28-
stream = self.p.open(format=self.p.get_format_from_width(wf.getsampwidth()),
29-
channels=wf.getnchannels(),
30-
rate=wf.getframerate(),
24+
data, self.frame_rate = sf.read(file, dtype='int16')
25+
self.duration = len(data) / self.frame_rate
26+
self.channels = data.shape[1]
27+
stream = self.p.open(format=self.p.get_format_from_width(2),
28+
channels=self.channels,
29+
rate=self.frame_rate,
3130
output=True)
3231
self.streams.append(stream)
3332

@@ -44,21 +43,18 @@ def play(self):
4443
break
4544

4645
def get_data(self, stream_index):
47-
wf = wave.open(self.files[stream_index], 'rb')
48-
wf.setpos(self.positions[stream_index])
49-
data = wf.readframes(self.chunk_size)
50-
if data:
51-
self.positions[stream_index] = wf.tell()
46+
data, _ = sf.read(self.files[stream_index], dtype='int16', start=self.positions[stream_index], frames=self.chunk_size)
47+
if len(data) > 0:
48+
self.positions[stream_index] += len(data)
5249
data = self.adjust_volume(data, self.volumes[stream_index])
5350
if self.nightcore == True:
5451
data = self.apply_nightcore(data)
5552
try:
5653
if self.eq() == True:
57-
data = self.apply_eq(data) # apply eq last so it can be applied to nightcore data aswell
54+
data = self.apply_eq(data) # apply eq last so it can be applied to nightcore data as well
5855
except:
5956
# json error
6057
pass
61-
wf.close()
6258
return data
6359

6460
def adjust_volume(self, data, volume):

MISST/MISSTpreprocess.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import soundfile
1010
import julius
1111
import wave
12+
import soundfile as sf
1213
from MISSThelpers import MISSTconsole
1314
import os
1415

@@ -78,6 +79,14 @@ def write_wav(self, wav, filename, samplerate):
7879
f.setframerate(samplerate)
7980
f.writeframes(bytearray(wav.numpy()))
8081

82+
def compress_wav_to_flac(self, wav_file, flac_file):
83+
# Read the WAV file
84+
data, samplerate = sf.read(wav_file)
85+
86+
# Write the FLAC file and delete the WAV file
87+
sf.write(flac_file, data, samplerate, format='FLAC')
88+
os.remove(wav_file)
89+
8190
def convert_audio(self, wav, from_samplerate, to_samplerate, channels):
8291
"""Convert audio from a given samplerate to a target one and target number of channels."""
8392
wav = self.convert_audio_channels(wav, channels)
@@ -135,7 +144,7 @@ def process(
135144
for i in range(len(stems)):
136145
stem = (new_audio[i] / total)[:, :orig_len]
137146
self.write_wav(torch.from_numpy(stem.transpose()), str(outpath / f"{stems[i]}.wav"), sample_rate)
138-
147+
self.compress_wav_to_flac(str(outpath / f"{stems[i]}.wav"), str(outpath / f"{stems[i]}.flac"))
139148
else:
140149
pass
141150

MISST/__version__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '3.0.3'
1+
__version__ = '3.0.4'
6.71 MB
Binary file not shown.
-30 MB
Binary file not shown.
10.1 MB
Binary file not shown.
-30 MB
Binary file not shown.
10.3 MB
Binary file not shown.
9.18 MB
Binary file not shown.
Binary file not shown.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div align="center">
22

33
[![](./MISST/Assets/showcase/banner.png)](https://github.com/Frikallo/MISST)
4-
[![GitHub release](https://img.shields.io/github/release/frikallo/misst.svg)](https://github.com/Frikallo/MISST/releases/latest) [![Github All Releases](https://img.shields.io/github/downloads/frikallo/misst/total?color=blue)](https://github.com/Frikallo/MISST/releases/latest) [![License](https://img.shields.io/github/license/frikallo/misst?color=blue)](https://github.com/Frikallo/MISST/blob/main/LICENSE) [![Hits-of-Code](https://hitsofcode.com/github/frikallo/MISST?branch=main)](https://github.com/Frikallo/MISST/graphs/contributors) [![build](https://github.com/Frikallo/MISST/actions/workflows/MISST.yml/badge.svg)]
4+
[![GitHub release](https://img.shields.io/github/release/frikallo/misst.svg)](https://github.com/Frikallo/MISST/releases/latest) [![Github All Releases](https://img.shields.io/github/downloads/frikallo/misst/total?color=blue)](https://github.com/Frikallo/MISST/releases/latest) [![License](https://img.shields.io/github/license/frikallo/misst?color=blue)](https://github.com/Frikallo/MISST/blob/main/LICENSE) [![Hits-of-Code](https://hitsofcode.com/github/frikallo/MISST?branch=main)](https://github.com/Frikallo/MISST/graphs/contributors)
55

66
</div>
77

requirements-minimal.txt

955 Bytes
Binary file not shown.

requirements.txt

182 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)