Ok... I fixed the mlock problem, just needed to change the max voices and
streams.

I tried putting different values for usleep in the MidiIn main loop and
found that usleep(150000) seems to work the best. Now when I hit a note I
can hear a sine wave corresponding to the pitch of the particular note.
The "resource not available" error stills appears occasionally but now I
can at least get a few notes out. If I make the usleep() time smaller the
error happens more often.

Anyway, I'll play with it more tonight. Thanks for the help everyone!

Chris|



On Fri, 14 Jul 2000, Benno Senoner wrote:

> ALSA folks can you help us to fix Chris' problems ?  
> 
> for the ALSA folks that that are not yet aware about, 
> a few days ago I released an experimental harddisk-based realtime sampler
> (which streams the files directly from disk with precaching of the initial
> parts)
> see the story here: http://eca.cx/lad/2000/Jul/0149.html
> 
> download the sampler here:  
> http://www.gardena.net/benno/linux/linuxsampler.tar.gz
> 
> 
> anyway I am using OSS for my tests on an AWE64 with 3x128 fragments
> and using the RAW midi device ( /dev/midi00) to process input
> (I open the device in blocking mode and
> then sit in a loop which does  
> while(1) { 
>   read(midifd,buf,1); 
>   process_midi_byte() ; 
> }
> 
> Chris gets "Resource temporarily unavailable" errors
> within the midi loop.
> Is that because ALSA has problems with blocking MIDI input
> (I recall discussion about blocking/non blocking MIDI , but I can't remember
> the conclusion) ?
> Under OSS/Free blocking read()s work nicely and return as soon midi bytes are
> available.
>   
> now to the other stuff
> 
> 
> On Fri, 14 Jul 2000, Chris Baugher wrote:
> > Hello,
> > 
> > I was just playing with your disk-sampler and I've run into two problems.
> > First, mlockall() returns an error. Second, the program immediately exits
> > after I hit the first note. Here is the output:
> 
> (before starting playing, wait 1-2 secs until all threads get fired up , or you
> will get a segfault sometimes when pressing the first key because all
> messages queues are not yet initialized)
> 
> 
> the instrument requires about 35MB available which wants to get mlocked()
> I exaggerated with the allocateded diskstreams (100) , so simply 
> in types.h  set MAX_INPUT_STREAMS to 40 
> and  MAX_AUDIO_VOICES to 32
> and the mlock should be ok
> 
> > 
> > 
> > fluke:/home/cygnus/linuxsampler# ./disksamp ./sine.sam
> > main start ....
> > Instrument::load fd=3
> > header res=16400
> > LOAD: num_waves=61
> > WARNING, can't mlockall() memory ! mlockall: Cannot allocate memory
> > midi: start ....
> > WARNING, can't mlockall() memory ! mlockall: Cannot allocate memory
> > AUDIO: using STEREO output
> > using ALSA audio output ....
> > ALSA: fragmentsize=128
> > ALSA: numfragments=3
> > WARNING, can't mlockall() memory ! mlockall: Cannot allocate memory
> > ERROR in read_midi_bytes: read: Resource temporarily unavailable
> > fluke:/home/cygnus/linuxsampler#
> > 
> > 
> > The "ERROR in read_midi_bytes:" only appears when the first note is hit.
> > I tried putting a usleep(200000) in the MidiIn main loop. The error
> > doesn't apear and sometimes it makes noise but not always. Is it possible
> > this is an ALSA problem?
> 
> Probably, especially the ES1371 (I have one too seems to show up a weird
> behavior when using very small fragments ( try fragmentsizes of 256 and 512
> using the commandline and see if it helps)
> 
>  What version are you using?
> 
> For now OSS here , because I am currently at home on my old ALSA-less PII400
> :-)
> 
> 
> > I tried the test program rawmidi.c in alsa-lib/test and it produces notes
> > so it seems midi is working. aplay works fine as well. 
> > This is what my system looks like if it helps:
> > 
> > Pentium 250 (overclocked)
> > 64MB ram
> > 3.2 gig EIDE disk
> > SB AudioPCI (ens1371)
> > crappy old Yamaha keyboard
> > 2.2.14 kernel patched for low-latency
> > ALSA 0.5.8b
> > 
> > Ideas?
> 
> Regarding the MIDI issue, I am waiting for an answer from the ALSA folks since
> I haven't do much midi IO on my other box which has ALSA installed plus 
> I have not access to this box currently.
> 
> As for ALSA audio output,  I am doing nothing magic: I simply  setup
> the card in BLOCK mode and then do  simple pcm_write() of fragments
> in a loop. 
> 
> > 
> > BTW, I think this is a very cool project. I would someday like to get a
> > midi drumkit(I am a drummer and YES drummers are very latency sensitive:)
> > and if I could use my PC as the sound module that would be fantastic! I
> > don't know how much I could contribute to this project but I'll see what I
> > can do.
> 
> That would be cool, plus think about the fact the having virtually unlimited
> disk space, will allow you to sample every fine nuance of the drumkit
> ( eg. multiple samples per different velocities etc)
> 
> 
> Let us know if  you are able to solve your problems.
> 
> 
> Benno.
> 
> 
> 
> > 
> > Chris|
> 
> 

Reply via email to