Maya API frame rate - maya-api

Is there a way to query the frame rate during playback?
I'm writing a simple HUD node and I'd like to include the frame rate, similar to the default maya one found in >> Display/Heads Up Display/Frame Rate.

Not sure about the api but there's a Mel version
playbackOptions -q -fps
Edit: just found this
http://download.autodesk.com/us/maya/2011help/API/class_m_anim_control.html
Try using playbackSpeed?

Related

STM32 StdPeriph library USART example

I downloaded Stdperiph library and i want to make USART example run on STM32F4 - Discovery. I chose STM32F40_41xxx workplace, added stm32f324x7i.c file and compiled without any errors.
Issue is that I cant receive expected message in my terminal (using Hercules), also when I check RxBuffer it is receiving some bytes but not that I sent.
I checked baudrate, wordlength, parity several times. Do you have any idea what could I do wrong?
USART conf:
USART_InitStructure.USART_BaudRate = 9600;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_2;
USART_InitStructure.USART_Parity = USART_Parity_Odd;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
STM_EVAL_COMInit(COM1, &USART_InitStructure);
Thank you.
First of all if you want to use hihg level abstraction libraries stop using obsolete SPL and start using HAL. Install the Cube. Generate the code - import into your favorite IDE and compile. Should work.
Your code does not show anything as USART clock may be net enabled as well as GPIOs. GPIOs may be configured wrong way. You system and peripheral clock may have wrong frequency. There are many more potential problems.

How to play a seamless loop from an AudioSprite in AS3, without SAMPLE_DATA

I created a batch of sounds assembled with this tool:
AudioSprite
https://github.com/tonistiigi/audiosprite
The output is generally used for JS libraries, such as Howler, Zynga Jukebox, or SoundJS - but I wanted to see if it's possible to implement in AS3.
I started creating a Sound player that can load, parse and play the sounds based on the JSON and MP3 file this tool generates.
So far so good! ... except for loops.
Now, the big question is - is there a way to play a Sound-loop seamlessly given that all music & sounds coexist in the same MP3 file, and it has a start & end range to play and stop it?
Example of how the sounds are placed in the file:
mygame_sounds.mp3 = [BUZZ + LASER + BOING ... + TRACKLOOP]
I'm looking for a solution that does not involve using the SAMPLE_DATA Event (given it eats up a lot of CPU usage). If there's no way around it, please explain why.
So far I've had mild success using flash.utils.Timer objects triggered after a given AudioSprite's duration, but it's not consistent.
To stop / dispose of a non-looping sound, I rely on a Master Timer (running at very short intervals) and that seems to "cut" the sample appropriately. But I already tried using this Master Timer to play a looped-sound over and over - same latency issues.
Is there any method to predict / measure how much latency is to be expected by the time the sound completes one pass?
In SoundJS we could not find a way to allow smooth looping of audio sprites in AS3 and went with a timer. We found Web Audio was the only api that allowed smooth looping, and therefore recommended staying away from audiosprites for sounds that needed to loop smoothly if any other plugin might be used.
Hope that helps.
The reason of why you can't get smooth loops of a track retrieved from a larger audio file is that you cannot check sound position faster than once per SWF frame, which length depends on stage.frameRate and total processing time of your application and is generally varied. So, if your looping sounds lasts say 5.123 seconds (I don't care how many samples, just that its length does not make a full number of frames regardless of stage.frameRate), your sound will attempt to play for either 5.125 seconds (205 frames at 40 fps, IMO best bet for this particular sound), 5.133 seconds (154 frames at 30 fps) or some weird number of frames if the SWF would experience lag. The excess milliseconds cannot be totally controlled by any means due to AS3/Flash engine optimization. So, consider not using audio sprites and shift into audio packs (several audio files in an SWF, or one sound in an MP3).
Although I'm still working on the perfect solution, this is the best I could come up with:
Load the JSON file / ByteArray.
Parse the JSON file to obtain each sprites' ID, start and end times.
Load the MP3 file / ByteArray (requires loadCompressedDataFromByteArray()) into a master Sound object.
Once loaded, check if any sprites are marked as "loops".
Create separate Sound objects for the above loops, and extract the portion from the master Sound via loadPCMFromByteArray() with some "magic-numbers" (details below).
To play a one-shot sound, call the master Sound's play(sprite.start * 1000) (depending on the format, usually the JSON's start values are in seconds, needs to be in milliseconds).
To play a seamless-loop sound, call the individual Sound object's (created in step #5) play(0, 9999) method.
I won't go too deep in details on how to stop the sounds (SoundChannel.stop(), bam!), but I'll explain the "magic-numbers" mentioned above. See this snippet:
var goldenOffset:UInt = (64 << 5);
var goldenDuration:UInt = (64 << 2);
var sampleRate:UInt = 44100;
for (id in loops) {
var sprite:AudioSpriteItem = _mapSprites.get(id);
var loop:Sound = _mapLoops.get(id);
var sampleBytes = new ByteArray();
var samplesTotal:UInt = cast(sprite.duration * sampleRate + goldenDuration);
var samplesStart:UInt = cast(sprite.start * sampleRate + goldenOffset);
_sound.extract(sampleBytes, samplesTotal, samplesStart);
sampleBytes.position = 0;
loop.loadPCMFromByteArray(sampleBytes, samplesTotal, "float", true);
}
Quite honestly, these magic goldenOffset and goldenDuration values were just found via Trial-and-Error. I could get close to a seamless loop without them by just calculating the start and duration with the sampleRate (assuming 44100 by default), but each endings had a bit of a hiccup to it.
After several adjustments, those couple "64 left bit-shifted" values made the loops sound smoother.
I posted the Haxe project on github (compiled SWC also available in /bin folder) if you wish to try it / read through the code.
FLAudioSprite
Github page: https://github.com/bigp/FLAudioSprite
SWF Demo (Download): bit.ly/FLAudioSpriteSWFDemo

how to capture multiple images using cameraCaptureSequence for Windows Phone 8?

I am trying to using the CameraCaptureSequence API to capture a sequence of frames of a scene. Currently, I am trying to modify the code available on MSDN for the basic lens sample to accomplish this.
here is what I have done to capture 3 frames. But the app crashes upon start:
public async Task PrepareCameraCaptureSequence()
{
this.cameraCaptureSequence = this.PhotoCaptureDevice.CreateCaptureSequence(3);
this.cameraCaptureSequence.FrameAcquired += cameraCaptureSequence_FrameAcquired;
await this.PhotoCaptureDevice.PrepareCaptureSequenceAsync(this.cameraCaptureSequence);
}
Most of the online resources I saw do the above for just one frame, i.e., using "this.PhotoCaptureDevice.CreateCaptureSequence(1)". Can someone please help me out with capturing multiple frames using CameraCaptureSequence?
Thanks
Ekta
So, I have found something on this MSDN article.
Apparently, the Windows.Phone.Media.Capture.CameraCaptureSequence class currently supports only single frame capture. Hence, while working with the current release of Windows 8 APIs, you must specify a single frame when you call the CreateCaptureSequence method.
That's too bad, I am guessing I will have to work with the frames of a video stream. If anyone comes across another answer to this question, please do share!

AR Drone 2.0, Gstreamer, C++ RTMP Server (streaming without SDK)

This question is the follow up question to this thread: AR Drone 2 and ffserver + ffmpeg streaming
We are trying to get a stream from our AR Drone through a Debian server and into a flash application.
The big picture looks like this:
AR Drone --> Gstreamer --> CRTMPServer --> Flash Application
We are using the PaveParse plugin for Gstreamer found in this thread: https://projects.ardrone.org/boards/1/topics/show/4282
As seen in the thread the AR Drone is using PaVE, Parrot Video Ecapsulation, which is unrecognizable by most players like VLC. The PaVeParse plugin removes these.
We have used different pipelines and they all yield the same error.
Sample pipeline:
GST_DEBUG=3 gst-launch-0.10 tcpclientsrc host=192.168.1.1 port=5555 ! paveparse ! queue ! ffdec_h264 ! queue ! x264enc ! queue ! flvmux ! queue ! rtmpsink localtion='rtmp://0.0.0.0/live/drone --gst-plugin-path=.
The PaVEParse plugin needs to be located at the gst-plugin-path for it to work.
A sample error output from Gstreamer located in the ffdec_h264 element can be found at: http://pastebin.com/atK55QTn
The same thing will happen if the decoding is taking place in the player/dumper e.g. VLC, FFplay, RTMPDUMP.
The problem comes down to missing headers: PPS Reference is non-existent. We know that the PaVEParse plugin removes PaVE headers but we suspect that when these are removed there are no H264 headers for the decoder/player to identify the frame by.
Is it possible to "restore" these H264 headers either from scratch or by transforming the PaVE headers?
Can you please share a sample of the traffic between gstreamer and crtmpserver?
You can always use the LiveFLV support built inside crtmpserver. Here are more details:
Re-Stream a MPEG2 TS PAL Stream with crtmpserver

how to get "billboard hot 100" chart listing via billboard API

I have been trying for hours on how to exactly get the "billboard hot 100" chart (The results matching to http://www.billboard.com/#/charts/hot-100)...
but have had no success till yet.
I have gone through the API documentation at http://developer.billboard.com/docs thoroughly...
And from what i understand from here -> developer.billboard.com/docs/read/The_Chart_Service/Resources/Chart_Spec
"billboard hot 100" has id "379"
But when i use it in chart item call, like this -> api.billboard.com/apisvc/chart/v1/list?id=379&format=json&api_key=bvk4re5h37dzvx87h7rf5dqz
i just get an error :(
if anyone has experience using the api please help me...
Thanks
Update 2020-01-21
The RSS feed is now dead. You can view a historical snapshot of the feed at archive.org https://web.archive.org/web/2020*/http://www.billboard.com/rss/charts/hot-100.
However you will likely need to use web scraping to get the data now.
NodeJS scraper: https://github.com/darthbatman/billboard-top-100
The Billboard API seems to dead now with no sign of anyone maintaining it.
However they do provide a rss feed for the Hot 100 see http://www.billboard.com/rss/charts/hot-100. You might be able to get the information you need from that.
If you happen to know Python, check out billboard.py.
From the linked page:
pip install billboard.py
>>> import billboard
>>> chart = billboard.ChartData('hot-100')
>>> song = chart[0] # Get no. 1 song on chart
>>> song.title
u'One Dance'
>>> song.artist
u'Drake Featuring WizKid & Kyla'
>>> song.weeks # Number of weeks on chart
15
>>> song.spotifyID
u'11hqMWwX7sF3sOGdtijofF'
According to an entry on ProgrammableWeb, the Billboard API was officially terminated in May 2013.
As Matthew Moisen suggested above, try the Python module billboard.py. I just tried it a few minutes ago. While it's limited in fields (and maybe charts), it does provide basic data for at least the top-100 chart.
Here is the github repo: https://github.com/guoguo12/billboard-charts