如何在Node.js服务器端减小音频文件的音调? [英] How to decrease pitch of audio file in nodejs server side?

查看:88
本文介绍了如何在Node.js服务器端减小音频文件的音调?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的服务器上存储了一个.MP3文件,我想将其修改为音调稍低一点.我知道可以通过增加音频的长度来实现,但是,我不知道节点中的任何库都可以做到这一点.

I have a .MP3 file stored on my server, and I'd like to modify it to be a bit lower in pitch. I know this can be achieved by increasing the length of the audio, however, I don't know of any libraries in node that can do this.

我已经尝试过使用节点Web音频api和soundbank-pitch-shift,但是前者似乎没有音高转换(AFAIK)的功能,而后者似乎是针对客户端设计的

I've tried using the node web audio api, and soundbank-pitch-shift, but the former doesn't seem to have the capabilities of pitch shifting (AFAIK), and the latter seems designed toward client

我只需要节点范围内的解决方案-这意味着没有外部程序等,并且它也需要自动化,因此我无法手动进行音调转换.

I need the solution within the realm of node ONLY- that means no external programs, etc., and it needs to be automated as well, so I can't manually pitch shift.

一个理想的解决方案是将文件/文件路径作为输入,然后创建(或覆盖)另一个MP3文件但音高偏移x的函数,但实际上,任何产生以下内容的解决方案:音调比原始音调低.

An ideal solution would be a function that takes a file/filepath as an input, and then creates (or overwrites) another MP3 file but with the pitch shifted by x amount, but really, any solution that produces something with a lower pitch than the original, works.

我在这里完全迷路了.请帮忙.

I'm totally lost here. Please help.

推荐答案

我设法从 Ollie M的答案得到了帮助./a>和节点层.

我以前不知道采样率会影响速度,但是多亏了奥利(Ollie),这个问题突然变得更加简单了.

I hadn't known previously that sample rate could affect the speed, but thanks to Ollie, suddenly this problem became a lot more simple.

使用node-lame,我所做的只是取一个示例(mp32wav.js),并使其更改为使我更改format对象的参数sampleRate,使其低于基数.采样率,在我的应用程序中始终为静态24,000.我还可以使它动态化,因为node-lame可以在format对象中获取输入文件的参数.

Using node-lame, all I did was take one of the examples (mp32wav.js), and make it so that I change the parameter sampleRate of the format object, so that it is lower than the base sample rate, which in my application was always a static 24,000. I could also make it dynamic since node-lame can grab the parameters of the input file in the format object.

奥利(Ollie)完美地描述了这种方法的缺点

Ollie, however perfectly describes the drawback with this method

在任何一种情况下,此技术的缺点是声音会 也可以以较低的速度和较低的音调播放.如果它 是声音减慢并降低的问题 音调的结果,那么您还必须使用 时间拉伸算法来修复播放速度.

The drawback to this technique in either case is that the sound will also play back at a slower speed, as well as at a lower pitch. If it is a problem that the sound has slowed down as well as lowered in pitch as a result of your processing, then you will also have to use a timestretching algorithm to fix the playback speed.

我现在没有特别需要执行时间延长算法的(感谢,因为这是另一种蠕虫病毒),因为我可以更改文件的初始速度,但是其他人可能会更改将来.

I don't have a particular need to implement a time stretching algorithm at the moment (thankfully, because that's a whole other can of worms), since I have the ability to change the initial speed of the file, but others may in the future.

这篇关于如何在Node.js服务器端减小音频文件的音调?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆