Add effects and add classify music genres function.#7
Open
Aroganta wants to merge 4 commits intoantvis:masterfrom
Open
Add effects and add classify music genres function.#7Aroganta wants to merge 4 commits intoantvis:masterfrom
Aroganta wants to merge 4 commits intoantvis:masterfrom
Conversation
hustcc
reviewed
May 16, 2025
src/Audio.ts
Outdated
| } | ||
| } | ||
|
|
||
| async classifyGenre(files: File) { |
Member
There was a problem hiding this comment.
这个 api 的入参是 files 嘛?是不是可以直接用 data 传入的。
hustcc
reviewed
May 16, 2025
| if (files[0]) { | ||
| const wavFile = await this.convertAudio(files[0]); | ||
| this.worker.postMessage(wavFile); | ||
| } |
Member
There was a problem hiding this comment.
API 设计如下:
import { Audio } from '@antv/a8';
const audio = new Audio();
audio.data(a);
const c = await audio.classifyGenre();不使用 callback 的形式,伪代码这么实现:
async classifyGenre() {
this.worker = new Worker(new URL('./classifyWorker.ts', import.meta.url), { type: 'module' });
return new Promise((resolve, reject) => {
this.worker.onmessage = (event) => {
const { classifyOutput, classifyTime, label } = event.data;
// this.classifyOutput = classifyOutput;
// this.onclassify(label, classifyTime);
resolve({ label, classifyTime, classifyOutput });
};
this.worker.onerror = (e) => {
reject(e);
}
const wavFile = await this.convertAudio(files[0]);
this.worker.postMessage(wavFile);
})
}
hustcc
reviewed
May 16, 2025
| self.onmessage = async function (event) { | ||
| const result = await classifyGenre(event.data); | ||
| self.postMessage(result); | ||
| }; No newline at end of file |
Member
|
@Aroganta 单元测试报错,看看日志需要解决一下。 |
Member
|
lock 文件删除,并放到 git ignore 中。 |
Delete the lock file and put it in git ignore. |
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.

🤔 This is a
🔗 Related issue link
💡 Background and solution
📝 Changelog
☑️ Self Check before Merge