# Soundpaste WordPress Plugin

A WordPress plugin that automatically generates audio versions of your articles using the ElevenLabs API and embeds a media player at the top of each post.

## Features

- Automatically generates audio from article content using ElevenLabs API
- Embeds a responsive media player at the top of each article
- Caches generated audio files to improve performance
- Easy configuration through WordPress admin panel for ElevenLabs API key
- Responsive design that works on all devices
- Custom shortcodes to control pacing and silence portions of text
- Phonetic customization for precise pronunciation control (if supported by ElevenLabs)

## Installation

1. Download the plugin files and upload them to your `/wp-content/plugins/Soundpaste` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Go to Settings > Soundpaste to configure your ElevenLabs API key

## Configuration

1. Get your API key from the ElevenLabs dashboard
2. Go to WordPress admin panel > Settings > Soundpaste
3. Enter your ElevenLabs API key
4. Save the settings

## Usage

The plugin will automatically:

- Generate audio from your article content when a post is viewed
- Cache the generated audio file for future use
- Display a media player at the top of each article

### Shortcodes for Audio Control

You can use special shortcodes to control the pacing and content of your audio:

#### Adding Pauses

Insert a pause in the spoken text:

```
[sb_pause length="short"]    <!-- Adds a 0.5 second pause -->
[sb_pause length="medium"]   <!-- Adds a 1 second pause (default) -->
[sb_pause length="long"]     <!-- Adds a 2 second pause -->
[sb_pause seconds="3.5"]     <!-- Adds a custom length pause (max 5 seconds) -->
```

Example:

> The first point is important. [sb_pause] The second point is even more critical.

This will create a 1-second pause between the sentences.

#### Silencing Text

Prevent specific text from being spoken:

```
[sb_silence]This text won't be read aloud[/sb_silence]
```

Example usage:

> Here's the main content. [sb_silence](Figure 1: Shows the data in chart form)[/sb_silence] The data confirms our hypothesis.

This is useful for:

- Image captions
- Reference notes
- Technical details that don't work well when spoken
- Content that only makes sense visually

#### Phonetic Pronunciation

Control exactly how words are pronounced using phonetic transcription:

```
[sb_phoneme alphabet="ipa" ph="təˈmeɪtoʊ"]tomato[/sb_phoneme]
```

Parameters:

- `alphabet` - Phonetic alphabet to use (default: "ipa")
  - `ipa` - International Phonetic Alphabet
  - `x-sampa` - Extended Speech Assessment Methods Phonetic Alphabet
- `ph` - The phonetic transcription to use for the enclosed text

Examples:

- British pronunciation: `[sb_phoneme alphabet="ipa" ph="təˈmɑːtəʊ"]tomato[/sb_phoneme]`
- American pronunciation: `[sb_phoneme alphabet="ipa" ph="təˈmeɪtoʊ"]tomato[/sb_phoneme]`
- Technical term: `[sb_phoneme alphabet="ipa" ph="ˈmaɪkrəʊˌsɜːvɪsɪz"]microservices[/sb_phoneme]`
- Name: `[sb_phoneme alphabet="ipa" ph="ˈaɪnstaɪn"]Einstein[/sb_phoneme]`

This shortcode is particularly useful for:

- Names that are difficult to pronounce
- Technical terms or jargon
- Foreign words or phrases
- Words with ambiguous pronunciation

##### Resources for Phonetic Transcriptions

- [Cambridge Dictionary Pronunciation](https://dictionary.cambridge.org/pronunciation/) - Provides IPA pronunciations for both British and American English

## Development

## Requirements

- WordPress 5.0 or higher
- PHP 7.2 or higher
- A valid ElevenLabs API key

## Support

For support, please open an issue on the GitHub repository or contact the plugin author.

## License

This plugin is licensed under the GPL v2 or later.
