Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4f0afcc
Enable OpenAI service
pyarmak Sep 24, 2024
140fa68
Enable OpenAI service settings
pyarmak Sep 24, 2024
f59c16b
v0.5.5
pyarmak Sep 28, 2024
3290240
Small build fixes
pyarmak Sep 28, 2024
43509b8
remove accidental commit of manifest
pyarmak Sep 28, 2024
610485d
Put the manifest back where it belongs
pyarmak Sep 28, 2024
9eb4024
Change to rollup from esbuild for worklet support
pyarmak Oct 4, 2024
278ae13
Audio worklet working with OpenAI service
pyarmak Oct 4, 2024
56d9450
Dynamically include soundtouch-worklet at build time from node_modules
pyarmak Oct 4, 2024
9124d3a
Remove unused esbuild config
pyarmak Oct 4, 2024
48dc258
Add banner and suppress warnings
pyarmak Oct 4, 2024
5eee0ba
Speed up build with esbuild
pyarmak Oct 4, 2024
c3c1e90
Remove circular dependency
pyarmak Oct 4, 2024
5aad919
WIP refactoring out AudioPlayer
pyarmak Oct 4, 2024
2e298e9
Allow seeking SpeechSynthesis
pyarmak Oct 5, 2024
836d08b
Controls working
pyarmak Oct 5, 2024
c5237c8
Add Speaking indicator to statusbar
pyarmak Oct 5, 2024
aafa9f8
Update settings UI
pyarmak Oct 5, 2024
57091b0
Added RegExp settings
pyarmak Oct 5, 2024
a2467f5
SpeechSynthesis statusbar bugfixes
pyarmak Oct 5, 2024
5938d93
Update rollup dev config
pyarmak Oct 5, 2024
c0838ba
OpenAI statusbar bugfixes
pyarmak Oct 5, 2024
eb0f8fa
Azure statusbar bugfixes
pyarmak Oct 5, 2024
a8a2b95
ES6 compatibility and language fixes
pyarmak Oct 5, 2024
c72d713
Moved seekbar styles to styles.css
pyarmak Oct 5, 2024
a0a98fc
Added styles.css to publish workflow
pyarmak Oct 5, 2024
d3a7358
Change pause icon
pyarmak Oct 5, 2024
05d62be
Fix controls on markdownview
pyarmak Oct 5, 2024
99482b0
Enable plugin, excluding SpeechSythesis service, on Android
pyarmak Oct 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: "14.x" # You might need to adjust this value to your own version
node-version: "16.x" # You might need to adjust this value to your own version
- name: Build
id: build
run: |
npm install -g yarn
yarn
yarn run build
mkdir ${{ env.PLUGIN_NAME }}
cp main.js manifest.json ${{ env.PLUGIN_NAME }}
cp main.js manifest.json styles.css ${{ env.PLUGIN_NAME }}
zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }}
ls
echo "::set-output name=tag_name::$(git tag --sort version:refname | tail -n 1)"
Expand Down
29 changes: 0 additions & 29 deletions esbuild.config.mjs

This file was deleted.

20 changes: 10 additions & 10 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"id": "obsidian-tts",
"name": "Text to Speech",
"version": "0.5.4",
"minAppVersion": "1.4.0",
"description": "Hear your notes.",
"author": "Johannes Theiner",
"authorUrl": "https://github.com/joethei",
"isDesktopOnly": false
}
{
"id": "obsidian-tts",
"name": "Text to Speech",
"version": "0.5.5",
"minAppVersion": "1.4.0",
"description": "Hear your notes.",
"author": "Johannes Theiner",
"authorUrl": "https://github.com/joethei",
"isDesktopOnly": false
}
34 changes: 24 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,51 @@
{
"name": "obsidian-tts",
"version": "0.5.3",
"version": "0.5.5",
"description": "Text to speech for Obsidian. Hear your notes.",
"main": "main.js",
"scripts": {
"dev": "node esbuild.config.mjs",
"build": "node esbuild.config.mjs production",
"dev": "rollup --config rollup.config.dev.mjs -w",
"build": "rollup --config rollup.config.build.mjs",
"lint": "eslint . --ext .ts",
"docs": "typedoc"
},
"keywords": [],
"author": "joethei",
"license": "GPL-3.0",
"dependencies": {
"@cospired/i18n-iso-languages": "^3.1.1",
"@cospired/i18n-iso-languages": "^4.2.0",
"@soundtouchjs/audio-worklet": "^0.1.17",
"@types/node": "^16.11.6",
"@vanakat/plugin-api": "0.1.0",
"builtin-modules": "^3.2.0",
"microsoft-cognitiveservices-speech-sdk": "^1.40.0",
"obsidian": "1.4.11",
"tslib": "2.3.1",
"typescript": "4.4.4",
"regenerator-runtime": "^0.14.1",
"soundtouchjs": "^0.1.30",
"tinyld": "1.2.3",
"@vanakat/plugin-api": "0.1.0"
"tslib": "2.3.1",
"typescript": "4.4.4"
},
"devDependencies": {
"@colingm/rollup-plugin-web-worker-loader": "^1.6.1",
"@microsoft/tsdoc": "0.14.1",
"@rollup/plugin-commonjs": "^28.0.0",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.3.0",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"esbuild": "0.13.12",
"eslint": "7.32.0",
"@microsoft/tsdoc": "0.14.1",
"eslint-plugin-tsdoc": "0.2.16",
"rollup": "^4.24.0",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-delete": "^2.1.0",
"rollup-plugin-esbuild": "^6.1.1",
"typedoc": "0.22.18"
},
"overrides": {
"obsidian" : "$obsidian"
"obsidian": "$obsidian",
"@colingm/rollup-plugin-web-worker-loader": {
"rollup": "$rollup"
}
}
}
52 changes: 52 additions & 0 deletions rollup.config.build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import webWorkerLoader from '@colingm/rollup-plugin-web-worker-loader';
import del from 'rollup-plugin-delete';
import copy from 'rollup-plugin-copy';
import esbuild from 'rollup-plugin-esbuild'

const banner =
`/*
THIS IS A GENERATED/BUNDLED FILE CREATED USING ROLLUP
If you want to view the source, please visit the github repository of this plugin
https://github.com/joethei/obsidian-tts
*/
`;

export default {
input: 'src/main.ts',
output: {
dir: '.',
banner: banner,
sourcemap: 'inline',
format: 'cjs',
exports: 'default'
},
external: ['obsidian', 'electron'],
plugins: [
nodeResolve({browser: true}),
commonjs(),
esbuild({ target: 'es2015', minify: true }),
json(),
webWorkerLoader({ targetPlatform: 'browser' }),
copy({
targets: [{
src: 'node_modules/@soundtouchjs/audio-worklet/dist/soundtouch-worklet.js',
dest: 'src'
}],
hook: 'buildStart'
}),
del({
targets: 'src/soundtouch-worklet.js',
hook: 'buildEnd'
})
],
onwarn: function(warning, warner) {
if (warning.id && /node_modules/.test(warning.id)) return;
if (warning.ids && warning.ids.every((id) => /node_modules/.test(id)))
return;

warner(warning);
}
};
45 changes: 45 additions & 0 deletions rollup.config.dev.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import {nodeResolve} from '@rollup/plugin-node-resolve';
import json from '@rollup/plugin-json';
import commonjs from '@rollup/plugin-commonjs';
import webWorkerLoader from '@colingm/rollup-plugin-web-worker-loader';
import del from 'rollup-plugin-delete';
import copy from 'rollup-plugin-copy';
import esbuild from 'rollup-plugin-esbuild'

export default {
input: 'src/main.ts',
output: {
dir: './dist/obsidian-tts',
sourcemap: 'inline',
format: 'cjs',
exports: 'default'
},
external: ['obsidian', 'electron'],
plugins: [
nodeResolve({browser: true}),
commonjs(),
esbuild({ target: 'es2015', minify: false }),
json(),
webWorkerLoader({ targetPlatform: 'browser' }),
copy({
targets: [{
src: 'node_modules/@soundtouchjs/audio-worklet/dist/soundtouch-worklet.js',
dest: 'src'
},
{ src: ['manifest.json'], dest: './dist/obsidian-tts' }
],
hook: 'buildStart'
}),
del({
targets: 'src/soundtouch-worklet.js',
hook: 'buildEnd'
})
],
onwarn: function(warning, warner) {
if (warning.id && /node_modules/.test(warning.id)) return;
if (warning.ids && warning.ids.every((id) => /node_modules/.test(id)))
return;

warner(warning);
}
};
4 changes: 2 additions & 2 deletions src/LanguageVoiceModal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Modal, Setting} from "obsidian";
import {LanguageVoiceMap} from "./settings";
import { LanguageVoiceMap } from "./DEFAULT_SETTINGS";
import {TextInputPrompt} from "./TextInputPrompt";
import TTSPlugin from "./main";
import languages from "@cospired/i18n-iso-languages";
Expand Down Expand Up @@ -73,7 +73,7 @@ export class LanguageVoiceModal extends Modal {
.setIcon("play-audio-glyph")
.setTooltip("Test voice")
.onClick(async() => {
const input = new TextInputPrompt(this.app, "What do you want to hear?", "", "Hello world this is Text to speech running in obsidian", "Hello world this is Text to speech running in obsidian");
const input = new TextInputPrompt(this.app, "What do you want to hear?", "", "Hello world this is Text to speech running in obsidian", "Hello world this is Text to speech running in obsidian", "Play", false);
await input.openAndGetValue((async value => {
if (value.getValue().length === 0) return;
await this.plugin.serviceManager.sayWithVoice(value.getValue(), this.id);
Expand Down
111 changes: 93 additions & 18 deletions src/ServiceConfigurationModal.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import {Modal, Setting} from "obsidian";
import TTSPlugin from "./main";
import {DEFAULT_SETTINGS, STYLE_OPTIONS, ROLE_OPTIONS, SERVICE_OPTIONS} from "./constants";

export class ServiceConfigurationModal extends Modal {
plugin: TTSPlugin;
service: string;

constructor(plugin: TTSPlugin) {
constructor(plugin: TTSPlugin, service?: string) {
super(plugin.app);
this.plugin = plugin;
this.service = service || '';
}

display(service?: string): void {
Expand All @@ -15,19 +18,22 @@ export class ServiceConfigurationModal extends Modal {

contentEl.empty();

new Setting(contentEl)
.setName('Service')
.setDesc('test')
.addDropdown((dropdown) => {
dropdown.addOption('openai', 'OpenAI');
dropdown.addOption('microsoft', 'Microsoft Azure');
if (!service) {
new Setting(contentEl)
.setName('Service')
.setDesc('Add a remote voice service')
.addDropdown((dropdown) => {
Object.entries(SERVICE_OPTIONS).forEach(([key, value]) => {
dropdown.addOption(key, value);
});

dropdown.setValue(service);
dropdown.setValue(service);

dropdown.onChange(async(value) => {
this.display(value);
})
});
dropdown.onChange(async(value) => {
this.display(value);
})
});
}

if (service === 'openai') {
new Setting(contentEl)
Expand All @@ -40,19 +46,88 @@ export class ServiceConfigurationModal extends Modal {
this.plugin.settings.services.openai.key = value;
await this.plugin.saveSettings();
});
})
;
});
}

if (service === 'azure') {
new Setting(contentEl)
.setName('API key')
.setDesc('Azure speech services API key')
.addText(async text => {
text
.setValue(this.plugin.settings.services.azure.key)
.onChange(async value => {
this.plugin.settings.services.azure.key = value;
await this.plugin.saveSettings();
});
});
new Setting(contentEl)
.setName('Speech region')
.setDesc('Azure speech services region')
.addText(async text => {
text
.setValue(this.plugin.settings.services.azure.region)
.onChange(async value => {
this.plugin.settings.services.azure.region = value;
await this.plugin.saveSettings();
});
});
new Setting(contentEl)
.setName('Role')
.addDropdown((dropdown) => {
Object.entries(ROLE_OPTIONS).forEach(([key, value]) => {
dropdown.addOption(key, value);
});

}
dropdown.setValue(this.plugin.settings.services.azure.role);
dropdown.onChange(async(value) => {
this.plugin.settings.services.azure.role = value;
await this.plugin.saveSettings();
})
});
new Setting(contentEl)
.setName('Style')
.addDropdown((dropdown) => {
Object.entries(STYLE_OPTIONS).forEach(([key, value]) => {
dropdown.addOption(key, value);
});

dropdown.setValue(this.plugin.settings.services.azure.style);
dropdown.onChange(async(value) => {
this.plugin.settings.services.azure.style = value;
await this.plugin.saveSettings();
})
});
new Setting(contentEl)
.setName("Intensity")
.addSlider(async (slider) => {
slider
.setValue(this.plugin.settings.services.azure.intensity * 100)
.setDynamicTooltip()
.setLimits(0, 200, 1)
.onChange(async (value: number) => {
this.plugin.settings.services.azure.intensity = value / 100;
await this.plugin.saveSettings();
});
}).addExtraButton((button) => {
button
.setIcon('reset')
.setTooltip('restore default')
.onClick(async () => {
this.plugin.settings.services.azure.intensity = DEFAULT_SETTINGS.services.azure.intensity;
await this.plugin.saveSettings();
this.display();
});
});
}
}

onOpen(): void {
//@ts-ignore
this.setTitle('Add new service');
this.display();

if (this.service) this.setTitle(`Configure ${SERVICE_OPTIONS[this.service]} service`);
//@ts-ignore
else this.setTitle('Add new service');
this.display(this.service);
}


Expand Down
Loading