- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有这个脚本是用 p5.js 构建的,它检查音频文件的振幅数据并在图像中再现它,您可以在此处查看代码片段 http://www.vtxfactory.org/p5/empty-example/
这是js:
var song, analyzer;
function preload() {
img = loadImage("http://www.vtxfactory.org/images/vtxlogovnl.png");
song = loadSound("http://www.vtxfactory.org/sounds/masterflash.mp3");
}
function setup() {
createCanvas(250, 250);
song.loop();
// create a new Amplitude analyzer
analyzer = new p5.Amplitude();
// Patch the input to an volume analyzer
analyzer.setInput(song);
}
function draw() {
background(0, 0, 0, 0)
// Get the average (root mean square) amplitude
var rms = analyzer.getLevel();
fill(0, 0, 0, 20);
stroke(255, 255, 255);
image(img, width/3, height/3, 10+rms*200, 10+rms*200);
}
如何将动画的轴更改为图像的中间?
此外,当图像放大并再次变为正常尺寸时,它会沿途放一些帧,有什么方法可以改善吗?我认为这可能与被格式化为透明的背景有关,但我想将此脚本放在图像上。
我这里有一些关于我试图实现的代码的引用 https://p5js.org/reference/#/p5/image
谢谢。
最佳答案
我没有经常使用 p5.js,但我很确定您可以使用“translate(x,y)”函数从图像的中间进行转换。平移将对应于宽度 (x) 的一半和高度 (y) 的一半。稍后我可能会尝试为您编写代码。如果您自己解决了,请告诉我。
关于Javascript振幅图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43879741/
我正在处理电话的原始电话声音和录音,我想在 .Net C# 项目中将它们标准化为特定的音量级别。 声音是原始音频字节的集合(单声道无 header 16 位签名 PCM 音频 16000Hz)。 音频
我正在尝试编写一个应监视任何传入声音的iPhone应用程序。我不确定如何获取iPhone的麦克风录制的声音并检测其频率。如果相同频率的声音重复几次,那么我需要采取一些措施。任何人都可以在这里帮助我。我
我正在尝试录制来自 MIC 的声音并绘制实时图表。我能够记录和绘制图表。问题是使用下面的代码记录的值不准确,例如……下图是我在完全没有声音时得到的。我看过使用 fft 的示例,但我不确定这对我的情况是
我是一名优秀的程序员,十分优秀!