Question about .wav, .mp3, .mid - Which one?

Started by oradba4u, April 03, 2021, 04:08:47 PM

Previous topic - Next topic

oradba4u

All:
I'm looking into developing a sports app with voice annotation (play-by-play) that requires quick responses, and I'm wondering which format to use (.mp3, .wav, etc.), Windows text to voice or something else?
I've looked at the tech database and found a code snippet that doesn't seem to work as advertised. (see attached)
It seems that every time I attempt to use WinBatch functions with Windows commands, I get flummoxed. Guess that's why I'm a newbie.
I am using WinBatch 2021b and Win 10
Which file format/playback would best fit the requiremments? (speed of response, file sizes, indexing, etc.)
Is there a way to have one BIG sound file with many snippets in it that can be indexed so only a portion (start point) and (stop point) of the file be played?

Thanks in advance!

dir = AskDirectory("Choose directory of songs to play", "", "", "", 0 )
DirChange(dir)
songlist = FileItemize( "*.mp3" )
count = ItemCount( songlist, @TAB )
For xx = 1 To count
   song = ItemExtract( xx, songlist, @TAB )
   PlayMedia('open mpegvideo!' : song : ' alias music')
   PlayMedia("play music WAIT");Wait for song to complete
Next
Exit





stanl

I would suggest you test what works best. Are you going to be recording play-by-play then playing out through a script? I would start with .wav. As for playback (and you have Win10) you could play around with
Code (WINBATCH) Select


ObjectClrOption('useany', 'System')
ObjectCLrOPtion('useany', 'PresentationFramework')
ObjectCLrOPtion('useany', 'PresentationCore')


oMedia = ObjectClrNew('System.Windows.Media.MediaPlayer')
;or for just .wav files
;Snd = ObjectClrNew('System.Media.SoundPlayer')





If you aren't that interested in playing with code a simple WB script that shells out to a good free media player with command-line options look into vlc.exe


https://www.videolan.org/vlc/
[/size]

stanl

just for fun, this worked on my Win10
Code (WINBATCH) Select


;Winbatch 2020A - play wav
cFile = "c:\temp\test.wav"
If ! FileExist(cFile) Then Terminate(@TRUE,".wav file to play not found",cFile)
ObjectClrOption('useany', 'System')
ObjectCLrOPtion('useany', 'PresentationFramework')
ObjectCLrOPtion('useany', 'PresentationCore')


Snd = ObjectClrNew('System.Media.SoundPlayer')
Snd.SoundLocation =  cFile
Snd.PlaySync()
Snd=0



oradba4u

As always,thanks for the suggestion(s).

Yes, my plan is to record the play-by-play snippets (or use some existing, yet appropriate clips - NOTE: I haven't ruled out a text to speech implementation either*) and play them back. I see my hurdles as many (which file format best suits my objective - size of file(s), speed/response time of playback, etc.) and do I record them separately as possibly 100's of small snippets, or string them together (via Adobe Audition for example) into one large .wav or .mp3 file and index the start/stop points. I'm leaning towards one big audio file, but I'll test all the methods mentioned, and others that might come along as I get deeper into this.

* I'm not too keen on text to speech, as (what I've personally listened to) it sounds too artificial to my ears.

Anyway, thanks a bunch for your input, I've got a good starting point, and I welcome any other input from anyone with experience/suggestions in this area.