简体   繁体   English

关于如何构建LED系统的任何技巧都会点亮音乐?

[英]Any tips for how to build a LED system thet will light up to music?

So basically I would like somehow that given an audio file as input (most likely mp3 or I can use some audio engine that will handle other types too) from my computer to control some LED lights so they will be something like an oscilloscope, like the one in winamp. 因此,基本上,我想以某种方式从计算机上给一个音频文件作为输入(很可能是mp3或我也可以使用一些音频引擎,也可以处理其他类型的声音)来控制某些LED灯,因此它们就像示波器一样。一个在Winamp中。

What would I need to be able to do this? 我需要什么才能做到这一点? I'm interested in building thing up all by myself, coding, hardware, etc.. 我对自己,编码,硬件等构建所有东西感兴趣。

I'm going with C++ on Windows. 我要在Windows上使用C ++。

Here is a possible approach (high level description): 这是一种可能的方法(高级描述):

You could have a simple micro controller (MCU) in a basic circuit with a number of LEDs connected. 您可以在基本电路中连接多个LED的情况下使用一个简单的微控制器(MCU)。 LED connection circuitry should be easy to find. LED连接电路应该很容易找到。 Most MCU manufacturers will also give a sample test/LED flash circuit in the product datasheet, along with a sample program. 大多数MCU制造商还将在产品数据表中提供样品测试/ LED闪光灯电路以及样品程序。

The MCU could interface with your PC via a parallel port (I have used an ATmega8 for which the input pins were level compatible with the parallel port pins). MCU可以通过并行端口与PC相连(我使用的ATmega8的输入引脚与并行端口的引脚电平兼容)。 It could also interface using a more sophisticated/higher level approach - via serial/usb port using a UART to serial or UART to USB module with your MCU. 它还可以使用更高级/更高级别的方法进行接口-通过串行/ USB端口,使用UART到串行或UART到USB模块与您的MCU。 You could then output different values via the parallel/serial/usb from a PC application to the MCU, and have the MCU code flash the LEDs as required. 然后,您可以通过并行/串行/ usb从PC应用程序向MCU输出不同的值,并使MCU代码根据需要使LED闪烁。 There are some articles around that power LEDs from the parallel port itself though this is not recommended. 尽管不建议使用并行端口本身为LED供电的一些文章。 I have used inpout32.dll for accessing the parallel port registers directly. 我已经使用inpout32.dll直接访问并行端口寄存器。 The .NET framework provides a SerialPort class you could use if not using the parallel port approach. .NET框架提供了一个SerialPort类,您可以在不使用并行端口方法的情况下使用。

As for the music side of things, I've never dealt with audio files in software. 至于音乐方面,我从未在软件中处理过音频文件。 There should be some libraries around and you could perhaps scale amplitude/frequency variations over time to a numerical scale displayable on the LEDs you have. 周围应该有一些库,您也许可以将幅度/频率随时间变化的比例缩放到可以在您的LED上显示的数字比例。 Since this implies you want a basic audio player I am sure you could find some info on the audio side of things for PC apps. 由于这意味着您需要一个基本的音频播放器,我相信您可以在PC应用程序的音频方面找到一些信息。

EDIT: 编辑:

With my answer I assumed this is for a personal project and proposed an approach that would be easy on the budget - a few $ at the local electronics store should get you everything. 用我的答案,我认为这是针对个人项目的,并提出了一种在预算上容易实现的方法-在当地的电子商店花几美元就能买到一切。 This is a good start, but as the other answers suggest there are likely better solutions that scale. 这是一个很好的开始,但是正如其他答案所暗示的那样,可能会有更好的解决方案可以扩展。 Starting with a kit - pre-made MCU board might be easier but more expensive! 从套件开始-预制的MCU板可能更容易,但更昂贵! It would likely be worth the cost if it is for a professional project though! 不过,如果是用于专业项目,那将是值得的!

Good luck! 祝好运!

It sounds like a good case to use an Arduino developer kit. 听起来像是使用Arduino开发人员套件的好案例。 That's basically a small external device that can connect to your USB port and drive external electronics. 这基本上是一个小型外部设备,可以连接到USB端口并驱动外部电子设备。

On the software side, you'd need to tap the audio stream, pass it through band-pass filters, and threshold it. 在软件方面,您需要点击音频流,将其通过带通滤波器,然后对其进行阈值处理。 If the signal in the frequency band exceeds the threshold, you light up the LED by sending a command to your Arduino. 如果频带中的信号超过阈值,则可以通过向Arduino发送命令来点亮LED。

So I guess you want to build up something like a LED wall. 因此,我想您想构建类似LED墙的东西。 The difficulty lies within mapping a video signal (which you can have pre-built by a winamp plug/in or a custom solution) to the LED Wall pixels. 困难在于将视频信号(您可以通过winamp插件/自定义解决方案预先构建)映射到LED Wall像素。 I happen to know a little bit about commercial solutions used in the event business. 我碰巧对事件业务中使用的商业解决方案有所了解。 Usually you build a LED Matrix by bunching together a set of LED Bars or LED Tiles. 通常,您是通过将一组LED条或LED砖捆在一起来构建LED矩阵的。 These devices are controlled via the DMX 512 Protocol. 这些设备通过DMX 512协议控制。 DMX 512 has 512 channels with a resolution of 8 bits per channel. DMX 512具有512个通道,每个通道的分辨率为8位。 A single LED pixel is controlled via 3 channels RGB. 一个LED像素通过3个RGB通道控制。

A LED Lightning control software such as Madrix needs to map the signal of an image generator onto LED Pixels and again mapp that to DMX signals. 诸如Madrix之类的LED雷电控制软件需要将图像生成器的信号映射到LED像素,然后再次将其映射到DMX信号。 DMX isn't hard to implement, it's a very simple and very robust protocol, can be wired with cheap cables and there are also a lot of commercial solutions available in terms of microcontrollers, DMX/USB adapters etc. DMX并不难实现,它是一个非常简单且非常强大的协议,可以使用廉价的电缆进行布线,并且在微控制器,DMX / USB适配器等方面也有很多商业解决方案可用。

Use the parallel port to drive leds directly. 使用并行端口直接驱动LED。 The parallel port is really easy to work with if you have simple needs. 如果您有简单的需求,那么并行端口真的很容易使用。 Take look a this resource for wiring eksamples . 看看这个用于连接eksamples的资源

Back when I was at Roskilde University we turned the entire Computer Science building in to a giant VU-meter for the anual campus wide party. 当时,我在罗斯基勒大学Roskilde University)时,我们将整个计算机科学大楼变成了一个巨大的VU表,用于一年一度的校园范围的聚会。

Basically an old pc was used to sample soundlevel as a value between 0-255. 基本上是使用一台旧PC来采样声级,其值介于0-255之间。 That value vas directly output to the "classic" pc parallel port. 该值可以直接输出到“经典” pc并行端口。

The parallel port drove a series of 220V relays conected to green and red lightbulbs that were places in different CS offices. 并行端口驱动了一系列220V继电器,分别连接到位于不同CS办公室的绿色和红色灯泡。

I looked great! 我看起来很棒! The pièce de résistance was the Japaneese turist who shoved up out of nowhere taking pictures of the building... piècederésistance是一位日本的家庭教师,他无所不在​​地猛冲下来,为建筑物拍照。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM