javascript - 带“录音机”的鼓机
问题描述
我在 freecodecamp 上的鼓机项目完成了一半,刚刚遇到了这里有人制作的具有录音和播放功能的完成作品。但是,此功能仅播放以不变的速度捕获的音符。如果我以各种节奏单击键盘,则不会捕获此模式。例如,如果我在两秒内点击“Q”键盘 10 次,然后在录制模式下以每秒 1 次点击的速度点击“W”键盘两次,则不会记录此点击与时间模式。有谁知道如何实现这一目标?
playSound(e) {
//console.log('In playSound power = ' + this.props.power);
if (this.props.power) {
const sound = document.getElementById(this.props.keyTrigger);
sound.currentTime = 0;
sound.play();
const button = document.getElementById(this.props.id);
button.style.backgroundColor = "#00c7ec";
setTimeout(() => { button.style.backgroundColor = '#012839'; }, 500);
this.props.updateDisplay(this.props.id, 500);
if (this.props.){
// record key in array
recordArray.push(this.props.keyCode);
}
}
}
解决方案
推荐阅读
- android-studio - 如何仅在recyclerview中将动画添加到最后添加的项目
- javascript - 如何在不从 HTML 重新加载到烧瓶的情况下获取输入表单?
- ray - 在 OptiX 7 中计算命中点的表面法线
- python-3.x - pandas read_csv() 错误,即 FileNotFoundError: [Errno 2] 没有这样的文件或目录:'19.csv'
- google-chrome - 尽管需要许可,但 Chrome 扩展程序被拒绝
- amazon-web-services - 具有限制访问 s3 存储桶中的文件夹的策略的角色被忽略
- pine-script - PineScript / 转换为 V4
- python - 如何在列表中使用“\\”字符进行拆分
- r - 如何从r中的出生日期和时间戳计算年龄?
- json - F# 和 Web API Json 用于在 DataFrame 中进行分析