Audio Library Tutorial ?

Status
Not open for further replies.
You could always call AudioStream::update_all() yourself. This way you can also stop/start the processing of data, as you sample the input yourself.
If you just need the fft from the Audio library and nothing else, just call the CMSIS fft.
 
kpc: Thanks for the hint if it doesn't go by itself- I don't see any sketches doing that and not published on PJRC paraphrase - Hardware involvement needed to trigger Audio function, and Paul noted once that Stopping wasn't provided for once hooked up. 'update_all' Forum search hit two threads - your post (google finds already) and one I found one from Paul : https://forum.pjrc.com/threads/27194-Allocation-of-software-triggered-interrupts?p=59082&viewfull=1#post59082

If I asked well and Paul reads my post he should have good feedback as he pointed me that way.
 
kpc: given your new fft256 code will be getting the data.

> If I send in a 'block' full of pre-read data will the playBuffer(); replace the series of Analog reads currently used to store the data so fft256 code knows it contains 128 values? Or do I need to manually call the update with each new value?

> I'll have to send in two blocks to get the 256 samples, will your optimized code start processing those first 128 samples as they came in 'normally'?

> If I do send a block of 128 data samples the logical ordering would be [0]-[127] on int16_t boundaries.
 
Manually call with each new block of samples, not per sample.
It will start processing as the samples come in. But due to pipelining, the fft is not immediately available when all inut data is input. You should feed in more data before the fft data becomes available.
And yes, just a normal linear array if in16_t samples.
 
I've found the format for importing nodes but there are some issues.

Code:
[{"id":"i2s2","type":"AudioOutputI2S","x":2105,"y":176,"z":0,"wires":[]},{"id":"i2s1","type":"AudioInputI2S","x":133,"y":176,"z":0,"wires":[["mixer1:0"],[]]},{"id":"i2s2","type":"AudioOutputI2S","x":489,"y":158,"z":0,"wires":[]},{"id":"mixer1","type":"AudioMixer4","x":311,"y":181,"z":0,"wires":[["i2s2:0"]]}]

If you drag this string to the tool or hit CTRL+SHIFT+i the nodes will come up but there seems to be a problem with naming, as mentioned by Paul here. They are given random ones and cannot be renamed.

Changing the end of that string to
Code:
:[["i2s2:0"]]},0]
doesn't turn off random naming as the import nodes function should but if you change
Code:
if (createNewIds) {
//node.z = RED.view.getWorkspace();
//node.id = getID();
node.id = n.id;
}
the imported names are correct.

It shouldn't be too hard to add this string to the output of the save function after the arduino stuff but the naming thing needs to be fixed too.
 
Last edited:
Hi all,
is there any way to play audio data from within teensy without using const.

I mean can we play non-const dynamically created audio data.

or can we play dynamically created audio data without using external serial flash.
 
is there any way to play audio data from within teensy without using const.

I mean can we play non-const dynamically created audio data.

Maybe you're asking about the memory player object? The one used in the Part 2-3 "Playing Samples" part of the tutorial.

Sure, you can pass it an array which isn't const. That code expects the first 4 bytes to tell the format and length of the data, so make sure you look into that important detail and get those first 4 bytes correct. Then it'll just play whatever is in your buffer. The only issue is you'll probably be limited to about 50K for the buffer, since Teensy has only 64K RAM.

or can we play dynamically created audio data without using external serial flash.

Well, maybe. You can use the queue object to put your own data into the audio library. Or you can just edit the library to add your own code.

The library already has some synthesis and effect objects, so maybe those can help. Hard to say without any idea of what you're trying to accomplish.
 
Hi paul,

Actually, what I'm trying to achieve is I'm generating a dynamic audio data from SDK which is about >65537B and after passing that raw data to wav2sketch it becomes 13355B buffer. This buffer I have to keep as const to play and actual raw data memory is out of RAM that's why I'm using external flash but to reduce the cost I don't want to use an external flash and looking for any provision.

Also, paul can you redesign the teensy 3.2 as per our requirement which includes little add-on. After that, I can order in bulk.
 
I don't understand your question.

Part of it seems like you want to put a sound inside Teensy's program memory, which won't fit, but these small sizes you mention can easily fit (well, unless you're written a *lot* of code to fill up the internal flash memory).

Part of your question seems like you wish to use RAM instead of flash. You certainly can. Just create a similar array without "const", and fill it with data. Remember the first int (4 bytes) must be the format+size.

I do understand the second part. No, we don't do customized Teensy boards.
 
Status
Not open for further replies.
Back
Top