Showing posts with label Convert. Show all posts
Showing posts with label Convert. Show all posts

03 April 2026

How to convert .wav files into .mp3 ones?

Converting WAV to MP3 (Offline)
If you need an MP3 file instead of WAV, use lame:
  1. Install Lame: sudo apt-get install lame
  2. Convert: lame -V2 output.wav output.mp3

How can I convert a text file into an audio file without internet access on ubuntu?

$ pip install piper-tts

 

Since you installed it via pip, you can use the piper command directly in your terminal. Because Piper is a "neural" text-to-speech engine, it doesn't come with voices built-in; you have to provide a model file (.onnx) and its configuration file (.json).

Here is the workflow to convert your text file:

1. Get a Voice Model

If you haven't already, download a voice from the official repository. You need both files for a specific voice (e.g., en_US-lessac-medium.onnx and en_US-lessac-medium.onnx.json).

2. The Conversion Command

To convert a text file (let's call it input.txt) into an audio file (output.wav), use the following syntax:

Bash
piper --model /path/to/voice.onnx < input.txt --output_file output.wav

3. Practical Example

If your text file is named script.txt and your model is in the same folder, run:

Bash
cat script.txt | piper --model en_US-lessac-medium.onnx --output_file speech.wav

Pro Tips for Better Usage

  • Adjusting Speed: Use the --length_scale flag. A higher number makes it slower, a lower number makes it faster.

    • Example (Slower): --length_scale 1.5

  • Adding Pause/Sentence Gap: Use the --sentence_silence flag to add seconds of silence between sentences.

    • Example: --sentence_silence 0.5

  • Batch Processing: If you want to listen to the file immediately without saving it, you can pipe it to a player like aplay (built-in to Ubuntu):

    Bash
    cat script.txt | piper --model en_US-lessac-medium.onnx --output-raw | aplay -r 22050 -f S16_LE -t raw
    

Quick Note: If you get a "command not found" error, your pip script folder might not be in your PATH. You can usually fix this by running python3 -m piper instead of just piper at the start of the command.

Do you have a specific voice or language in mind, or are you looking for recommendations on the best-sounding models?

 

Sorry, I open the page, but can not find en_US-lessac-medium.onnx and en_US-lessac-medium.onnx.json

 

# Download the .onnx model file
wget -O en_US-lessac-medium.onnx "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx?download=true"

# Download the .json config file
wget -O en_US-lessac-medium.onnx.json "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx.json?download=true"

 

# Download the .onnx model file (approx. 114MB)
wget -O en_GB-cori-high.onnx "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/cori/high/en_GB-cori-high.onnx?download=true"

# Download the .json config file
wget -O en_GB-cori-high.onnx.json "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/cori/high/en_GB-cori-high.onnx.json?download=true"

 

Run the conversion

Once those are finished, use this command to convert your text file (e.g., input.txt) to a UK-voiced audio file:

Bash
cat input.txt | piper --model en_GB-cori-high.onnx --output_file uk_speech.wav

Other UK Options

Gemini, could you give me the commands for downloading some other GB voice models, please? Thank you!
 

Here are the commands for some of the most popular British (UK) voice models available for Piper. Each model has a slightly different personality and quality level.

1. Alan (Male - Medium Quality)

This is a standard, clear male British voice.

Bash
# Model
wget -O en_GB-alan-medium.onnx "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/alan/medium/en_GB-alan-medium.onnx?download=true"

# Config
wget -O en_GB-alan-medium.onnx.json "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/alan/medium/en_GB-alan-medium.onnx.json?download=true"

2. Southern English Female (Female - Low Quality)

Despite being "low" quality, it is very fast and efficient, with a distinct southern accent.

Bash
# Model
wget -O en_GB-southern_english_female-low.onnx "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/southern_english_female/low/en_GB-southern_english_female-low.onnx?download=true"

# Config
wget -O en_GB-southern_english_female-low.onnx.json "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/southern_english_female/low/en_GB-southern_english_female-low.onnx.json?download=true"

3. VCTK (Multi-speaker - Medium Quality)

The VCTK model is unique because it contains dozens of different British speakers in one file. You can switch between them using the --speaker flag (e.g., --speaker 0, --speaker 1, etc.).

Bash
# Model
wget -O en_GB-vctk-medium.onnx "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/vctk/medium/en_GB-vctk-medium.onnx?download=true"

# Config
wget -O en_GB-vctk-medium.onnx.json "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/vctk/medium/en_GB-vctk-medium.onnx.json?download=true"

How to use them

Just swap the model name in your command. For example, to use the Alan voice:

Bash
cat temp03.txt | piper --model en_GB-alan-medium.onnx --output_file output_alan.wav

Pro Tip: Automating the check

Since you've had issues with corrupted downloads before, you can run this quick "check" after downloading to see if the file is valid:

Bash
# This will show the size; Alan should be ~15MB, VCTK ~45MB
ls -lh *.onnx

If you ever want to try a Northern English accent, there is also a northern_english_male model available—just let me know and I'll grab those links for you!

 

Yes, please. Thank you!

 

The Northern English voice is a great choice—it has a very distinct, warm character compared to the standard "Received Pronunciation" (London-style) voices.

Here are the commands for the Northern English Male model (Medium quality):

1. Download the Northern English Voice Files

Bash
# Download the .onnx model file (approx. 63MB)
wget -O en_GB-northern_english_male-medium.onnx "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/northern_english_male/medium/en_GB-northern_english_male-medium.onnx?download=true"

# Download the .json config file
wget -O en_GB-northern_english_male-medium.onnx.json "https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_GB/northern_english_male/medium/en_GB-northern_english_male-medium.onnx.json?download=true"

2. Run the conversion

Use this command to hear the new accent:

Bash
cat temp03.txt | piper --model en_GB-northern_english_male-medium.onnx --output_file northern_uk.wav

A Quick Tip for Your Setup

Since you've downloaded several voices now, your folder might be getting a bit crowded. You can verify all your available models at once with:

Bash
ls -lh *.onnx

Common Model Sizes for Comparison:

  • Cori (High): ~114 MB

  • Northern English (Medium): ~63 MB

  • Alan (Medium): ~15 MB

If any of these files show a size of only a few KB, they didn't download correctly—just delete that specific file and run the wget command for it again.

Enjoy the new voice! It’s one of the more unique ones in the British collection.

 

01 February 2026

20 January 2026

How to convert a PDF file into a Markdown file or HTML file?

To convert a PDF into a Markdown file using the Python-based tool called Marker on Ubuntu, you need to set up the environment, install the
marker-pdf package, and then use the command-line interface. 
Prerequisites
Before installing Marker, ensure your Ubuntu system meets the following prerequisites:
  • Python: Version 3.10 or higher is required.
  • PyTorch: Marker needs PyTorch to run, as it relies on deep learning models.
  • System Libraries: You may need additional system libraries for advanced features like OCR with ocrmypdf or tesseract. 
Step-by-Step Guide
  1. Open your terminal on Ubuntu.
  2. Install system dependencies (optional, but recommended for full functionality, including OCR):
    bash
    # Install required apt packages
    sudo apt-get update
    sudo apt-get install -y build-essential libssl-dev libffi-dev python3-dev
    # Install tesseract and ghostscript related dependencies
    sudo apt-get install -y libleptonica-dev libtesseract-dev pkg-config
    sudo apt-get install -y ocrmypdf ghostscript
    
  3. Create a virtual environment to avoid conflicts with other Python projects (recommended):
    bash
    python3 -m venv marker_env
    source marker_env/bin/activate
    
  4. Install PyTorch by following the instructions on the official PyTorch website for your specific system configuration (CPU or GPU). A typical CPU-only installation command might look like:
    bash
    pip install torch torchvision torchaudio
    
  5. Install Marker using pip. You can install the basic PDF package or the full version for other document types:
    bash
    # For PDF conversion only
    pip install marker-pdf
    
    # For full functionality (PDFs, images, etc.)
    # pip install 'marker-pdf[full]'
    
  6. Convert a PDF file to Markdown using the command line tool marker_single.

    $ marker_single /path/to/file.pdf  

    --output_format [markdown|json|html|chunks]: Specify the format for the output results.
    --output_dir PATH: Directory where output files will be saved. Defaults to the value specified in settings.OUTPUT_DIR.

    https://github.com/datalab-to/marker

31 December 2025

which ai (free of charge) can convert the all kinds of input boxes of a pdf file into fillable and clickable?

For free AI tools that turn PDF input boxes into fillable fields, try
Instafill.ai, PDFgear, or LightPDF, which use AI to automatically detect and add text, checkbox, and signature fields to static PDFs, letting you download them as interactive forms, though some free tiers might have limits. 

Top Free AI Options:
  • Instafill.ai: Uses AI to scan and map form fields (like name, date, signature) onto flat PDFs, creating interactive ones with text, checkboxes, and signature fields automatically.
  • PDFgear: Offers a free online tool to add various form fields (text boxes, checkboxes, signatures) and customize them before downloading the fillable PDF.
  • LightPDF: Provides free online tools, including AI features, to convert and edit PDFs into fillable formats. 

How They Work (General Steps):
  1. Upload: You upload your non-fillable (flat) PDF document to the tool's website.
  2. AI Analysis: The AI scans the PDF, looking for field labels (like "Name," "Email") and layout patterns (underlines, boxes).
  3. Field Insertion: It automatically places interactive fields (text boxes, checkboxes, radio buttons, signature spots) in the right places.
  4. Customize & Download: You can review and adjust the fields (size, type, required status) before downloading your new, ready-to-use fillable PDF. 

While many offer robust free tiers, always check their specific limits on pages or features, as advanced AI functions might require payment. 

08 September 2025

05 June 2024

23 May 2023

How to convert texts into speech using AI?

 Canadian Accent Generator

 

Tips on how to use Narakeet to create phone greetings https://www.narakeet.com/languages/canadian-accent-text-to-s...

  1. Write a clear phone script: "Thank you for calling the Centre for Immigrant and Community Services. Please note that our offices are closed on Monday, July 3rd, 2023, in observance of Canada Day. All of our offices will open on Tuesday, July 4th. We hope you have a wonderful and joyous celebration, and happy Canada Day!"
  2. Type the script into Narakeet, including all the punctuations and spaces. The system will pause and adjust the greeting accordingly, regardless of the language.
  3. For Mandarin greeting, please type the Chinese greeting and choose the voice: "Zhihan" (芷涵).
  4. For Cantonese greeting, please adjust the wording of the Chinese greeting to make it sound more natural in Cantonese, and then choose the voice "Pak-chi" (柏芝).
  5. For the English greeting, choose Canadian English and then select "Pamela" as the voice.
  6. Note that Narakeet is a free online tool that only allows 20 free greetings. However, this quote resets once the IP address changes.
  7. After downloading all the greetings, you can combine them using Chipchamp. Remember to leave a 0.5-second pause between each greeting.
  8. Finally, export the greeting after reviewing everything to obtain the final audio file.
  9. TIP: ChatGPT is a good tool for reviewing the clarity of the greetings.

 

====================================================

English

https://ttsmaker.com/

==============================================

Mandarin

https://ttsfree.com/text-to-speech/chinese-mandarin-simplified


==============================================

Cantonese

https://ttsfree.com/text-to-speech/chinese-cantonese-traditional

======================

Concatenate Audio files

https://clideo.com/


27 March 2022

.dav video files | play | convert to .mp4 | concatenate .mp4 files

1. How to play .dav video files?

Wondershare UniConverter



2. How to convert .dav files into .mp4 files?

>ffmpeg -y -i input-file.dav -c:v libx264 -crf 24 output-file.mp4



3. How to concatenate .mp4 files?

For Linux:
$ cat mylist.txt
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
    
$ ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4

For Windows:

(echo file 'first file.mp4' & echo file 'second file.mp4' )>list.txt
ffmpeg -safe 0 -f concat -i list.txt -c copy output.mp4

05 February 2022

How to convert a .rst file into a .html file?

If docutils is not installed, install it with the following command -

#python -m pip install docutils

===================================================

Method 1 (better than Method 2)

https://docutils.sourceforge.io/docs/user/tools.html#rst2html5-py

# rst2html5.py --help

# rst2html5.py <source_rst_file_name.rst> <output.html>



===================================================

Method 2

https://www.geeksforgeeks.org/restructuredtext-rst-file-to-html-file-using-python-for-documentations/

The following python script will convert 'restructured.rst' into 'output.html'


import docutils.core

docutils.core.publish_file(
    source_path ="restructured.rst",
    destination_path ="Output.html",
    writer_name ="html")




10 August 2021

How to read a file, which only contains a string, into Python, and then convert the string into a list?

 How to read a file, which only contains a string, into Python, and then convert the string into a list?


from pathlib import Path

txt = Path('filename.txt').read_text()

list_ = list(txt.split('; '))

08 August 2021

How to convert a pandas dataframe into a python list, and a python list into a pandas dataframe?

 How to convert a pandas dataframe into a python list, and a python list into a pandas dataframe?


1. To convert a pandas dataframe into a python list

email_list = df['Email'].to_list()

or

email_list = df[['Name', 'Email']].to_list()


2. To convert a python list into a pandas dataframe

Examples

>>> mydict = [{'a': 1, 'b': 2, 'c': 3, 'd': 4},
...           {'a': 100, 'b': 200, 'c': 300, 'd': 400},
...           {'a': 1000, 'b': 2000, 'c': 3000, 'd': 4000 }]
>>> df = pd.DataFrame(mydict)
>>> df
      a     b     c     d
0     1     2     3     4
1   100   200   300   400
2  1000  2000  3000  4000