Jump to content

SD card polyphonic sample player


Lee

Recommended Posts

Hi all,

I've just finished a basic implementation of a polyphonic sample player. It basically takes a bank of sample files from the SD card and allows playing in real time. You'll need an LPC1769 based MIOS32 device, the SD card interface and a I2S DAC...

Further details and links to files on the wiki here: http://www.midibox.org/dokuwiki/doku.php?id=midibox_sd_card_sample_player

Many thanks

Lee

Link to comment
Share on other sites

Very nice project, thanks for adding docu and code!

In conjunction with e.g. a SEQ V4L, one could for example build a cool portable rhythm production studio!

Or use it as the worlds cheapest piano multisampler (different samples for every note) e.g. for an old midi keyboard... Great stuff!

Greets!

Peter

Link to comment
Share on other sites

If we can load it with the old Korg M1 pianos we can haz an instant house piano module. Wonder if a 2nd hand M1 is cheaper though? Or use the VSTi - shudder.

Still, this would make a mighty cool Wavetable/DCO thingy if you don't have other plans in mind. PPG or VS for the masses.

Edited by jojjelito
Link to comment
Share on other sites

It's weird that, as I do own an M1 I bought back in 1990, I also have the Korg M1 VST software, and obviously this hardware now! :frantics: And the original hardware is best! (though wait until I sample it, like I did my DW8000 which I have as a sample set running on the SD card player sounding great!!)

I've now got bank switching on the fly working too... Also out of the box the bank files support layering and zoning (ie layering = have same midi note on a line, with different sample. Zoning = just pick different sample for different midi note ranges). Pretty handy really! :ahappy:

If we can load it with the old Korg M1 pianos we can haz an instant house piano module. Wonder if a 2nd hand M1 is cheaper though? Or use the VSTi - shudder.

Still, this would make a mighty cool Wavetable/DCO thingy if you don't have other plans in mind. PPG or VS for the masses.

Link to comment
Share on other sites

I have to try the Adventure Kid AKWF in order to have some fun. It's a massive pack of some 4350 single-cycle waveforms. Get it! Love it!

If I get really bored I could load those into my Prophet VS or use slightly less magic and get them into one of my Shruthis. Or just refill it. Choices choices...

Nahh, SD card convenience plus dedicated hardware will win the day :flowers:

I still get 90's flashbacks from the M1 presets! One day I'll grow up, but that was my guilty pleasures moment of today .

Link to comment
Share on other sites

The code currently is one-shot only, however it should be fairly easy to add a parameter to the bank file to indicate looping, with the constraint that the samples will need to be 256 samples (512 bytes) long due to the way the card data is read in a sector at a time...

Lee

Link to comment
Share on other sites

Nice! It's getting better and better.

It would be really cool if there was a way to "unalign" the samples so that you could read and load up to a few sectors. Then it could discard the non-used data and have loop start, loop end and loop mode (fwd/rew/ping-pong/xfade) modes. But, thar's other dedicated things for that. Hardware samplers aren't really in vogue these days, but lo-fi loopers or wavetablers/DCOs are.

Link to comment
Share on other sites

It is possible, but this would be at the expense of polyphony. With using SD cards, they are slow to read compared to RAM (like you'd have on a classic sampler) and right now 8 reads in parallel is all that is possible. If your sample finished part way through a 512 byte sector, you would need to read part of another sector at the start which one effectively take up one 'slot' from the 8 reads... So to allow for this case on all voices, we'd be down to about 4 notes polyphony...

I'll have a play with this when I get the time and report back...

Cheers

Lee

Nice! It's getting better and better.

It would be really cool if there was a way to "unalign" the samples so that you could read and load up to a few sectors. Then it could discard the non-used data and have loop start, loop end and loop mode (fwd/rew/ping-pong/xfade) modes. But, thar's other dedicated things for that. Hardware samplers aren't really in vogue these days, but lo-fi loopers or wavetablers/DCOs are.

Link to comment
Share on other sites

Yes, maybe implement the option to hold a few very small (looped) samples in memory (those single-cycle waveforms) or other wavetable-ish stuff.

Me still haz some code of my old (1994) dos based mod player somewhere (which does sample stretching to obtain the played note pitch - good old amiga times :-)),

but then... this would be quite another project... Lee decides :)

Edit: on a second thought, SD storage is so big and cheap, one could totally create full note spectrum sample files of "unlimited length" offline, that means, if you have a nice single-cycle waveform, run a script that "renders" a samplebank for the SD player, as it is... not much work to do, and it runs on todays sd card sample player software :) and does not require further ram or processing power.

Greets,

Peter

Edited by Hawkeye
Link to comment
Share on other sites

Yes, maybe implement the option to hold a few very small (looped) samples in memory (those single-cycle waveforms) or other wavetable-ish stuff.

Me still haz some code of my old (1994) dos based mod player somewhere (which does sample stretching to obtain the played note pitch - good old amiga times :-)),

but then... this would be quite another project... Lee decides :)

Edit: on a second thought, SD storage is so big and cheap, one could totally create full note spectrum sample files of "unlimited length" offline, that means, if you have a nice single-cycle waveform, run a script that "renders" a samplebank for the SD player, as it is... not much work to do, and it runs on todays sd card sample player software :) and does not require further ram or processing power.

Greets,

Peter

Hear hear! Some support for loop points and mode would be nice. The rest of the sample editing could and should be done offline on a proper computer. SD cards cost the same as a roll of film (anyone remember those?) so that's almost a throwaway.

Grits,

Johan

Link to comment
Share on other sites

Committed a major new version, this has a new format bank file, for example:

0x3b 0 0031 3b.raw

0x3c 1 0000 t_c3.raw

This is now: midi note number, 0=no sample hold, 1=sample hold, 0031 = envelope decay value, filename. The decay is experimental, but clearly 0000 = no decay, and higher numbers is a longer decay (up to 1023) - it's a decimal number.

I've tested a bank file with different sample sets zoned, some with sample hold and different decay values and it seems to work ok, but it's probably got bugs, and i'm not really happy with some stuff - but it's a step forward!

On the point around a RAM based wavetable player, that's not really a priority for me right now, though some of the SD card player can be reused for this type of purpose, but it is a major re-write. I'm interested in doing it, but i'll have to look at it later unless someone else wants to take it on..?

Thanks

Lee

Link to comment
Share on other sites

  • 3 weeks later...

I've just added another minor but useful feature to the version in the SVN (hex and source) - it will now load bank files depending on MIDI program change. If you send a change to patch 1, it will load the bank file bank.1, patch 2 - bank.2 etc... If the patch number doesn't exist it will output nothing (no samples loaded) but upon sending a patch/bank that does exist it will then correctly load the bank and make noise again. :smile:

Hopefully this will make it easy to have multiple banks on the SD card and switch on the fly (loading a bank typically takes about a second for 64 samples, correspondingly less if your bank has less samples) - the LED on the board will be on during loading of the bank.

If anyone else wants any simple features let me know. I'm stuck for time a bit at the moment, but you never know if it's something simple!

Cheers!

Lee

Link to comment
Share on other sites

Lee,

In its current manifestation, the sample player is providing the digital "concrete noise/abstract beat/abstract vocal/micro glitch" layer of a MB SEQ4 controlled mainly analog synth/drum setup. Formally, some samples are drumlike in sound and usage, others are textural and pad like. i am really amazed at the player's ability to do "micro edits" and "stutter cuts".

Lee, i have all kinds of suggestions for features. Alas, i am wary to make them for the fear my ignorance of all things "bit order" showing through....... Send a CC and all samples triggered afterwards play backwards? Parametric bit crushing? On the more realistic side: a hardware config file that would allow things like changing the midi channel (which i really need to do, so many things on channel 1).

You Rock!

Cheers,

James F Ellis

Link to comment
Share on other sites

Hi,really nice!

Some gate and trigger out could be nice for triggering external

envelope generators for analog VCA and VCF.

Perfect solution is some control surface with LCD and internal EG's witch support AOUT module, but

this is ( I guess) not easy hach.

Just gate and trigger is fine.

Best regards, IGI

Link to comment
Share on other sites

Hi Jim,

I've just committed a new version which supports reading a config file in from the SD card. You can set the midi channel to anything you like now (if the config file doesn't exist etc it defaults to 1). Merry Christmas! :santa:

Hello igi - thanks for the comments. Could you explain a little further how you would want the gate and trigger to work with the sample playback?

Thanks

Lee

Link to comment
Share on other sites

Hi Lee!

Thanks for interest. :rolleyes:

On every note on retrigger the TRIGGER and GATE on.

GATE is on until any note is on.

Something like this:

note on:

>trigger on (pulse a few ms )

>gate on

note off:

>gate off

For example:

>note on(36)= trigger on + gate on

>note on(37)= trigger on

>note off(36) = nothing

>note off(37) = gate off

Thanks and best regards, IGI

Gate and trigger should work on any free pins of LPC core.

Edited by igi
Link to comment
Share on other sites

Hey Lee,

I finally had the chance to give this a go. Thanks for all the work you've done! I haven't even come close to getting this far with my project! I'm using an STM32 core instead of the LPC core seeing as all I have is the STM. I seem to have run into some issues. I posted the debug message I got at startup after I uploaded the project.hex. Here it is:

[126248.098] Initialising SD card..

[126248.100] Opening config file player.cfg

[126248.100] [disk_initialize] error while checking for SD Card (status 0)

[126248.102] [disk_read] error while reading sector 0

[126248.104] [FILE] Failed to open root directory - error status: 1

[126248.104] Failed to open config file.

[126248.106] Opening bank file bank.1

[126248.106] [disk_initialize] error while checking for SD Card (status 0)

[126248.108] [disk_read] error while reading sector 0

[126248.108] [disk_initialize] error while checking for SD Card (status 0)

[126248.110] [disk_read] error while reading sector 0

[126248.110] [FILE] Failed to open root directory - error status: 1

[126248.112] Failed to open bank file.

[126248.114] Initialising synth...

[126248.114] Synth init done.

The SD card is formatted as FAT. I'm using a 1GB sd card, not sdhc or anything... I'm not sure if the issue is the fact that I'm using the STM32 or what is exactly going on... I know for a fact that the SD card reader and the core are talking as I've tested it all with the 'usb_mass_storage_device' app. Maybe the STM32 accesses the SD card in a different way? Any help is much appreciated!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...