semvec/pypi-packages huggingface dataset:
hlvox 0.17.0
Pieces together voice files to form sentences
License: MIT
Requires Python: >=3.11

# HLVox

[![pipeline status](https://gitlab.com/bhagen/hlvox/badges/master/pipeline.svg)](https://gitlab.com/bhagen/hlvox/commits/master)
[![coverage report](https://gitlab.com/bhagen/hlvox/badges/master/coverage.svg)](https://gitlab.com/bhagen/hlvox/commits/master)
[![PyPI version](https://badge.fury.io/py/hlvox.svg)](https://badge.fury.io/py/hlvox)

Originally intended to create sentences from the word snippets for the 
Half Life 1 Vox, this project can take a folder of word audio files and piece 
them into sentences.
This repo when used standalone (ie by running `voice.py` directly) will output
the sentences as audio files.

## Getting Started

To use this project, you will first need a folder full of voice files.
If you have Half Life 1 installed, the voices can be extracted from the VPK 
files using something like GCFScape.

### Prerequisites

Check pipenv file for Python package requirements.

An installation of FFMpeg is required. On Ubuntu, just run the following:

```
apt update
apt install ffmpeg
```

For persistence, a local `sqlite` database can be used, or a `postgresql` database. These are not exposed through the basic CLI.

### Installing

How to set up a basic dev environment:

Pull this repo

```
git pull https://gitlab.com/bhagen/hlvox.git
```

Change into the new repo directory

```
cd hlvox
```

Install requirements using pipenv
```
pipenv install 
```

Enter pipenv
```
pipenv shell
```

### Quick Start

If you want to jump right into generating a sentence, you can point `voice.py` 
at a folder of voice audio files!

```
python hlvox/voice.py --voice-dir ~/my_folder_of_voice_files "the sentence I want to generate"
```

Your sentence will be exported in the same directory
that you ran the file from.

### Installing package locally for development
After entering pipenv shell:
```
pip install --editable .
```

## Running the tests

Just run `pytest` from the base directory of the repo

## Documentation Generation

I used [Sphinx](http://www.sphinx-doc.org) to create autodoc documentation
from docstrings in the modules.

Change into doc directory
```
cd doc
```

(If you've modified the source code, grab the new apidocs
```
sphinx-apidoc -f -o ./source ../hlvox
```


Generate documentation
```
make html
```


## Authors

* **Blair Hagen** - *Initial work* - [bhagen](https://github.com/bhagen)


## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

## Acknowledgments

* Thanks to Valve for making such an amazing voice
yan-logger 0.1.2
Use Python's logging instead of print to quickly output program information to the screen and log files, distinguish information levels by color, and include the ability to calculate program runtime. 
License: MIT
Requires Python: >=3.8

# MyLogger
Use Python's logging instead of print to quickly output program information to the screen and log files, distinguish information levels by color, and include the ability to calculate program runtime.

具备功能：
1. 支持不同日志等级以不同颜色输出。
2. 支持同时输出到屏幕及日志文件内。
3. 支持常用的日志设置。
4. 支持计算程序运行时间。
5. 支持原生print函数，附带文件名和行号。
# 快速使用
安装:<br>
`pip install yan-logger`

```python
from yan-logger import MyLogger  # 导入

mg = MyLogger()
mg.debug('debug')
mg.info('info')
mg.warning('warning')
mg.error('error')
mg.critical('critical')
```
运行结果：
包含 日志器名称、运行时间点、运行文件名、输出所在行号。不同日志等级以不同颜色输出，见下图：
<img width="690" height="281" alt="image" src="https://github.com/user-attachments/assets/0e304879-8c72-4881-996a-f897a1bbc463" />

# 进阶使用
可自定义输出到屏幕和保存到日志文件两种handler，分别独立设置级别。
启用保存到文件时，还可设置按日期循环及文件大小循环两种模式对文件进行切割。
具体参数设置见源码，也可参考RotatingFileHandler及TimedRotatingFileHandler的参数。
```python
from yan-logger import MyLogger

mg = MyLogger("new_logger", file_path='log_demo.log')   # 自定义日志器名称，输出到屏幕且保存到log_demo.log文件中。  具体参数设置见源码。
mg.stream_logger_level= "warning"                       # 设置输出到屏幕的日志级别为"warning"
mg.file_logger_level = 20                               # 设置保存到日志文件的级别为 “info”， 级别设置用数字和单词均可。
mg.debug('debug')
mg.info('info')
mg.warning('warning')
mg.error('error')
mg.critical('critical')
```
运行结果：
在屏幕上只输出"warning" 级别以上的内容，在日志文件中是输出info级别内容。
<img width="652" height="167" alt="image" src="https://github.com/user-attachments/assets/adc59dba-c6fd-42ca-b80f-365bf9a1b3b1" />

**计算程序运行时间**
```python
from yan-logger import MyLogger

mg = MyLogger("new_logger")

# 方法一，用with mg.with_run_time()包裹需要计算的代码即可
with mg.with_run_time():
    for _ in range(3):
        mg.debug(_)
        mg.time.sleep(1)

# 方法二，使用装饰器mg.run_time(),默认参数1 只运行一遍函数。
@mg.run_time()
def fun():
    for _ in range(3):
        mg.debug(_)
        mg.time.sleep(1)

fun()
```
运行结果如下:

自动输出程序运行时间<br>
<img width="701" height="444" alt="image" src="https://github.com/user-attachments/assets/65e318ce-29fe-4b1e-8a54-c97d81abd418" />

# 集成小功能
1. 集成实例静态print函数，增加显示文件名及行号。
2. 类方法集成了sleep模块，不用多次导入。
```python
with ml.with_run_time():
    MyLogger.print("开始计时……")         # 集成实例静态print函数，增加显示文件名及行号。
    MyLogger.time.sleep(3)              # 类方法集成了sleep模块，不用多次导入。
    MyLogger.print("with 模块运行结束。")
```
运行结果<br>
<img width="681" height="118" alt="image" src="https://github.com/user-attachments/assets/6cabca90-ed7c-41a5-bd61-ae272d8af3e3" />