Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add exportPeaks method #3009

Merged
merged 3 commits into from
Jul 13, 2023
Merged

Feat: add exportPeaks method #3009

merged 3 commits into from
Jul 13, 2023

Conversation

katspaugh
Copy link
Owner

Short description

Resolves #3007

Adds a new method – exportPeaks – to replace the old exportPCM.

Implementation details

Example usage:

wavesurfer.on('decode', () => {
  const peaks = wavesurfer.exportPeaks({
    channels: 2, // how many audio channels to export, defaults to 1
    maxLength: 2000, // how many peaks per channel
    precision: 1e3, // round to 3 digits after comma
  })
  console.log('Exported peaks', peaks)
})

@github-actions
Copy link
Contributor

🤖 OpenAI

High-level Summary

The changes involve the introduction of a new method called exportPeaks in the codebase. This method replaces the old exportPCM method and returns arrays of floats instead of a decoded audio buffer. The changes also include updates to method names and usage recommendations. The modifications affect the logic, functionality, and API of the code. A thorough review is necessary to ensure the correctness and absence of issues introduced by these changes.

File Summaries

File Summary
README.md, examples/_preview.js, src/wavesurfer.ts The diff adds a new method called exportPeaks to replace the old exportPCM method. This method retrieves decoded peaks from the audio data and returns them as an array of floats. It takes optional parameters for the number of channels, maximum length, and precision. The implementation samples the data and rounds the values based on the provided parameters. Other changes include updates to method names and usage recommendations.

Please refer to the individual file summaries for more details on the changes made.


Chat with 🤖 OpenAI Bot (@openai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @openai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Ignoring further reviews

  • Type @openai: ignore anywhere in the PR description to ignore further reviews from the bot.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 11, 2023

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 2 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@cloudflare-pages
Copy link

cloudflare-pages bot commented Jul 11, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3b5ba80
Status: ✅  Deploy successful!
Preview URL: https://269cd7d7.wavesurfer-js.pages.dev
Branch Preview URL: https://export-peaks.wavesurfer-js.pages.dev

View logs

@katspaugh katspaugh merged commit cc62ecb into main Jul 13, 2023
4 checks passed
@katspaugh katspaugh deleted the export-peaks branch July 13, 2023 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Restore exportPCM
1 participant