BBC BASIC for Windows
« API calls for Sound and Video »

Welcome Guest. Please Login or Register.
Nov 21st, 2009, 09:32am




Pages: 1 2  Reply Notify Send Topic Print
 hotthread  Author  Topic: API calls for Sound and Video  (Read 486 times)
GordonSweet
New Member
Image

member is offline

Avatar




PM


Posts: 21
xx API calls for Sound and Video
« Thread started on: Oct 24th, 2008, 07:04am »
Quote

In view of the number of Library files already kindly made available mostly by Richard, would it not be a good idea if someone could manage to create one to make it simpler, especially for beginners, be able to play MP3, WMA and Video files. Also to access the 128 sounds using the WINMM.DLL ?

Gordon
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage

member is offline

Avatar




Homepage PM

Gender: Male
Posts: 276
xx Re: API calls for Sound and Video
« Reply #1 on: Oct 24th, 2008, 10:07am »
Quote

Quote:
would it not be a good idea if someone could manage to create one to make it simpler, especially for beginners, be able to play MP3, WMA and Video files. Also to access the 128 sounds using the WINMM.DLL ?

Sounds like a good idea. Are you volunteering to do the work? It would need the appropriate code to be extracted from (e.g.) http://www.bbcbasic.co.uk/bbcwin/examples/player.html and packaged up into a library format.

Incidentally, playing MP3, WMA files and so on is dependent on suitable codecs being installed. The library you propose isn't magically going to make an ancient Windows 98 PC able to play them!

Richard.
User IP Logged

GordonSweet
New Member
Image

member is offline

Avatar




PM


Posts: 21
xx Re: API calls for Sound and Video
« Reply #2 on: Oct 24th, 2008, 11:50am »
Quote

I will have a try Richard soon.

Gordon
User IP Logged

Malcolm
Guest
xx Re: API calls for Sound and Video
« Reply #3 on: Oct 24th, 2008, 4:49pm »
Quote

Thanks, Richard, for reminding me that the Example file existed. I was getting frustrated with commercial players always trying to give visual displays and looks up things on the web that I did not want. Now I see I can optimize my own little player.

Malcolm.

User IP Logged

GordonSweet
New Member
Image

member is offline

Avatar




PM


Posts: 21
xx Re: API calls for Sound and Video
« Reply #4 on: Oct 30th, 2008, 2:33pm »
Quote

If any did not see the posting in the Yahoo BBC4W Group I have produced a MEDIA.LIB to play any of the Video and Sound files as with Player.bas, it also allows access to the 128 Instrumental sounds provided by Windows WINMM.DLL. The latter can be useful when creating games etc. It can ne found among the groups Library Files as Media.zip, and includes a Demo program Test Media Lib.bas. It does not have the same functions of STOP and PAUSE of Player.bas just a quick way of finding and playing medial files

Both files can also be downloaded from among http://www.sigord.co.uk/BBC/BBCBASIC.htm
among the Progaids.

Gordon
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage

member is offline

Avatar




Homepage PM

Gender: Male
Posts: 276
xx Re: API calls for Sound and Video
« Reply #5 on: Oct 30th, 2008, 3:53pm »
Quote

Quote:
It can be found among the groups Library Files

It's useful to remind people here that, although Conforums does not have an upload capability, the Yahoo group's Files area is available for that purpose. Since most Conforums members will, I assume, also subscribe to the Yahoo group, uploading files there and linking to them from here is a practical solution (even though care must be taken to get the link right!).
User IP Logged

Malcolm
Guest
xx Re: API calls for Sound and Video
« Reply #6 on: Nov 15th, 2008, 6:57pm »
Quote

A CD, MP3, WMA ans WAV player.

http://tech.groups.yahoo.com/group/bb4w/files/Sound-Music/AudioPlayerPlus.zip

Code, executable and notes.
User IP Logged

Malcolm
Guest
xx Re: API calls for Sound and Video
« Reply #7 on: Dec 5th, 2008, 4:01pm »
Quote

The audio Player based on the MCI API's has been updated and is here:

http://tech.groups.yahoo.com/group/bb4w/files/Sound-Music/AudioPlayer/AudioPlayer2_6a.zip

Version française

http://tech.groups.yahoo.com/group/bb4w/files/Sound-Music/AudioPlayer/AudioLecteur2_6a.zip
User IP Logged

Trevor
Guest
xx Re: API calls for Sound and Video
« Reply #8 on: Apr 16th, 2009, 12:47pm »
Quote

Question

Can you access Sound or Music through the PC ports and record and store as a file in BBC4 formatt.

The reason for this is sampling sounds and musical instruments to experiment with blending sounds. smiley
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage

member is offline

Avatar




Homepage PM

Gender: Male
Posts: 276
xx Re: API calls for Sound and Video
« Reply #9 on: Apr 16th, 2009, 10:59pm »
Quote

Quote:
Can you access Sound or Music through the PC ports and record and store as a file

Certainly. See this Wiki article for how to input real-time audio:

http://bb4w.wikispaces.com/Inputting+real-time+audio

and various programs here for how to output the audio to a file:

http://groups.yahoo.com/group/bb4w/files/Sound-Music/

Richard.
User IP Logged

19Grumpah42
New Member
Image

member is offline

Avatar




PM

Gender: Male
Posts: 35
xx Re: API calls for Sound and Video
« Reply #10 on: Oct 14th, 2009, 08:44am »
Quote

[quote author=Guest-Malcolm link=board=multimedia&num=1224828282&start=7#0 date=1228492883]
>The audio Player based on the MCI API's has been >updated and is here:

>http://tech.groups.yahoo.com/group/bb4w/files/Sound-Music/AudioPlayer/AudioPlayer2_6a.zip

I am enormously impressed with this, over 1000 lines of terse code. I am a beginner! Could you briefly but cogently tell me *why* all this coding is an improvement over something like....

DIM wav_4% size%-1
OSCLI "LOAD """+wave$+""" "+STR$~wav_4%
beats_address%(4)=wav_4%

SYS "PlaySoundA", beats_address%(J%), 0, 5

(which would play a *.WAV file loaded into memory)

Is it about 'high precision timers', or what?
I realise that your program is multi-purpose whereas the above is single purpose. I would like to know what I am missing out on by not using all that MS boilerplate.
--Grahame
User IP Logged

C-2-Q 3GB, C-2-Duo 2GB, both GeForce 9500 GT, . Also an old Pentium-II /Win98SE http/ftp/vnc server (built by IBM, it just won't quit!).
Michael Hutton
Full Member
ImageImageImage

member is offline

Avatar




PM

Gender: Male
Posts: 129
xx Re: API calls for Sound and Video
« Reply #11 on: Oct 14th, 2009, 12:19pm »
Quote

Grahame,

1. Versatility - The matter really rests with the ability to play lots of different types of files. "PlaySound" only plays wav files which are uncompressed PCM format files, and can be very large. The Audioplayer also plays mpg and others (as stated previously by Richard, it depends if the codecs are also installed). How many of your music files are in wav format? Not very many I would guess.

2. Memory Space - your specific method of DIM'ing the space for the file from memory will 'waste' that memory. You could use the "GlobalAlloc" to get windows to save a bit of memory for you. Alternatively playing the wav from file is better in this case, look at "Playing WAV files" in the manual.

3. A lot more reasons others could elucidate better than I.

Michael



User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage

member is offline

Avatar




Homepage PM

Gender: Male
Posts: 276
xx Re: API calls for Sound and Video
« Reply #12 on: Oct 14th, 2009, 2:29pm »
Quote

Quote:
your specific method of DIM'ing the space for the file from memory will 'waste' that memory

That particular shortcoming can be overcome by using:

Code:
DIM wav_4% LOCAL size%-1 

(inside a procedure or function) without having to resort to calling the Windows API.

Richard.
User IP Logged

Malcolm
Guest
xx Re: API calls for Sound and Video
« Reply #13 on: Oct 14th, 2009, 2:46pm »
Quote

Quote:
I am enormously impressed with this, over 1000 lines of terse code. I am a beginner! Could you briefly but cogently tell me *why* all this coding is an improvement over something like....


Terse? This program has a host of REM's explaining what each section is doing. The Procedure names and variables are also quite descriptive (in my view).
As Michael says it was versatile: plays lots of audio types and CD tracks and controls them (stop/start/pause etc). Lets you know what is playing, how far into the track. Lets you open a window to select files. Lets you drag and drop music files. Lets you double click onto a file to play it. You can control the volume and so on and on. None of which your snippet would do. If you understand not one line of code then just listing the REM's would tell you quite a lot about what it is doing. Is it an improvement? Well it depends on what you want to do. The program does nearly everything I wanted it to do, but if you just want to play a known wave file at the standard volume from within your program, with no user interface, then there are 990 lines too many.

It's kind of like saying is a Mercedes an improvement over a pair of roller skates? Sometimes, Yes!


Regards, Malcolm
User IP Logged

19Grumpah42
New Member
Image

member is offline

Avatar




PM

Gender: Male
Posts: 35
xx Re: API calls for Sound and Video
« Reply #14 on: Oct 15th, 2009, 05:16am »
Quote

Thanks for the hearty replies everybody! It certainly is a very rich programme, Malcolm. I'm sure that Richard would agree that I was yet again blind-sided by all the MS stuff!!

My immediate wish was just to load a series of pseudo-system sounds - my own audio recordings, typically less than 100kBy each - which are invoked programmatically in connection with an A/V metronome for my granddaughters to use alongside their playing and singing. I don't really care much about memory usage (I think) since I have 3 GBy on mine and my son has 4 GBy on his.

--Grahame
User IP Logged

C-2-Q 3GB, C-2-Duo 2GB, both GeForce 9500 GT, . Also an old Pentium-II /Win98SE http/ftp/vnc server (built by IBM, it just won't quit!).
Pages: 1 2  Reply Notify Send Topic Print
« Previous Topic | Next Topic »


New Monthly Ad-Free Plan!

$6.99 Gets 50,000 Ad-Free Pageviews!
| Free Shoutboxes | Hookah |

This Board Hosted For FREE By Conforums ©
Get Your Own Free Message Board!