element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Cirrus Logic - RPI 2 FFT on streaming audio
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 14 replies
  • Answers 2 answers
  • Subscribers 676 subscribers
  • Views 1725 views
  • Users 0 members are here
  • wolfson
  • logic
  • raspberry
  • python
  • audio
  • pi
  • cirrus
  • 2
  • raspberry_pi
  • fft
  • raspeberry_pi_accessories
  • card
Related

Cirrus Logic - RPI 2 FFT on streaming audio

Former Member
Former Member over 10 years ago

Hi everyone,

My current project is to run constant FFT on an audio stream and output the data to a 3D LED Array. Google 3D LED cubes if you don't know what they are. My cube is more of a rectangular prism, 24x8x8=1536 LED's. I am new to the world of PI and have found the support for the cirrus logic card to be vague, if it wasn't for ppl like ragnar.jensen I'd probably still be stuck (thanks for all the information you've shared).

 

Anyway, currently I am recording 1 second of audio after a 1 second delay. So it takes 2 seconds to get the data / audio.

 

I then perform the FFT on 16384 samples. But this is only 1/3 of the 44000 raw audio samples recorded in the 1 second interval. I then group the frequencies into bands and then scale the amplitudes of those bands into a single byte which represents the bands power. The result of each FFT is 24 bytes, one byte for each band. All this takes 0.1 second.@@@@@

 

It then takes 0.004 seconds to send that data to my PIC, which I had to bit bang through the GPIO's since I couldn't get I2C or UART working.

 

The LED array takes the data and displays the 24x8 bits on the front row, when it receives the next group of data the front row shifts back one row. The LED array displays 3 dimensions, time (each group of data), frequencies and amplitude.

 

Question:

In the arecord command, I would like to erase the delay or change it to 0 seconds and change the minimum record length so I can stream the data at a faster rate to the LED array. Does anybody know how????

 

Answering this would result in a real time graphics equalizer on live audio and a more fluent transition between groups of data (more like a wave travelling away from you).

 

If anybody has an idea on how to achieve this please reply, or share your thoughts.

  • Sign in to reply
  • Cancel
Parents
  • shabaz
    0 shabaz over 10 years ago

    Hi Daniel,

     

    Looks like a fun project : )

    I'm not knowledgeable in Python but you might be pushing the limits of it to be honest. It could be better to code this in C, because there is a C API to the ALSA framework, which

    should allow you to read bytes from the audio device (hw:0 or whatever). Maybe there is an API for Python too, I just don't know it.

    I've not used the C API, but it is described on the ALSA site. Then you should be able to read exactly what you need (e.g. a fraction of a second instead of having to read a whole seconds-worth),

    and using C would also allow you to maybe do your FFT faster (just a guess).

    If you really want to speed the calculation up, then there is a feature called 'NEON' on some of the ARM processors (not on the older RPI models, but is available on the RPI 2 and BeagleBone Black)

    but it takes some learning to use. Fortunately you don't need to learn it, there are libraries out there that are already coded to take advantage of NEON.

    Also, you may wish to migrate to the BeagleBone Black since there is a Music Tech design challenge for it out there, if you (say) want to convert your device into a tool for creating and visualising

    sounds : ) Just an idea! Less than two days left to apply for it though.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago in reply to shabaz

    Thanks for your reply shabaz, I appreciate your comments. I found this on a different forum but I don't know how to use it.

    http://stackoverflow.com/questions/29839082/capture-record-audio-in-linux-for-milliseconds

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Former Member
    0 Former Member over 10 years ago in reply to shabaz

    Thanks for your reply shabaz, I appreciate your comments. I found this on a different forum but I don't know how to use it.

    http://stackoverflow.com/questions/29839082/capture-record-audio-in-linux-for-milliseconds

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube