Re: Multiple little wav files, played when the user chooses

rocco <[email protected]> Sat, 4 Feb 2017 18:18:24 -0700
Newsgroups gmane.comp.audio.ecasound.general
Message-ID <[email protected]>
On 02/03/2017 07:47 PM, Peter Billam wrote:
> So I can imagine a toy app which takes a dozen or so little .wav files
> each connected to its own chain, with a dozen little buttons that
> the user can push to play the corresponding .wav file.

I just tried this and it works flawlessly...

I pasted three sounds into one long WAV file
(WAV is best format to use for the commands we are going to issue)

The file is:
play.wav

These are the beginning and end times for each pasted sound:
bark   0.000  to  0.832
meow   0.832  to  1.892
laugh  1.892  to   end

In a shell, I CD'd to the directory where play.wav is

I issued the command:

ecasound -z:nointbuf -z:nodb -c -a:1 -i:play.wav -o:alsa,hw:0

'-c' runs ecasound in an interactive shell so you can issue commands to 
ecasound

'-z:nointbuf' AND '-z:nodb' are VERY IMPORTANT. With these flags set, 
each sound will play INSTANTANEOUSLY

To play 'bark' I issue the commands:
ecasound ('h' for help)> cs-set-position 0
ecasound ('h' for help)> cs-set-length 0.832
ecasound ('h' for help)> t

To play 'meow', I issue the commands:
ecasound ('h' for help)> cs-set-position 0.832
ecasound ('h' for help)> cs-set-length 1.892
ecasound ('h' for help)> t

To play 'laugh', I issue the commands:
ecasound ('h' for help)> cs-set-position 1.892
ecasound ('h' for help)> cs-set-length -1
ecasound ('h' for help)> t

 From the ecasound-iam man page:
cs-set-length ’seconds’
  Sets processing time in seconds (doesn’t have to be an integer value). 
A special-case value of ’-1’ will set the chainsetup length according to 
the longest input object.

Being that it's just one WAV file, the disconnect when you issue 
'cs-set-length' is unnoticeable. And as I mentioned, with '-z:nointbuf' 
AND '-z:nodb' set, each sound will play instantaneously

I created three buttons in a tcl/tk app that did the above. Each sound 
plays instantaneously and I can even interrupt an already playing sound 
and the old sound stops and the new sound will play instantaneously. 
When pressing buttons 'rapped fire' they play flawlessly. 'meow' goes 
"me-me-me-me-me-me-me-meow".


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Ecasound-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ecasound-list