Lee

SD card polyphonic sample player

137 posts in this topic

Is the SD card the sole factor in limiting the number of voices? how much processing power is left over?

 

I'd like to see this grow into a more featureful sampler: envelopes, LFOs, CV control of analogue filters...

 

Share this post


Link to post
Share on other sites

Hey Lee,

 

I know you're not familiar with the STM32 Core but I was curious. Could I wire up a rotary switch like yours or a few buttons on J5a/b/c of the STM32 to do the program changes? Maybe TK would know better. I've got an LPC Esspresso board coming shortly so I'll upgrade my sampler when that gets here BUT I do have this STM32 board just laying around... I don't like haveing to switch between banks via program change. I'd rather use buttons or a rotary switch. Thanks for any info!

Share this post


Link to post
Share on other sites

Hi Lee, thanks for building this project, it's awesome. Can you tell me which roraty encoder you've used ? Also in the description the audio amplifier it's not detailed. Can you post schematics for the finished board please ?

 

Thanks a lot !

 

Diego.

Share this post


Link to post
Share on other sites

The sample player is now also working on the STM32F4DISCOVERY board, which is probably the cheapest solution for this project, because it has an on-board Audio DAC! :)

 

More about this topic soon.

 

A refreshed all precompiled binaries:

http://svnmios.midibox.org/listing.php?repname=svn.mios32&path=%2Ftrunk%2Fapps%2Fsynthesizers%2FSD+card+sample+player%2F

under release/*

 

NOTE: I changed the MIDI channel assignment, now "midichannel 1" really assigns to the first MIDI channel, and not to channel 2 (previously it was counted from 0, which wasn't obvious)

 
Best Regards, Thorsten.
 

Share this post


Link to post
Share on other sites

Hey,

 

I have a problem getting the Sample Player to work with the new STM32F4. I uploaded the project.hex and connected my sdcard  with some samples, and they seem to load fine, BUT I can't hear anything?!

 

When I connect my headphones I can hear a bit of white noise after the application is loaded, so that tells me that the audio out is (somehow?) initialized. 

 

My hardware config:

- just the STM32F4-Discovery (no MBHP_CORE_STM32F4) with the additional jumper cable for 5V and an sdcard-reader directly connected 

- I tried two different sdcards, one 4gb with FAT32 (I know I should use FAT16) and one 4GB with 2x2GB FAT16 partitions

- I know that these samples worked with a LPC17 based core

- I tried uploading MB_NG and it also seems to work fine, also with the sdcard file browser

- I connected the Audio-Out to headphones and to a mixer line-input as well, still nothing

- according to MIOS Studio terminal output, everything is configured and loads up fine (see screenshots)

 

What I am doing wrong? 

 

(If anybody wants to try my sdcard-files, they are here)

post-6075-0-38158800-1396389283_thumb.pn

post-6075-0-04463700-1396389285_thumb.pn

Share this post


Link to post
Share on other sites

Found & fixed the problem - it was related to the midichannel handling.

 

Could you please try the new version in the repository?

 

Best Regards, Thorsten.

Share this post


Link to post
Share on other sites

It's working now!

 

But I noticed a strange behavior with the release phase of a sample: I always get a crispy/crackling sound when I release a key, no matter what I set the release parameter to. With no release phase (value 0) I just get a short klick (which I think is normal), but with longer release times (say up to 1000) the whole release phase of a sample is distorted/crackling. 

 

When I press a key till the sample ends everything is fine btw. I already tried different samples and different volumes, but the problem remains.

 

I tried a LPC17 core with the sample player app a few months ago, and as far as I can remember there wasn't such a problem, but I'm not 100% sure.

Could that be STM32F4-related? I could try my external DAC (TDA1543 based) that I used with the LPC17 if there is a way to connect that to the STM32F4.

Share this post


Link to post
Share on other sites

Here's a small sample I did with two different release times. You can hear the distorted tail of the samples. Anybody else having that problem with the SD Card Player?

sdcardsampler_dist.wav

Share this post


Link to post
Share on other sites

That's mellotron cello, isn't it! :-)

 

I've used the sample player for playing mellotron samples for a few years, and when I read your message from 8 April about distortion, I thought the problem was much bigger than it turned out to be when I now listened to your attached sample: for me the sample player has always behaved like this, i.e. I've noticed that it breaks down a bit, or there's some little crackle like in your attached sample, but I've never thought it's that much of a problem.

Share this post


Link to post
Share on other sites

Not sure the Discovery audio output could be called pristine quality, exactly. As I remember the wave playback demo is also a bit grungy.

Share this post


Link to post
Share on other sites

Thanks for your feedback, guys!

 

Yep, a mellotron sample ;) 

You're right, it is definitely a usable signal, for sure (though I have to say when you play/change chords it's much more obvious than in my example).

I just wanted to make sure that there's nothing wrong with my setup, and I still wonder why it's only in the release phase while the rest of the sample plays back fine.. 

 

It's just a wild guess but maybe we hear some kind of bit-crushing when the sample fades out (saying: volume gets turned down digitally and the bit-resolution gets lower). I remember the audio-output from my macbook makes all kinds of weird noises when set to a low volume. 

 

However I know It's not high-end DAC but I find it quite ok, and it comes for free with the STM32, so I won't complain  :shifty:

 

BTW does anybody know if we are still able to connect an external DAC to the STM32F4? On the new MBHP_CORE_STM32F4 the pins should be at J10B but I have no idea how to active that.

Share this post


Link to post
Share on other sites

Thanks Thorsten.

 

I connected my TDA1543 board (built one according to mbhp_i2s_tda1543.pdf) like this:

 

STM32DISCOVERY -> TDA1543

PA4 (LRCK)               -> Pin#2 (WS)

PB9 (SDA)                 -> Pin#3 (DAT)

PC10 (SCLK)             -> Pin#1 (SCK)

 

...and 5V, GND and audio outputs of course.

 

but I couldn't get any sound out of it. Don't know if this is supposed to work like that. I mean connecting a second DAC in parallel..

Share this post


Link to post
Share on other sites
You're right, it is definitely a usable signal, for sure (though I have to say when you play/change chords it's much more obvious than in my example).

I just wanted to make sure that there's nothing wrong with my setup, and I still wonder why it's only in the release phase while the rest of the sample plays back fine..

 

Just to follow up quickly on setup, I'm using LPC17 and an external DCA based on TDA1543.

Share this post


Link to post
Share on other sites

Hi guys,

 

I played with my newly arrived STM32F4DISCOVERY board, the sample player is the ideal app, because it doesn't need any external component. I also noticed the distorted tails and even the "pops" when changing notes or retrigger them. So I made some changes in the app, and I hope it was worst for the work.

 

- I relocated the "decay" routine to the buffer filling function, modifying each sample volume to smooth the envelope

- added a small release phase to the 0 release value voices also, to eliminate the pops

- modified the retrigger behavior, so when you retrigger an already played note, it restrats after a small release phase

 

As I tested after the above mods all the distorts was gone!

 

I also made it work with stereo samples! The only drawback is that I had to set back the polyphony to 7, but it works good.

 

It would be glad, if somebody could test my changes.

 

TK, is it OK to post hex files here, or there are other rules?

 

Share this post


Link to post
Share on other sites

That's great news!

 

Concerning stereo samples, do the other limitations still apply, i.e. it still has to be "44.1kHz 16 bit RAW signed little endian", even though it can now be either monophonic or stereophonic..?

Share this post


Link to post
Share on other sites

Actually I made a separate app for stereo samples, so all the voice files must be stereo in this case, they can not be both. The raw format is the same except that this is stereo, so two times 16 bit for every sample. This gets to an other limitation: because of the file size limit the max voice length is smaller.

Share this post


Link to post
Share on other sites

Works perfectly on my side here. Thanks Norbim!!!!!!

Share this post


Link to post
Share on other sites

Very cool! :smile:

 

I gave you access to the hidden programmers section of this forum: http://midibox.org/forums/forum/41-programmers-lounge/

 

I can give you SSH access to the subversion server so that you can upload your code for easier sharing :smile:

 

Best Regards, Thorsten.

Share this post


Link to post
Share on other sites

My version was added to the repo "playground". Many thanks TK for the access.

 

In the mean time I've noticed a small pitch mismatch on the played sounds (STM32F4Discovery). The pitch was approx a half note lower than it should be. It was due to the stm32F4 not correct I2S PLL divider settings. I corrected it also for the 44.1kHz sample rate.

Share this post


Link to post
Share on other sites

And where or how can I get acces to this new version?

Share this post


Link to post
Share on other sites

OK, I'll check it out,  thanx!

Share this post


Link to post
Share on other sites

Yess, I got this to work, It plays my own samples!

But how hard would it be to add some pushbuttons to trigger samples?

In midiboxNG it's really easy to add a button creating a note on/off event, with the MIOS filebrowser. But MIOS Filebrowser is not implemented by this application, so I don't know where to start.

Cheers and thanx again for a wonderfull application!

Roel

Share this post


Link to post
Share on other sites

That would require some coding, to merge the NG firmware with the sample player functionality.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now