在播放流在python从声音频率

在播放流在python从声音频率

本文介绍了在播放流在python从声音频率,和弦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作是吉他和弦转换为班卓琴弦的应用程序,和我建立的对象,我也想做出那种声音print语句迅速发挥我已经和弦标签/写入。

I'm working on an application that converts guitar chords to banjo chords, and as I'm building the objects, I'd also like to make sort of an audio "print statement" that quickly plays the chord I've tabbed/written.

我发现自己关于如何播放同时使用Python多个声音没有某种混合的努力,或全部的Pygame的的包容性,或写入文件很困惑。

I find myself very confused about how to play multiple sounds simultaneously using Python without some kind of mixing effort, or the inclusion of all of pygame, or writing to file.

我正在寻找的东西,可以...

What I'm looking for is something that can...


  1. 以频率 - 就像440产生A,880产生的,一个八度---作为一个迭代

  2. 播放它们而不写入磁盘,也许通过MIDI乐器。

我在地方的功能,可以从烦恼到的频率,由于仪器调音转换,并基于这些,我想说:

I have functions in place that can convert from frets to frequencies, given instrument tunings, and based on those, I'd like to say:

fretboard.play([440, 880])

和听到声音。或者,如果我可以指定时间...

and hear tones. Or if I could specify time...

fretboard.play([(440,1), (880,1)])

同时听到对方一秒钟。

to hear each simultaneously for a second.

什么是的方式,将让我的序列其中几个,如果我想创造一些原始的旋律让这种声音的简单,并希望最好的办法?

What is the best approach to get this kind of sound simply, and hopefully in a way that would let me sequence several of these if I wanted to create some primitive melodies?

此外,如果这仅仅是一个完全不同的节目,如果它看起来像我的问题是幼稚(嗨mittenchops,你需要了解更多有关渠道!),请让我知道,特别是如果你可以直接我良好的学习资源。

Additionally, if this is just a totally different kind of programming and if it seems like my question is naive ("Hey mittenchops, you need to learn more about channels!"), please let me know, especially if you can direct me to good learning resources.

推荐答案

在寻找合理的分析为Python前,我无意中发现这个网站的,里面有一堆音乐软件的链接为Python。

While looking for sound analysis for Python earlier, I stumbled on this site PythonInMusic, which has a bunch of music software links for Python.

回顾一遍,我想我会尝试使用实时输出MIDI音符的第一件事,就是所谓的。这是一个用于Python的MIDI合成器。下面是从他们的网站的一些例子code:

Looking back at that again, I think the first thing I would try to use to output midi notes in real time is called PyFluidSynth. It's a midi synth for python. Here is some example code from their site:

import time
import fluidsynth

fs = fluidsynth.Synth()
fs.start()

sfid = fs.sfload("example.sf2")
fs.program_select(0, sfid, 0, 0)

fs.noteon(0, 60, 30)
fs.noteon(0, 67, 30)
fs.noteon(0, 76, 30)

time.sleep(1.0)

fs.noteoff(0, 60)
fs.noteoff(0, 67)
fs.noteoff(0, 76)

time.sleep(1.0)

fs.delete()

希望帮助你指出正确的方向!

Hope that helps point you in the right direction!

这篇关于在播放流在python从声音频率,和弦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 01:40