cancel
Showing results for 
Search instead for 
Did you mean: 

How do I edit input audio before playing it back?

murshed
Associate II
Posted on November 23, 2012 at 03:10

Hello everyone! Newbie to the forum. I've got 0 experience with boards and microcontrollers and just started learning recently, so please excuse me for any stupid questions.

I just got the STM32F4-Discovery board to learn this stuff and really need some help. So I started working with the demo projects that were available on the board's home page. One of them was an Audio play back project that records audio through the board's microphone and then plays it back continuously. The sound is saved onto a USB drive that is connected, and that's all I know. Given that this was already made code for the demo, I have no idea what was written and how it works. 

Is there a simple way for me to maybe modify the sound before it starts playing? I wanted to have some fun with it and maybe make my voice sound like an alien or a robot or something. I figured if I tried to do something fun with it, I could learn more. I'd like to post the code, but I'm not sure what to post. 

I'm using the Keil IDE (MDK-ARM I think it's called) and I got the demo files from 

http://www.st.com/internet/com/SOFTWARE_RESOURCES/SW_COMPONENT/FIRMWARE/stm32f4discovery_fw.zip

Does anyone understand what I'm saying or is it all gibberish? Thanks for any help or for any guidance in the right direction!
6 REPLIES 6
Posted on November 23, 2012 at 04:45

Well not gibberish, but probably beyond your presented skill level. Do you have any filters which you have applied to PCM wave files which perform the transform(s) you want? What kind of C applications have you written on other platforms?

Typically if you can do the transform in real-time you'd do it directly on the memory buffer prior to using DMA to send it out to the codec. Typically you'd have two buffers, one plays, the other gets filled, your window to fetch the new data, and perform the transform is the time it takes to play the preceding data. If you can't do that, then you'll need to transform all the data first, or buffer enough to keep ahead over the duration of the playback.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
murshed
Associate II
Posted on November 23, 2012 at 16:27

Hi clive1! Thank you for your response.

Well, first I don't even know the meanings of the acronyms you used there. :( Sorry!

I Googled around for a bit, but it doesn't seem like anyone has ever done what I am trying to do, so I couldn't find any base files to work off of (I'm guessing the filters you talked about are what actually distort the sound, right?). Right now, I'll settle for some really simple distortion first that I can work off of as a foundation. Do you know where I might get filters?

I've done some C/C++ programming on Linux and Windows. Nothing major, though.

Regarding the playback, I don't really care if it is immediate or real time distortion. I want to try with a delay first (because that seems simpler to me). If I don't have to worry about when the playback occurs I can focus more on the aspect of how to change the recorded sound before playing back.

My mindset is to go baby steps and get pieces and pieces to work before I try anything large. If you have any other questions for me, please feel free to ask.

Andrew Neil
Evangelist III
Posted on November 24, 2012 at 15:17

''first I don't even know the meanings of the acronyms you used there''

So there's your first topic for study, then!

;)

''My mindset is to go baby steps and get pieces and pieces to work before I try anything large''

That's a reasonable approach.

The trouble at the moment seems to be your perception of ''baby steps'' - Audio manipulation is really not  a beginners project!

Some of the foundations you need include:

* A pretty solid grasp of 'C';

* A basic understanding of electronics;

* A basic understanding of microcontrollers in general - memory, CPU, registers, typical peripherals;

Based on those foundations, some first ''baby steps'' you could be:

* Create a program to blink an LED. Sounds trivial, but covers an awful lot of stuff that you'll need: writing code; configuring stuff, using IO, using the using the tools; downloading to the target; etc.

* Practice using the debugger to see how your program runs

* Extend the program to send ''Hello, World'' out of the UART. Start by polling the status registers, then move on to interrupt-driven...

* Add receiving characters from the UART.

etc...

Keil has a booklist:

http://www.keil.com/books/

murshed
Associate II
Posted on November 25, 2012 at 00:39

Hi neil.andrew!

I've got a pretty good grasp on computer architecture (how the CPU, registers, memory and related things work), thankfully.

I've also done the simple projects with the LED's. I went so far as to make the LED's turn on and off in a circular pattern :-). Which for me is a huge accomplishment. Thanks for the link to the books, I will check them out right now.

russdx
Associate II
Posted on November 25, 2012 at 03:22

audio manipulation is definitely not a beginners project :)

Nickname12657_O
Associate III
Posted on December 04, 2012 at 09:39

Hi,

''Do you know where I might get filters?''

The ARM CMSIS DSP library embedded into the F4 standard Library offers various signal processing modules including the filtering functions.

You can enjoy playing with them :)

Cheers,

STOne-32