@borfo and @fcd72 it would be possible to save samples with a kit. I'm just not sure about loading times (this would not be possible during playback) and the wear of the intetrnal flash memory... if you write/erase the flash all the time when a new kit is loaded you'll reach the 10.000 erase cycles quite fast I assume. :-/
I think that sample playback from SD-Card should be theoretically possible... I say this because we use the exact same STM32F407 controller at work. I coded a video player for LED-Installations using it, and it reads uncompressed video-data from SD-Card with a Rate of 48Mbit/s no problem. Of course it might look different when doing audio processing at the same time, but the required bitrate for samples would not be nearly as high.
I am using the SD-Interface of the STM32, also with elm chan's Fatfs, and DMA. Is the card connectet to the STM's SD-interface in your hardware, or is it only connected to SPI? I saw that you are using the AVR at the moment for reading the Card, but that it is also connected to the STM. Maybe using DMA would do the trick? I am thinking of something like prefetching one sector for each sample for timing reasons to RAM, and loading the rest from card via DMA while a sample is playing. Starting the DMA is quite fast, and the rest happens in the Background.
Maybe I'll have a try implementing it when I have some time to read through your code...
The SD card is connected to the SPI bus at the moment. this reduces the transfer speed :-( I tried loading data from the SD card while the playback was running (kits and patterns), but was getting audio dropouts due to the SD card loading time. Although I did not use the DMA yet.
I've been thinking about using the DMA, because I assume the dropouts are mainly due to the time spent loading the next 512 byte sector from the card, which blocks the audio calculation while it is running.
I'm quite a newb when it comes to DMA though. I've coded some one way audio streaming DMAs but thats about it. At the moment I have to wrap my head around if/how this is done with a 2 way protocol like SPI. Do I just use 2 DMA streams? One with the control messages for the SD card and one reading back the answers of the card from the SPI interface?
Getting the SD card to work while audio is playing would be really great! At the moment the bottleneck is the communication between AVR and STM.
okay.. put some more thought into this. I have to see if I have enough RAM left to run FatFS not in tiny mode. Then each file would get its own 512byte sector buffer and I could add another sector buffer that prefetches sd card data in the background... thatwould be 6144bytes instead of 512...
Seeing how such a significant feature has been added on to the device so quickly, is it safe to assume that the LXR will be able to make me breakfast and drive me to work within a month or two?
This thread really illustrates why open hardware is great. No way you'd ever see Korg making a change like this to one of their products - you're lucky to see major bugs get fixed... If you want new features, you have to spend more money to buy an identical piece of hardware with slightly improved firmware on it and throw the old one in the garbage.
Do you want a sample for every step and voice? Thats can be as much as 122 Samples.... you are awary that initially the LXR was meant as a Synthesizer, not a Sampler ?
Do you want a sample for every step and voice? Thats can be as much as 122 Samples.... you are awary that initially the LXR was meant as a Synthesizer, not a Sampler ?
:ar!
@FCD yes it is a bit sacrilegious to be going down the sample-sequencer path when there are already the synths on board the LXR .... but *maybe* this might really just be a tweak to open up functionality that is already technically possible within the LXR framework without conceding any performance.
Just trying to catch Julian when he is in coding-ninja mode, before the next 1000 LXR orders come in for Xmas and snow him under!
You just init all your tasks with start_task(<c_function>, <stack_size>);
Then call start_tasking();
And when you are waiting for something, like e.g. the dma to finish, you just do switch_task(); in the delay loop. Every task needs to call switch_task(); regularly, and the other tasks get called from there.
Another option would be to rewrite the FS-routines (or your music code) as an interrupt statemachine, but that simple tasker does a good job for me.
I tried last night some old LinnDrum samples and triggered my LXR via a Korg PadKontrol - scaring. I guess i do not longer need to look for a MPC...yikes !
hmmmmm... I modified the FatFS to work with the DMA. I went with double buffering the sectors. The fatFs is always working on the prefetched sectors while the DMA fetches the next sector in the background.
Streaming from SD card seems to work, but I still get audio dropouts and timing jitter on the sequencer while the sample is playing. probably the fat access takes too long as well :-/ and this is with 1 sample channel playing, not 6
maybe one could try to put the samples directly to the SD card, without a filesystem in between.
Successfully uploaded 17 samples for total size of 492KB!?
so roughly, that would be 25kb per sample. how much "samples" (lenght) would that be in wavelab respectivly the MPC ? ......i`m sampling into my mpc. would be cool to know ......possibly i get something up too.....working/sampling with a MPC
Works great! Loaded some LM-2 samples and it works really nice! There are some small clicks at certain Coarse/fine tune settings but you can fiddle around them.
Great additional feature already - thanks!
Morphing these sounds gets you leftfield fast! ;-)
Easier loading of samples from the SD card (or playback from the card) would be nice - but it's already great as it is.
I have a question about sample in lxr. I noticed that a need to set the frequency coarse at 0 to hear the orginale tone/pitch of the sound i've imported. Please tell me if i'm wrong. I would be nice if the coarse around 63 could set the original pitch of the sample. This way, we could high pitch (coarse 64 to 127) or low pitch (coarse 0 to 62) the samples... instead of only high pitch the sound in the actual configuration.
i think the course value for original pitch is determined by the sample rate your samples are in. not sure right now, which value, but my course is higher than 0 for original pitch so that i can use it to pitch up and down.
Comments
@borfo and @fcd72 it would be possible to save samples with a kit. I'm just not sure about loading times (this would not be possible during playback) and the wear of the intetrnal flash memory... if you write/erase the flash all the time when a new kit is loaded you'll reach the 10.000 erase cycles quite fast I assume. :-/
Hi Everyone!
I'm new here, and just got my LXR yesterday.
I think that sample playback from SD-Card should be theoretically possible... I say this because we use the exact same STM32F407 controller at work. I coded a video player for LED-Installations using it, and it reads uncompressed video-data from SD-Card with a Rate of 48Mbit/s no problem. Of course it might look different when doing audio processing at the same time, but the required bitrate for samples would not be nearly as high.
I am using the SD-Interface of the STM32, also with elm chan's Fatfs, and DMA. Is the card connectet to the STM's SD-interface in your hardware, or is it only connected to SPI? I saw that you are using the AVR at the moment for reading the Card, but that it is also connected to the STM. Maybe using DMA would do the trick? I am thinking of something like prefetching one sector for each sample for timing reasons to RAM, and loading the rest from card via DMA while a sample is playing. Starting the DMA is quite fast, and the rest happens in the Background.
Maybe I'll have a try implementing it when I have some time to read through your code...
Great project by the way, keep up the good work!
I tried loading data from the SD card while the playback was running (kits and patterns), but was getting audio dropouts due to the SD card loading time. Although I did not use the DMA yet.
I've been thinking about using the DMA, because I assume the dropouts are mainly due to the time spent loading the next 512 byte sector from the card, which blocks the audio calculation while it is running.
I'm quite a newb when it comes to DMA though. I've coded some one way audio streaming DMAs but thats about it. At the moment I have to wrap my head around if/how this is done with a 2 way protocol like SPI.
Do I just use 2 DMA streams? One with the control messages for the SD card and one reading back the answers of the card from the SPI interface?
Getting the SD card to work while audio is playing would be really great! At the moment the bottleneck is the communication between AVR and STM.
I have to see if I have enough RAM left to run FatFS not in tiny mode.
Then each file would get its own 512byte sector buffer and I could add another sector buffer that prefetches sd card data in the background...
thatwould be 6144bytes instead of 512...
I solved that Problem in my Videoplayer with simple cooperative Task-Switching. Here is my tasker:
http://pastebin.com/B4k887zR
You just init all your tasks with start_task(<c_function>, <stack_size>);
Then call start_tasking();
And when you are waiting for something, like e.g. the dma to finish, you just do switch_task(); in the delay loop. Every task needs to call switch_task(); regularly, and the other tasks get called from there.
Another option would be to rewrite the FS-routines (or your music code) as an interrupt statemachine, but that simple tasker does a good job for me.
You can donload the Akai MPX8 Library here:
http://www.akaipro.com/product/mpx8#downloads
I modified the FatFS to work with the DMA.
I went with double buffering the sectors.
The fatFs is always working on the prefetched sectors while the DMA fetches the next sector in the background.
Streaming from SD card seems to work, but I still get audio dropouts and timing jitter on the sequencer while the sample is playing. probably the fat access takes too long as well :-/
and this is with 1 sample channel playing, not 6
maybe one could try to put the samples directly to the SD card, without a filesystem in between.
https://db.tt/FAveMHuJ
how much "samples" (lenght) would that be in wavelab respectivly the MPC ?
......i`m sampling into my mpc. would be cool to know
......possibly i get something up too.....working/sampling with a MPC
492.000 bytes / 44100 samples per second / 2 (because of 16 bit)
haha, now in understand
thanks
Works great! Loaded some LM-2 samples and it works really nice! There are some small clicks at certain Coarse/fine tune settings but you can fiddle around them.
Great additional feature already - thanks!
Morphing these sounds gets you leftfield fast! ;-)
Easier loading of samples from the SD card (or playback from the card) would be nice - but it's already great as it is.
frequency coarse at 0 to hear the orginale tone/pitch of the sound i've
imported. Please tell me if i'm wrong.
I would be nice if the coarse
around 63 could set the original pitch of the sample. This way, we
could high pitch (coarse 64 to 127) or low pitch (coarse 0 to 62) the
samples... instead of only high pitch the sound in the actual
configuration.
i think the course value for original pitch is determined by the sample rate your samples are in.
not sure right now, which value, but my course is higher than 0 for original pitch so that i can use it to pitch up and down.