I'm a beginner programmer in C++ trying to develop a program that requires me to know the frequencies of the music that is being played through the earphones. It has to be digital, by analyzing the music file itself.
So for example, I would know that at time t, frequencies a b c d e are played.
Is it possible to do this?
Related
I am trying to build an app on iOS in Swift, SwiftUi and using ARKit and RealityKit. I want the app to:
detect a soccer ball
detect a soccer goal
track the trajectory of the ball when shot at goal
detect when/if the ball hits/passes the goal
To detect the ball and goal using ARKit is working fine. However, to keep tracking the ball when in movement is very unreliable. And when its moving fast, ARKit fails to detect the ball at all.
I have tried to implement Apple Visions VNDetectTrajectoriesRequest using the following tutorial,https://developer.apple.com/documentation/vision/identifying_trajectories_in_video, which works as long as I am NOT using ARKit.
DetectTrajectory needs a CMSampleBuffer, and ARKit only returns a PixelBuffer and I wasn't able to solve this issue and get it to work smoothly (I tried converting the pixelbuffer to CMSampleBuffer, but that resulted in the app being SO slow it was useless in realtime). And even if I get this to work it wouldn't solve my issue regarding detecting when the soccer hits the goal.. For that I believe that using depth/ARkit is necessary..
Does anyone have a solution for tracking A FAST MOVING OBJECT USING ARKIT?
I am close to giving up, but I have found this guy on Youtube that is detecting a balls trajectory using ARKit, https://www.youtube.com/watch?v=B4yfp1UmM5s. I have written to him but received no reply this far. Have been trying to solve this for over a week but I can't find a solution. Please internet, help me!
I think that such a mission is impossible for iOS device in 2022.
Firstly, let's assume the average speed of a soccer ball is 12 m/s, and ARKit and Vision track it at 60 fps. Any object moving at 12 m/s is difficult to qualitatively track at that frame rate, it's obvious. Even MoCap systems use at least 120 fps for tracking of much slower movements.
Secondly, in 5 seconds the ball approximately covers a distance of 60 meters. This is a fairly large distance (for detection/recognition) at which such a small object as a soccer ball will be unrecognizable, especially since it also spins during flight.
I'm trying to scan Beacon device in objective c. I'm having multiple brand beacon (estimote,gimbal and etc). I wont to go to use them api. I want unique for objective c to detect the beacon device.
You can see a tutorial for ranging beacons in Objective C here:
http://mentormate.com/blog/beacon-ranging-ios/
So I'm working on a project where I need to analyze audio with an Arduino.
Basically it's a light organ, and I need to do some Beat Detection
in order to match the LEDs to shift color based on the tempo of the song.
I have successfully managed to get the FFT and FHT library from Open Music Labs
to work with my arduino, but the lower end of the spectrum seems to be very
narrow if terms of resolution.
I have tried to find information of how to broaden the resolution in that area,
but with no success.
How can I accomplish this?
The wife asked for a device to make the xmas lights 'rock' with the best of music. I am going to use an Arduino micro-controller to control relays hooked up to the lights, sending down 6 signals from C# winforms to turn them off and on. I want to use NAduio to separate the amplitude and rhythm to send the six signals. For a specific range of hertz like an equalizer with six bars for the six signals, then the timing from the rhythm. I have seen the WPF demo, and the waveform seems like the answer. I want to know how to get those values real time while the song is playing.
I'm thinking ...
1. Create a simple mp3 player and load all my songs.
2. Start the songs playing.
3. Sample the current dynamics of the song and put that into an integer that I can send to which channel on the Arduino micro-controller via usb.
I'm not sure how to capture real time the current sound information and give integer values for that moment. I can read the e.MaxSampleValues[0] values real time while the song is playing, but I want to be able to distinguish what frequency range is active at that moment.
Any help or direction would be appreciated for this interesting project.
Thank you
Sounds like a fun signal processing project.
Using the NAudio.Wave.WasapiLoopbackCapture object you can get the audio data being produced from the sound card on the local computer. This lets you skip the 'create an MP3 player' step, although at the cost of a slight delay between sound and lights. To get better synchronization you can do the MP3 decoding and pre-calculate the beat patterns and output states during playback. This will let you adjust the delay between sending the outputs and playing the audio block those outputs were generated from, getting near perfect synchronization between lights and music.
Once you have the samples, the next step is to use an FFT to find the frequency components. Fortunately NAudio includes a class to help with this: NAudio.Dsp.FastFourierTransform. (Thank you Mark!) Take the output of the FFT() function and sum out the frequency ranges you want for each controlled light.
The next step is Beat Detection. There's an interesting article on this here. The main difference is that instead of doing energy detection on a stream of sample blocks you'll be using the data from your spectral analysis stage to feed the beat detection algorithm. Those ranges you summed become inputs into individual beat detection processors, giving you one output for each frequency range you defined. You might want to add individual scaling/threshold factors for each frequency group, with some sort of on-screen controls to adjust these for best effect.
At the end of the process you will have a stream of sample blocks, each with a set of output flags. Push the flags out to your Arduino and queue the samples to play, with a delay on either of those operations to achieve your synchronization.
I am currently creating an application which signals readiness to other devices using a high frequency sound.
(transmitter): A device will produce a short burst of sound of around 20khz.
(receiver): Another device will be listening for a sound at this frequency at a small distance from the transmitter(10m approx) The device recieves audio data from a microphone
The background noise will be fairly loud, varying from around 0 - 10khz(about human speech range), and would be produced by a small crowd of people.
I need the receiving device to be able to detect the 20khz sound, separated from the noise,
and know the time at which it was received.
Any help with an appropriate algorithm, a library, or even better, code in C or
Objc to detect this high frequency sound would be greatly appreciated.
20 kHz may be pushing it, as (a) most sound cards have low pass (anti aliassing) filters at 18 - 20 kHz and (b) most speakers and microphones tend to have a poor response at 20 kHz. You might want to consider say 15 kHz ?
The actual detection part should be easy - just implement a narrow band pass filter at the tone frequency, rectify the output and low pass filter (e.g. 10 Hz).
You may want to look into FFT (Fast Fourier Transform). This algorithm will allow you to analyse a waveform and convert it to the frequency spectrum for further analysis.
If this is for Mac OS or iOS, I'd start looking into Core Audio's Audio Units.
1 Here's Apple's Core Audio Overview.
2 Some AudioUnits for Mac OS
3 Or for iOS AudioUnit Hosting
A sound with that high frequency will not travel at all with the iphone speaker.