前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >简单的实现土味实时声音可视化

简单的实现土味实时声音可视化

作者头像
UDM Lab
发布2020-04-20 17:56:38
7570
发布2020-04-20 17:56:38
举报
文章被收录于专栏:UDM LabUDM LabUDM Lab

声音可视化顾名思义,就是把听到声音,通过视觉的方法呈现出来,人不仅可以听见声音,同时也可以看见。声音可视化最早是人们用来分析和了解声音的一种研究方式,不过近几年开始,在很多新媒体舞台上,开始兴起了一股音画联动的热潮,通过将声音和图画连接起来,给观赏者更高级的体验,然后音画联动中,最为高级的就非实时音画联动莫属了,也就是说听见什么声音,立刻的就更加声音的频谱发生视觉上的变化。

*一段声音的频谱

如何简单物理实现呢?

声音的物理定义就是由物体振动产生的声波。所以声音是由振动而来,那我们捕捉了振动,那么也就说捕捉了声音。所以我们就需要振动传感器(左1)

于是我翻箱倒柜的找出了一个之前学校里面做workshop剩下的振动传感器还有几个LED....

好,那就开始吧!

首先找到一个有振膜的音响

我用的JBLflip4,两侧还是有振膜,而且还防水。

贴上振动传感器

再贴上LED,插上arduino,烧写代码

开始播放音乐

虽然看上去很土味,最后面是音响没电了,但是放出了xiaowu的一直以来的心声...(咳咳,明天什么日子来着)

其实也是手头没啥高级货,但是稍稍展望一下,如果把贴传感器在一个livehouse或者酒吧的音响上,再把灯控接入硬件,那么不就意味着非常简单快捷的就部署好的了一个音光联动的场地了。想想也是很easy呢?虽然看上去挺low,但是实时音画互动一套下来,价格还是不菲的哟~

(桌面上又多了一个占空间的东西)

附:

代码

const int analogInPin = A0;  // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to
const int analogOutPin2 = 10;
int sensorValue = 0;        // value read from the pot
int outputValue = 0;        // value output to the PWM (analog out)
int outputValue2 = 0;
void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(9600);
}
void loop() {

  // read the analog in value:
  sensorValue = analogRead(analogInPin);
  // map it to the range of the analog out:
  outputValue = 255-map(sensorValue, 0, 1023, 0, 255);
  outputValue2 = outputValue;
  // change the analog out value:
  analogWrite(analogOutPin, outputValue);
  analogWrite(analogOutPin2, outputValue2);
  // print the results to the Serial Monitor:
  Serial.print("sensor = ");
  Serial.print(sensorValue);
  Serial.print("\t output = ");
  Serial.println(outputValue);
  // wait 2 milliseconds before the next loop for the analog-to-digital
  // converter to settle after the last reading:
  delay(2);
}

参考:

*声音的可视化处理

https://www.jianshu.com/p/9272caf7d9de

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2019-08-06,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 UDM的神仙们 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • *声音的可视化处理
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档