简体   繁体   English

Xamarin.Forms上的音乐文件节奏和强度检测

[英]Music file rhythm and intensity detection on Xamarin.Forms

Our product is a dimmable light bulb, connected via Bluetooth and App, App can adjust the brightness (color) of the bulb, the brightness value is 1-100. 我们的产品是可调光灯泡,通过蓝牙和App连接,App可以调节灯泡的亮度(颜色),亮度值为1-100。

Now the App wants to add a function that automatically dims according to music (Mp3). 现在,应用程序想要添加一个根据音乐自动调暗的功能(Mp3)。 While playing music, it automatically adjusts the brightness of the light according to the rhythm and sound size of the music. 在播放音乐时,它会根据音乐的节奏和声音大小自动调节灯光的亮度。

The music has been played using https://github.com/adrianstevens/Xamarin-Plugins/tree/master/SimpleAudioPlayer 音乐已经使用https://github.com/adrianstevens/Xamarin-Plugins/tree/master/SimpleAudioPlayer播放

My question is, when playing music (Mp3), how do I convert the rhythm and intensity of the music to a 1-100 number and send it as a brightness value to the light bulb? 我的问题是,在播放音乐(Mp3)时,如何将音乐的节奏和强度转换为1-100数字并将其作为亮度值发送到灯泡?

A lot of C# (Windows-based) music analysis examples were found online, but Xamarin was not found. 很多基于C#(基于Windows的)音乐分析示例都是在网上找到的,但是没有找到Xamarin。

Thank you for your help! 谢谢您的帮助!

Sounds cool! 听起来很酷! There are two parts to your problem, 你的问题分为两部分,

  • Enhancing the audio player - Since you have implemented the Audio Player already, all you need to do is add a Value changed event to the slider, as shown in this official Microsoft Example , so that changing the value of the slider will now also communicate with your device/bulb 增强音频播放器 - 由于您已经实现了音频播放器,您需要做的就是将一个Value更改事件添加到滑块, 如此官方Microsoft示例所示 ,以便更改滑块的值现在也将与你的设备/灯泡

  • Communicating with your device - This will depend on how your device accepts values over bluetooth. 与您的设备通信 - 这取决于您的设备如何通过蓝牙接受值。 We wouldn't be able to know for sure what serial values your bulb is accepting, but you have to send serial data values through bluetooth. 我们无法确定您的灯泡接受的串行值,但您必须通过蓝牙发送串行数据值。 You can use this to help simplify with this part. 您可以使用来帮助简化此部分。

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

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