10319浏览
楼主: 驴友花雕

[项目] 【花雕动手做】看见声音,基于Arduino系列音乐可视器(7)

[复制链接]

驴友花雕  中级技神
 楼主|

发表于 2021-11-14 18:55:53


  【花雕动手做】有趣好玩的音乐可视化系列小项目(07)---大方格频谱灯
   项目之五:红白绿三色24段三级联频谱大方格灯(FFT算法)

   实验开源代码


  1. /*
  2.   【花雕动手做】有趣好玩的音乐可视化系列小项目(07)---大方格频谱灯
  3.    项目之五:红白绿三色24段三级联频谱大方格灯(FFT算法)
  4. */
  5. #include <arduinoFFT.h>
  6. #include <MD_MAX72xx.h>
  7. #include <SPI.h>
  8. MD_MAX72XX disp = MD_MAX72XX(MD_MAX72XX::FC16_HW, 10, 3);
  9. arduinoFFT FFT = arduinoFFT();
  10. double realComponent[64];
  11. double imagComponent[64];
  12. int spectralHeight[] = {0b00000000, 0b10000000, 0b11000000,
  13.                         0b11100000, 0b11110000, 0b11111000,
  14.                         0b11111100, 0b11111110, 0b11111111
  15.                        };
  16. int index, c, value;
  17. void setup()
  18. {
  19.   disp.begin();
  20.   Serial.begin(9600);
  21. }
  22. void loop()
  23. {
  24.   int sensitivity = map(analogRead(A0), 0, 1023, 50, 100);
  25.   Serial.println (analogRead(A0));
  26.   for (int i = 0; i < 64; i++)
  27.   {
  28.     realComponent[i] = analogRead(A0) / sensitivity;
  29.     imagComponent[i] = 0;
  30.   }
  31.   FFT.Windowing(realComponent, 64, FFT_WIN_TYP_HAMMING, FFT_FORWARD);
  32.   FFT.Compute(realComponent, imagComponent, 64, FFT_FORWARD);
  33.   FFT.ComplexToMagnitude(realComponent, imagComponent, 64);
  34.   for (int i = 0; i < 32; i++)
  35.   {
  36.     realComponent[i] = constrain(realComponent[i], 0, 80);
  37.     realComponent[i] = map(realComponent[i], 0, 80, 0, 8);
  38.     index = realComponent[i];
  39.     value = spectralHeight[index];
  40.     c = 31 - i;
  41.     disp.setColumn(c, value);
  42.   }
  43. }
复制代码


回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-11-14 19:09:18

  【花雕动手做】有趣好玩的音乐可视化系列小项目(07)---大方格频谱灯
   项目之五:红白绿三色24段三级联频谱大方格灯(FFT算法)

   实验视频剪辑

https://v.youku.com/v_show/id_XNTgyMDAwMjE5Mg==.html?spm=a2hcb.playlsit.page.1


回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-11-14 19:11:38

   实验场景动态图


【花雕动手做】看见声音,基于Arduino系列音乐可视器(7)图1
回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-11-22 16:31:51


【花雕动手做】有趣好玩的音乐可视化系列小项目
   项目之四:FFT算法的双点阵屏的动态频谱仪

   实验视频剪辑

https://v.youku.com/v_show/id_XN ... hcb.playlsit.page.1



回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2021-11-22 16:32:34

   实验场景动态图


【花雕动手做】看见声音,基于Arduino系列音乐可视器(7)图1
回复

使用道具 举报

驴友花雕  中级技神
 楼主|

发表于 2022-10-5 09:52:05

【花雕动手做】看见声音,基于Arduino系列音乐可视器(1)---LED节奏灯
https://mc.dfrobot.com.cn/thread-311167-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(2)---OLED频谱灯
https://mc.dfrobot.com.cn/thread-311174-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(3)---RGB律动灯
https://mc.dfrobot.com.cn/thread-311183-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(4)---WS2812条灯
https://mc.dfrobot.com.cn/thread-311190-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(5)---WS2812柱跳灯
https://mc.dfrobot.com.cn/thread-311192-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(6)---点阵频谱灯
https://mc.dfrobot.com.cn/thread-311201-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(7)---大方格频谱灯
https://mc.dfrobot.com.cn/thread-311364-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(8)---四位32段点阵屏
https://mc.dfrobot.com.cn/thread-311490-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(9)---X Music Spectrum
https://mc.dfrobot.com.cn/thread-311627-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(10)---WS2812硬板屏
https://mc.dfrobot.com.cn/thread-311641-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(11)---WS2812幻彩灯带
https://mc.dfrobot.com.cn/thread-313648-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(12)---米管快速节奏灯
https://mc.dfrobot.com.cn/thread-313708-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(13)---有机棒立柱灯
https://mc.dfrobot.com.cn/thread-313723-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(14)---水杯水瓶灯
https://mc.dfrobot.com.cn/thread-313803-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(15)--横排LED方管灯
https://mc.dfrobot.com.cn/thread-313811-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(16)--热干胶棒棒灯
https://mc.dfrobot.com.cn/thread-313844-1-1.html
【花雕动手做】有趣好玩音乐可视化系列(17)--光导纤维灯
https://mc.dfrobot.com.cn/thread-313867-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(18)--LED平面板灯
https://mc.dfrobot.com.cn/thread-313951-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(19)--通体光纤灯
https://mc.dfrobot.com.cn/thread-313962-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(20)--首饰盒镜子灯
https://mc.dfrobot.com.cn/thread-313969-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(21)--CD 光盘灯
https://mc.dfrobot.com.cn/thread-313984-1-1.html
【花雕动手做】看见声音,基于Arduino系列音乐可视器(22)--LED无限魔方
https://mc.dfrobot.com.cn/thread-313994-1-1.html
【花雕动手做】有趣好玩的音乐可视化(23)--3合1闪点光纤
https://mc.dfrobot.com.cn/thread-314168-1-1.html
【花雕动手做】有趣好玩的音乐可视化(24)--无限LED镜子灯
https://mc.dfrobot.com.cn/thread-314180-1-1.html
【花雕动手做】有趣好玩音乐可视化(25)--水龙卷旋涡灯
https://mc.dfrobot.com.cn/thread-314231-1-1.html
【花雕动手做】有趣好玩音乐可视化系列(26)--LED 超立方体
https://mc.dfrobot.com.cn/thread-314244-1-1.html
【花雕动手做】有趣好玩的音乐可视化(27)--磁搅LED水旋灯
https://mc.dfrobot.com.cn/thread-314273-1-1.html


回复

使用道具 举报

12
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail