feat(text-to-speech): add method to repair wav header for a stream#981
Merged
feat(text-to-speech): add method to repair wav header for a stream#981
Conversation
* the method takes a stream of wav data, reads it into memory, repairs the header, then returns a Promise that resolves with the repaired data as a buffer
Codecov Report
@@ Coverage Diff @@
## master #981 +/- ##
=========================================
+ Coverage 77.77% 100% +22.22%
=========================================
Files 1 1
Lines 9 9
Branches 2 2
=========================================
+ Hits 7 9 +2
+ Misses 2 0 -2
Continue to review full report at Codecov.
|
| // in case of accidentally calling the wrong method | ||
| if (!isStream(wavFileAsStream)) { | ||
| return Buffer.isBuffer(wavFileAsStream) | ||
| ? Promise.resolve(this.repairWavHeader(wavFileAsStream)) |
germanattanasio
approved these changes
Oct 7, 2019
watson-github-bot
pushed a commit
that referenced
this pull request
Oct 7, 2019
# [5.1.0](v5.0.0...v5.1.0) (2019-10-07) ### Features * **text-to-speech:** add method to repair wav header for a stream ([#981](#981)) ([42b0913](42b0913))
Collaborator
|
🎉 This PR is included in version 5.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Starting with v4.0.0, the data from the HTTP
synthesizemethod has been deserialized into a Stream rather than a Buffer. This introduced a problem with therepairWavHeadermethod, which takes in a Buffer and returns it synchronously.This PR adds another method,
repairWavHeaderStream. It takes in the Stream returned from the service and asynchronously reads it into memory and repairs it. The method returns a Promise that resolves with the repaired data.I've updated the documentation, which was out of date and incorrect, to instruct users on how to use the new method.
Resolves #911