Skip to content

Commit

Permalink
Merge branch 'OggOpusSupport'
Browse files Browse the repository at this point in the history
  • Loading branch information
pgmichael committed Jun 29, 2019
2 parents db5f638 + e078ccf commit 7bad514
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class WaveNet {
chrome.storage.sync.get(null, async (settings) => {
if (!this.validateSettings(settings)) return

let audioContent = await this.getAudioContent(settings, string)
let audioContent = await this.getAudioContent(settings, 'LINEAR16', string)
if (audioContent !== null) {
const blob = await (await fetch(`data:audio/mp3;base64,${audioContent}`)).blob()
chrome.downloads.download({
Expand All @@ -24,8 +24,8 @@ class WaveNet {
chrome.storage.sync.get(null, async (settings) => {
if (!this.validateSettings(settings)) return

let audioContent = await this.getAudioContent(settings, string)
this.speaker.src = `data:audio/wav;base64,${audioContent}`
let audioContent = await this.getAudioContent(settings, 'OGG_OPUS', string)
this.speaker.src = `data:audio/ogg;base64,${audioContent}`
await this.speaker.play()
chrome.contextMenus.update('stop', { enabled: true })
})
Expand All @@ -36,10 +36,10 @@ class WaveNet {
chrome.contextMenus.update('stop', { enabled: false })
}

async getAudioContent(settings, string) {
async getAudioContent(settings, audioEncoding, string) {
let request = {
audioConfig: {
audioEncoding: 'LINEAR16',
audioEncoding: audioEncoding,
pitch: settings.pitch,
speakingRate: settings.speed
},
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "WaveNet for Chrome",
"version": "1.7.0",
"version": "1.8.0",
"manifest_version": 2,
"description": "A wrapper for Google Cloud Text-to-Speech that transform highlighted text into high-quality natural sounding audio.",
"icons": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wavenet-for-chrome",
"version": "1.7.0",
"version": "1.8.0",
"description": "A wrapper for Google Cloud Text-to-Speech that transform highlighted text into high-quality natural sounding audio.",
"main": ".eslintrc.js",
"scripts": {
Expand Down

0 comments on commit 7bad514

Please sign in to comment.