Only react to low frequencies

// SpectrumAnalyzer.as
package {
import flash.display.*;
import flash.media.*;
import flash.net.*;
import flash.utils.ByteArray;
import flash.events.*;
class SpectrumAnalyzer extends Sprite {
// Settings
private var lineThickness:Number = 2;
private var lineColor:Number = 0x993300;
private var circleSize:Number = 75;
private var scaleOnBeat:Number = 1.1; // 120%
private var reactToBeat:Number = 30;
private var music:Sound = new Sound;
private var ba:ByteArray = new ByteArray();
private var __width:uint;
private var __height:uint;
function SpectrumAnalyzer(mp3:String, _width:uint,
_height:uint) {
__width = _width;
__height = _height;
x = __width/2;
y = __height/2
music.load(new URLRequest(mp3));
music.play(0, 999);
addEventListener(Event.ENTER_FRAME, processSound);
private function processSound(ev:Event):void {
SoundMixer.computeSpectrum(ba, true, 0);
graphics.clear();
graphics.moveTo(0, -circleSize);
graphics.lineStyle(lineThickness, lineColor);
var vol:Number = 0;
for (var i:uint = 0; i <512; i++) {
var lev:Number = ba.readFloat();
vol += lev;
var a:uint = i;
var j:Number = i;
if (i <256) a += 256;
if (i == 256) graphics.moveTo(0, -circleSize);
graphics.lineTo(-Math.sin(i/256*Math.PI)*circleSize*(lev+1),
Math.cos(a/256*Math.PI)*circleSize*(lev+1));
if (vol> reactToBeat) {
scaleX = scaleY = scaleOnBeat;
else {
scaleX = scaleY = 1;
I am thinking that
private var
reactToBeat:Number = 30;is completely dependant on song.mp3.
If the song was processed at a different volume level, then you may
need to lower the value. (e.g. 30 would be lowered to 19)
I ultimately want to have this work with any song, because I
will be making a playlist and have song.mp3 replaced with the var.
To start, however, I would at least like to get this spectrum
to only respond to low frequencies.
I think for start, I would need to change:
SoundMixer.computeSpectrum(ba,
true, 0);to
SoundMixer.computeSpectrum(ba,
false, 0);so that it reads it as a frenquency spectrum
rather than a complete wav file (according to the as3 ref doc)
With that, the first 256 values should be low freqs and 257
to 512 would be high freqs.
How can I utilize that to only scaleOnBeat to the low
frequencies?
Also, I didn't know if it was best to use a select case for a
certain range of values.
Thanks

After thinking about it a little bit, if the computeSpectrum
was set to false, that would give me the left channel of 0-256, but
so would the class of "leftpeak"...so is there a way to use that?
Also, vol is currently dependant on the 512 total values, so
perhaps setting computeSpectrum to false, and then changing all 512
references to 256 and all 256 values to 128. That would cut it down
to only work with the left channel...right?
I am also trying to get away from the fixed value of 30 for
reactOnBeat, because what if I want to change the volume?
Yes, I could always increase the vol by the difference
reactOnBeat is from 30, but isn't there a dB averager or some other
class that would tell me more information about the sound
file?

Similar Messages

  • Low frequency Voltage measurement

    Hi,
    I am using PCI 6025E to control load bank and to measure voltage, current and frequency of a generator.
    While current and frequency measurement  is not a problem, voltage measurement is toublesome.
    Since on test bench already there are few PCI boards and huge number of sensors, I do not want to add NI 9205 or any other additional boards and clutter the area (other people are also working there).
    The problem with voltage measurement is that out of three generators two run from 400 RPM to 1600 RPM i.e.. somewhat 15-55 Hz.
    I had two solutions for this:
    1, Putting a step down transformer (230 Vac / 5 Vac) and then measure the voltage. But when testing at somthing like 15 Hz I have to deal with magnetic saturation with commercially available transformer. I do not want to take pain to go on built my own transformer.
    2, Using high precision voltage Divider. The problem is that what should be the galvanic isolation? Isolation transformer, but then again low frequency problem.
    Hence could someone suggest me since there is a bit confusion in my head.
    Thanks.
    Solved!
    Go to Solution.

    If you have a sine generator (15Hz migth be hard for the soundcard ) you can do a calibration of your transformer.
    (If only the voltage amplitude is of interest , use a isolated DMM as reference and run your generators)
    Or you buy a isolation voltage sense amplifier. (weidmueller, phoenix, wago, ...)
    Greetings from Germany
    Henrik
    LV since v3.1
    “ground” is a convenient fantasy
    '˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

  • How do I get the line-in to record low frequencies?

    The iPhone with GarageBand is potentially one of the most powerful tools for mobile recording ever.  Unfortunately there are several tragic yet avoidable drawbacks that reduce it to nothing more than a mere toy.  1. You can't use the camera usb adapter to bring in loss-less digital stereo input.  2. Even if you could, you can't split the stereo into 2 seperate mono tracks.  And to take the cake...  3. You can't do much recording with the 3.5 jack's line-in because you get ABSOLUTELY NO LOWS!  This is due to the iPhones roll-off low frequency limiter filter, which i'm told since ios6 can possibly be disabled, though it's not in the Settings and i have yet to find an app that will do it in the background while running Garageband.  Sure, the Garageband app could do that, but then it would be a powerful incalculably valuable tool in the hands of everyone.  No lows means no drums, no bass, and vocals that sound like...well...like they were recorded via telephone.  Yes, it's painfully clear you recorded that demo on a phone, because when you play it back in your home or car it sounds like your listening to someone play it for you on the other end of a phone call.  There is no adjustment to compensate for the absence of low frequencies.  SOMEONE PLEASE TELL ME I AM WRONG and that you have a work-around or know of something I've missed.  How do you get lows into Garageband???

    Thanks for the info.  I am not wanting flat stereo nor digital input from the 3.5.  Only wanting flat mono.  But before I go the apogee route (which is a $150-200 solution, not to mention a solution that will add more devices to the connection and thus more opportunities for noise), I will probably just resort to purchasing an ipad (can get a mini for $299) .  My mixer has usb out, and I can go straight into the ipad digitally with the usb camera kit, albeit I still can't split 1 stereo channel into 2 mono channels.  But I digress:  my entire purpose for this post is that i would like to stay as mobile as possible by using the iphone, but with all the darn limitations imposed by no one other than Apple, what could be an easy way to record has been nullified.  What's frustrating is that all the components are there and I have them, all the hardware is more than capable; but in both cases (the 3.5 mono or the usb stereo) there is a software feature (or lack thereof) blocking me.
    Again if anyone knows of an app that will disable the software low-cut, please respond...

  • Best method for collecting low frequency data

    Hello everyone,
    I'm looking for suggestions on the best way to collect relatively low frequency data (about 1 Hz). I know there are a few different ways to do so in labview such as the DAQ assistant or making DAQ mx and making your own virtual channel. Also there are an abundence of different settings to choose from. I'm using an NI 9215 DAQ card and am collecting voltages. I would be interested to here any opinions on a method for doing so and maybe the settings that they would use.
    The reason I'm asking is because I'm just using the DAQ assistant but I'm really not sure if that's what I want to be using. I feel like there is a better way.
    Thank you all!

    winterfresh11 wrote:
    Is this different from triggering? Because this particular DAQ card can't be triggered.
    There is a big difference between triggering and sample clock.  The trigger tells the DAQ to start acquiring data.  The sample clock tells the DAQ when to take a sample.  You trigger once per acquisition.  The sample clock just keeps on going until the acquisition is complete (either aborted or desired number of samples is acquired).
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Frequency response at low frequency

    I'm working on a bandpass filter, and I'd like to get the frequency response showing that the frequencies outside the lower and higher cutoff frequencies are being cut off. However, the correct plot is shown only when my cutoff frequencies are high (roughly from 1000-8000 hertz). When I use low cutoff frequences(roughly 4-5 hertz), the plot is incorrect. So how can I get the frequency response to my low cutoff frequencies? Thanks.
    P.S. In the code, some parts are irrelevent. In the front panel, the only relevent part is the frequency response plot at the lower right corner, and the specs above it; in the block diagram, only the upper half(with IIR and FRF) is relevent. Thanks.
    Attachments:
    BME_Pressure_Sensor_V1.00.vi ‏591 KB

    Hi Manson
    There is a bug in your diagram since you connected the number of samples where you should have connected the sampling frequency.
    The sampling frequency is related to the pace at which you take the measurement.
    Usually, Fs = 1 / dT
    where Fs is the sampling frequency and dT is the time interval.
    It should work better.
    In any case, to have a better resolution in the low frequency range of your spectrum computations, you have to increase the number of points of your data because there exist the following relationship between dF (space between 2 points in you spectrum), dT, and N (number of data points) :
    dF = 1 / (2 x dT x N)
    Doc-Doc
    Doc-Doc
    http://www.machinevision.ch
    http://visionindustrielle.ch
    Please take time to rate this answer

  • Low frequency measuremen​t from Parallel Port

    Hi there...
    I need to calculate the "on" and "off" time and duty cycle in pulse form from a parallel port. By making the circuit in 5 or 0 V, I just simply put it in my parallel port. The problem comes when I need to measure a very very low frequency. In this case, I want to measure the duty cycle from my operated refrigerator. I need to know when the thermostat goes "on" and when it comes to "off". In my experience, the thermostat will be "on" in about 5-10 minutes and "off" in about 20-30 minutes. So, the pulse might be take for a long periode each.
    I've tried with Timing and Transition Measurement wizard or even by using Pulse Measurement.vi which is included in Waveform Measurement category. It only works for 2 Hz and . If I try to set it with 1 Hz or below, it comes the message :
    "Error -20308 occurred at Timing and Transition Measurements -> Untitled 1
    :4"  (waveform index 0 of 1)
    Possible reason(s):
    Analysis:  The waveform did not cross the mid reference level enough times to perform this measurement. Check the signal length, reference levels, and ref level units."
    Could someone help me please ?
    Regards,
    Ricki

    here is a quick shot to give you an idea
    Greetings from Germany
    Henrik
    LV since v3.1
    “ground” is a convenient fantasy
    '˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'
    Attachments:
    port logger.vi ‏22 KB

  • Low frequency buzz on Headphone out p

    when I hook up my stereo input to my sound card Headphone out port I get a low frequency buzz noise. Is there any way to eliminate it's

    dbruchez wrote:
    when I hook up my stereo input to my sound card Headphone out port I get a low frequency buzz noise. Is there any way to eliminate it's
    Use the Headphone-out port for headphones only (use line-out #-3 for feeding external amplifier(s)).
    jutapa

  • Very Low Frequency Converter

    Hello
    There are numerous devices that transmit audio via very low frequency (VLF). I quote:
    "Carrier current devices are a combination of technologies. They are a cross between
    wired microphones and subcarrier transmitters. The only difference is that the signal
    is not transmitted via radio waves, but rather through a wire pair. A person cannot
    accidentally intercept or detect a carrier current signal by simply tapping into a wire
    like with wired microphones. A carrier current device works by picking up room audio
    through a microphone. The signal from the microphone is then modulated by a low
    frequency circuit, which produces a carrier current signal at approximately 100–200
    kHz. A common example of carrier current devices are the newer wireless telephones,
    intercoms, or baby monitor type devices that plug into the electric socket and use the
    pre-existing wiring rather than having wiring run all over the house. A special circuit,
    which can demodulate the low frequency signal, is used as the receiver.
    Only a sophisticated receiver with a low frequency probe can detect this sort of device."
    Can Audition modulate the signal back into an audible range?

    At 100kHz, yes it's true - you'd need an audio interface running faster than twice the modulating frequency to demodulate all of the sidebands correctly. Not it's not absolutely impossible to do this, but it's a very expensive way of doing what hardware does very cheaply! To do this in Audition, you'd need initially to get the modulated carrier in (so if it was 100kHz, that would require an interface that runs at 200kHz to satisfy the Nyquist requirement) and all of the currently available crop appear to stop at 192k), and then run the signal through an envelope detector to capture the sideband signals. Problem is that Audition doesn't have the envelope detector, so you're stuffed anyway, even if you used 100Hz. 100Hz would give you all sorts of problems on top of this, because you'd have to use FM and then you'd have to deal with all of the reflected sidebands.
    So to state this baldly, Audition is an audio editing program, not a radio receiver!
    If you want to read more about this (and I should warn you that this gets complicated) then here are a few links:
    Demodulation - Wikipedia, the free encyclopedia
    audio-rate frequency modulation
    http://www.secretmango.com/jimb/Whitepapers/radio/radio.html

  • Is it possible to detect low frequency signals with a high sampling rate?

    Hello everyone,
    I'm having an issue detecting low frequency signals with a high sampling rate.  Shouldn't I be able to detect the frequencies as long as the sampling rate is at least 2 times the highest frequency I will measure?  The frequency range I am measuring is 5-25 Hz, and I use Extract Single Tone.vi to measure the frequency.  The sampling setting I am using is 2 samples at 10 kHz.  Is there a method I can use to make this work?
    Attached is the vi.
    Attachments:
    frequencytest.vi ‏21 KB

    You are sampling at 10Ks/S, but only taking two samples. What do you expect to see? If your signals are binary (On or Off) you would only see either an on or an off, or if the rise/fall time was fast and you were Extremely lucky, one of each. If you want to see a waveform you have to sample for at least the period of a waveform. So you should take samples for at least 0.2 seconds to capture an entire waveform at 5Hz, ideally longer.   Think of looking at a tide change at a dock. If you want to see the entire tide change you will probably have to measure repeatedly over 24 hours, not just run out on the dock, measure the height twice and leave. That wouldn't tell you anything other than at that precise moment the tide height was X, but not that it was at high tide, low tide, in between, etc.
    I type too slowly, I see that a more technical answer has been given, so mine will be the philosophical one!
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Very low frequency caused by sample frequency in FFT analog input?

    I'm measuring a very low frequency on my analog input, this frequency is in connection with the sample frequency of the Analog Input. At a sample frequency of 1000Hz I see a frequency of 0,05Hz in my FFT, at a sample frequency of 500Hz I see a frequency of 0,02Hz.
    Attached is a screenshot of an example how I see this very low frequency.
    My hardware: NI USB 6008 --> measuring on AI-0 (in this example the input is unwired). But in my real measurement I see the same FFT + signals I want to see (about 2 Hz).
    In my real measurement I windowed the FFT (1-3Hz) so I see only the FFT I want to see. But I suspect that my complete signal moves along with this very low frequency of 0,05Hz. I saw this in my measerement.
    What did I do wrong?
    Attachments:
    screenshot.JPG ‏66 KB

    First, do you live in Europe? If so, that 50Hz could be power-line pick up.
    Antialias filtering must be done in hardware before the DAQ. Because of the way aliasing works if you have sampled the signal it's already too late, you're hosed and no amount of digital filtering can remove the aliased signal. In terms of filter specifications, the filter cutoff needs to be at twice the highest frequency you are interested in seeing. For example, if you are looking for signals in the 2- to 5-Hz range, your antialiasing filter should cutoff at around 10Hz.
    Obviously good signal management is also needed: shielding, appropriate signal termination, proper lead dress and spacing from known noise sources, etc...
    Mike...
    PS: There were no attachments to your last post.
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Satellite A215-S7444 - Name of low frequency amplifier

    I need to know the name of low frequency aplifier in a main board of notebook Toshiba Satelite A215-S7444. I have problem with my loudspeakers because they are beeping. And problem is with loudspeakers amplifier.
    Please tell me the name of this integrated circuit.

    Hi
    I think nobody here can answer this question because its only an user to user forum and I never saw anyone from Toshiba here. I think this question can only be answered from authorized people.
    I would recommend contacting an authorized service provider. The technicians could answer this question and help you to get a new spare part.
    Good luck!

  • Low-Frequency measurements using counter/timer

    I am trying to measure speed, and am using the FP-502 counter timer module to count the pulses from my sensor. The field point example that uses a fixed width gate pulse will not work for my appliation because I need a gate pulse so big that it updates way to slow.
    Does anybody have any sugestions on how to measure a low frequency signal using a counter/timer?
    Thanks
    Dan

    Hello guys
    Thanks for all your sugestions I have the final results. I got it to work but I would like to add some comments for anybody who is trying to attempt this.
    Triggeing on the gate is a must for low frequency measurements. I used the divide by sugestion however using a factor of 3 only gets you about 60 Hz after that you can't sample fast enough. My application required me to measure from 0 to 150 Hz. I added a "gear shifter" routine where the terminal count was set to 3 on frequencies lower then 45 Hz and 15 for frequiencies greater than 45 Hz. Using a terminal count of 15 for all measurements made the udate rate on really low frequencies way to slow i.e. .5 seconds for 20Hz (check the math on this).
    I a
    lso needed to cascade the counters. At low frequencies the count went higher than 6550. Using the previos channel function of the fieldpoint module enable me to get 32 bit worth of terminal count data.
    Finally I needed to add a timeout condition for 0 Hz. If there are no pulses coming from the senser the program displays the last value read. That won't be 0. So I added a time out routine that if I didn't see a pule in a certian amout of time, output 0 and reset the gate count.
    Thank you for you help you relly saved me. I hope my comments made sense.
    Dan

  • 27" iMac screen low frequency humming + moving too freely on the base

    Got a new 27 incher on tuesday after fedex lost the first one That's a different story.
    The problems
    1. The huge iMac moves a tad bit too freely on its base and when i try to tilt it to an angle, it doesn't stay at that angle it trys to go tilt back down ... maybe its gravity.. i don't know...
    2. Very very low frequency humming noise from the iMac top left corner... its out when it goes to sleep. not the normal HDD/fan noise. I have a fan app, its not the fan... but its really annoying when working on it ...
    i've seen a couple of posts about this. i'm taking this 27 incher to the store tomorrow... lets see how the geniuses deal with it. i hope they acknowledge this problem. does anyone else with the 27" have this problem?

    Took it to the apple store, some genuises looked at it, confirmed it and sent me another one

  • Text in fillable text form gets cut off and appears only in the lower half of the text form?

    I'm trying to create a text-fillable PDF form. However, when I add a text form, the text I test in it gets cut off and appears only in the lower half of the text form by default (see 2nd photo below). How do I correct this and make the text take up ALL the space in the form like the 1st photo?

    Have you set the text field properties options to multiline? Is so, please attach a screen shot of that dialog box so we can see how it is set.

  • Why is the bar menu of the pdf file, (often) only showing the lower half?

    why is the bar menu of the pdf file, (often) only showing the lower half?

    Pat,
    I attach  a few recent examples
    any thought ?
    sincerely,
    marcel

Maybe you are looking for

  • Doesn't recognize FCP7 the thundebolt

    hi, i have a big issue with FCP 7... in my new iMac its doesnt recognize the thunderbolt adapter to Firewire 800 in Log and Capture... i have a dvd player that its RCA output, then i have a RCA to DV (Firewire400), then i have a FW400 to FW800 adapte

  • Jsp database connectivity

    To maintain the database connectivity, we are trying to keep the database 'Connection' in the session object (putValue, getValue). Do anybody see any problem with there? Any comment appreciated. Thanks.

  • Problem syncing, please help!

    Hallo, my iPhone 3GS 16 GB, FW 3.1.3 have problem syncing photo's whit iTunes last version. For first i reinstall the iPhone software from iTunes. Any time, when i connect iPhone to iTunes it come this error: can not sync iPhone "iPhone my name". Not

  • Changing InfoSet of a Query

    Hi, Is it possible to change the InfoSet of a Query? How? Here is my problem: I have copied a standard InfoSet in order to make some changes. Furthermore, I have copied a query that uses the above mentioned standard InfoSet, but I cannot assign my co

  • Wrong Business Area is given in WBS

    Dear All, I have created one project in that at project level in organization tab i have given Business Area B100 which is correct Business Area. When I created WBS Element in Assignment Tab i have entered Wrong Business Area which is B008.These WBS