1. Play WAV file in Win10 with Eu 3
- Posted by AndyDrummond Mar 24, 2021
- 1121 views
Going back to the old Euphoria 3, which I love, I need to play a WAV file. I'm using Windows10 64bit. But the playSound() routine does nothing. Even playSound("bell.wav") does nothing; every call just gives a ding. I have tried on two machines and various locations of wav files with no joy. And I can't find any basic program which can just play a wav and terminate.
Does anyone have any ideas? I have a simple voice recorder I have designed with GPS, and just want to play the verbal notes back from my Euphoric program as well as show the location on a map. The hard bit done, the easy bit stumps me!
Andy
2. Re: Play WAV file in Win10 with Eu 3
- Posted by ChrisB (moderator) Mar 24, 2021
- 1094 views
Eu 3? was that 16 bit?
Chris
3. Re: Play WAV file in Win10 with Eu 3
- Posted by AndyDrummond Mar 24, 2021
- 1128 views
Eu 3? was that 16 bit?
Chris
Eu 3.1.1 I think is actually 32bit. I'm surprised you remember 16 bit systems. Eu3 was the last version produced by Rob Craig, who invented Euphoria. Or are you just pulling my leg??
4. Re: Play WAV file in Win10 with Eu 3
- Posted by petelomax Mar 25, 2021
- 1095 views
Any joy with http://phix.x10.mx/pmwiki/pmwiki.php?n=Main.RandomwavPlayer ?
5. Re: Play WAV file in Win10 with Eu 3
- Posted by AndyDrummond Mar 25, 2021
- 1078 views
Any joy with http://phix.x10.mx/pmwiki/pmwiki.php?n=Main.RandomwavPlayer ?
I tried that, it wouldn't run under Eu3 and though I have Eu4 installed I can't persuade it to play ball. The program uses playSound() still which, though I have used it in the past OK, no longer seems to function under Win10. I don't know why this should be but I do know Win10 has done some odd things to existing functionality. I might try running my playSound() test program on WinXP and see if it works there; it ought to since it used to work!
I need to find a machine with XP on it...
6. Re: Play WAV file in Win10 with Eu 3
- Posted by jmduro Mar 25, 2021
- 1071 views
I tried the demo playsounds.exw and it works on my Win10 x84 PC with EU 3.11.
Jean-Marc
7. Re: Play WAV file in Win10 with Eu 3
- Posted by ChrisB (moderator) Mar 25, 2021
- 1051 views
Eu 3? was that 16 bit?
Chris
Eu 3.1.1 I think is actually 32bit. I'm surprised you remember 16 bit systems. Eu3 was the last version produced by Rob Craig, who invented Euphoria. Or are you just pulling my leg??
Not at all!
Looks like it may be getting sorted, but I might have considered something a bit more 'modern', like one of the current DLLs floating about.
Cheers
Chris
8. Re: Play WAV file in Win10 with Eu 3
- Posted by AndyDrummond Mar 25, 2021
- 1058 views
I tried the demo playsounds.exw and it works on my Win10 x84 PC with EU 3.11.
Jean-Marc
Oh. Confusion then reigns. I will try again. Something odd going on, but I can't try it again today - pressure of work!
I agree playSound() really ought to work ...
Andy
9. Re: Play WAV file in Win10 with Eu 3
- Posted by ChrisB (moderator) Mar 25, 2021
- 1044 views
So, is it right then, that there is no embedded way of playing a sound in Eu 4.x, apart from loading a library to do it? No playsound() equivalent?
Chris
10. Re: Play WAV file in Win10 with Eu 3
- Posted by ghaberek (admin) Mar 25, 2021
- 1042 views
Going back to the old Euphoria 3, which I love, I need to play a WAV file. I'm using Windows10 64bit. But the playSound() routine does nothing. Even playSound("bell.wav") does nothing; every call just gives a ding. I have tried on two machines and various locations of wav files with no joy. And I can't find any basic program which can just play a wav and terminate.
Does anyone have any ideas? I have a simple voice recorder I have designed with GPS, and just want to play the verbal notes back from my Euphoric program as well as show the location on a map. The hard bit done, the easy bit stumps me!
Just to be clear, we're talking about the Win32Lib playSound() routine, right? This isn't something built into Euphoria? There was only sound() for DOS.
Windows 10 doesn't seem to contain a "bell.wav" file, at least I couldn't find it searching my system and I don't see it in C:\Windows\Media. Maybe try "ding.wav" instead?
-Greg
11. Re: Play WAV file in Win10 with Eu 3
- Posted by ghaberek (admin) Mar 25, 2021
- 1055 views
So, is it right then, that there is no embedded way of playing a sound in Eu 4.x, apart from loading a library to do it? No playsound() equivalent?
There never has been. Playing sounds is an entirely platform-dependent process. For Windows there's PlaySound which is what Win32Lib uses.
On Linux you'd have to use something like GStreamer API which is rather... convoluted due to its dependence on GLib and its messaging loop.
-Greg
12. Re: Play WAV file in Win10 with Eu 3
- Posted by irv Mar 25, 2021
- 1039 views
With Linux, it's pretty simple:
include GtkEngine.e constant win = create(GtkWindow,"size=300x300,border=10,$destroy=Quit"), pan = create(GtkBox,"orientation=vertical"), box = create(GtkButtonBox), btn1 = create(GtkButton,"gtk-quit","Quit"), btn2 = create(GtkButton,"audio-player#Play","PlayIt") add(win,pan) add(box,{btn1,btn2}) pack_end(pan,box) show_all(win) main() global function PlayIt() system("""aplay "/home/irv/Downloads/surely_a.wav" &""") -- Robert Hays: "Surely you can't be serious." -- Leslie Nielsen: "I am serious. And don't call me 'Shirley.' " return 1 end function
13. Re: Play WAV file in Win10 with Eu 3
- Posted by ghaberek (admin) Mar 25, 2021
- 1018 views
With Linux, it's pretty simple:
global function PlayIt() system("""aplay "/home/irv/Downloads/surely_a.wav" &""") -- Robert Hays: "Surely you can't be serious." -- Leslie Nielsen: "I am serious. And don't call me 'Shirley.' " return 1 end function
I'm gonna split hairs with you here and argue that this isn't a good example since you're just launching an executable.
To be honest I focused on GStreamer and forgot about ALSA, but the ALSA API is probably a little simpler to implement.
-Greg
14. Re: Play WAV file in Win10 with Eu 3
- Posted by irv Mar 25, 2021
- 1030 views
You're correct, but what really is the difference between calling a function in a dll/so vs. executing a script that calls the same function (other than avoiding the complexities of interfacing directly with the dll/so function)?
Other than speed of execution, which isn't a consideration with sounds or videos.
15. Re: Play WAV file in Win10 with Eu 3
- Posted by AndyDrummond Mar 25, 2021
- 1031 views
OK, my machines simply go Ding whatever I try and play. But if I remove SND_ASYNC from the flags sent to the PlaySound Windows function, so the program waits for completion, the delay is just what I would expect, but the sound emitted is still just Ding at the start of that time. So the function is opening the WAV file, reads it and knows how long it should be, and then doesn't play it. The WAV file opens ok in Audacity and it plays there, so the data is OK.
So - back to square one: playSound() won't play a WAV file even if it does for M. Duro. I am more confused than ever. Computers - just love 'em, don't you?
16. Re: Play WAV file in Win10 with Eu 3
- Posted by AndyDrummond Mar 25, 2021
- 1022 views
Just to be clear, we're talking about the Win32Lib playSound() routine, right? This isn't something built into Euphoria? There was only sound() for DOS.
Windows 10 doesn't seem to contain a "bell.wav" file, at least I couldn't find it searching my system and I don't see it in C:\Windows\Media. Maybe try "ding.wav" instead?
-Greg
Yes, standard playSound() which just calls PlaySound which is a windows multimedia routine.
And sorry, you're right, no bell.wav. But I tried some of the other Windows sounds like chimes.wav which is a legit windows tone wav file.
17. Re: Play WAV file in Win10 with Eu 3
- Posted by AndyDrummond Mar 26, 2021
- 1003 views
I have no answer as to why some Windows WAV files won't work, but I have found why my own generated speech files wouldn't run.
The file header matched the WAV file specification to a T, but if I opened one in Audacity, played it, and exported it again, the file and data length fields were reduced by 8. They then worked fine in the Euphoria playSound() routine. So I edited my code to reduce those fields by 8 - and Lo and Behold! They played fine.
So though the file length was whatever, I had to tell the WAV header it was 8 fewer. Make sense of that if you can.
And thank you all for your help.
Andy
18. Re: Play WAV file in Win10 with Eu 3
- Posted by petelomax Mar 26, 2021
- 980 views
what really is the difference between calling a function in a dll/so vs. executing a script
not much for a ding, but with anything longer stop/mute might be a tad trickier...
19. Re: Play WAV file in Win10 with Eu 3
- Posted by petelomax Mar 26, 2021
- 963 views
Make sense of that if you can.
I wonder if there's a virus that fits in 8 bytes...